xmltv/grab/sd_json tv_grab_sd_json,1.16,1.17
Kevin Groeneveld <[email protected]> Fri, 08 Jul 2016 23:02:19 +0000
| Newsgroups | gmane.comp.tv.xmltv.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xmltv/xmltv/grab/sd_json
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22019
Modified Files:
tv_grab_sd_json
Log Message:
tv_grab_sd_json: Allow search by transmitter for more than GBR.
It turns out I was mistaken that only GBR is supported for transmitter
search. I now parse the available countries from the response to the
/available API.
Index: tv_grab_sd_json
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/sd_json/tv_grab_sd_json,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** tv_grab_sd_json 8 Jul 2016 21:05:47 -0000 1.16
--- tv_grab_sd_json 8 Jul 2016 23:02:17 -0000 1.17
***************
*** 276,279 ****
--- 276,294 ----
}
+ sub sd_json_get_available {
+ my ($type) = @_;
+ my $result = sd_json_request('get', 'available');
+
+ if($type) {
+ for my $entry (@{$result}) {
+ if($entry->{'type'} eq $type) {
+ return $entry;
+ }
+ }
+ }
+
+ return $result;
+ }
+
sub sd_json_get_lineups {
return sd_json_request('get', 'lineups');
***************
*** 371,378 ****
}
sub ask_search_by_transmitter {
my ($country) = @_;
! if($country eq 'GBR') {
my @options;
push(@options, 'transmitter');
--- 386,402 ----
}
+ my %transmitter_countries;
+
sub ask_search_by_transmitter {
my ($country) = @_;
! if(!%transmitter_countries) {
! my $available = sd_json_get_available('DVB-T');
! for ($available->{'description'} =~ /[A-Z]{3}/g) {
! $transmitter_countries{$_} = undef;
! }
! }
!
! if(exists $transmitter_countries{$country}) {
my @options;
push(@options, 'transmitter');
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape