xmltv/grab/sd_json tv_grab_sd_json,1.8,1.9
Kevin Groeneveld <[email protected]> Sat, 28 May 2016 01:56:22 +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-serv6292
Modified Files:
tv_grab_sd_json
Log Message:
tv_grab_sd_json: Add support for episodeImage.
Also update channel icon to include width/height if supplied in the JSON
data.
Index: tv_grab_sd_json
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/sd_json/tv_grab_sd_json,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** tv_grab_sd_json 26 May 2016 23:43:35 -0000 1.8
--- tv_grab_sd_json 28 May 2016 01:56:20 -0000 1.9
***************
*** 328,331 ****
--- 328,342 ----
}
+ sub sd_json_get_image_url {
+ my ($url) = @_;
+
+ if($url =~ /^http/) {
+ return $url;
+ }
+ else {
+ return $sd_json_baseurl . $sd_json_api . 'image/' . $url;
+ }
+ }
+
sub get_lineup_description {
my ($lineup) = @_;
***************
*** 855,858 ****
--- 866,887 ----
}
+ sub get_icon {
+ my ($url, $width, $height) = @_;
+ my %result;
+
+ if($url) {
+ $result{'src'} = sd_json_get_image_url($url);
+ if($width && $height) {
+ $result{'width'} = $width;
+ $result{'height'} = $height;
+ }
+
+ return [ \%result ];
+ }
+ else {
+ return undef;
+ }
+ }
+
sub write_channel {
my ($w, $channel, $map) = @_;
***************
*** 870,874 ****
my $logo = $channel->{'logo'};
! $ch{'icon'} = [{ 'src' => $logo->{'URL'} }] if $logo;
$w->write_channel(\%ch);
--- 899,904 ----
my $logo = $channel->{'logo'};
! my $icon = get_icon($logo->{'URL'}, $logo->{'width'}, $logo->{'height'});
! $ch{'icon'} = $icon if $icon;
$w->write_channel(\%ch);
***************
*** 1049,1052 ****
--- 1079,1088 ----
}
+ sub get_program_icon {
+ my ($details) = @_;
+ my $episode_image = $details->{'episodeImage'};
+ return get_icon($episode_image->{'uri'}, $episode_image->{'width'}, $episode_image->{'height'});
+ }
+
sub get_program_url {
my ($details) = @_;
***************
*** 1268,1272 ****
# 'orig-language' => undef,
'length' => get_program_length($details),
! # 'icon' => undef,
'url' => get_program_url($details),
# 'country' => undef,
--- 1304,1308 ----
# 'orig-language' => undef,
'length' => get_program_length($details),
! 'icon' => get_program_icon($details),
'url' => get_program_url($details),
# 'country' => undef,
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e