xmltv/grab/pt tv_grab_pt,1.54,1.55
Nick Morrott <[email protected]>
| Newsgroups | gmane.comp.tv.xmltv.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xmltv/xmltv/grab/pt
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23760/grab/pt
Modified Files:
tv_grab_pt
Log Message:
Fix indentation
Index: tv_grab_pt
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/pt/tv_grab_pt,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** tv_grab_pt 13 Apr 2015 15:26:04 -0000 1.54
--- tv_grab_pt 13 Apr 2015 15:41:16 -0000 1.55
***************
*** 116,122 ****
my $HEAD = { 'source-info-url' => "http://$DOMAIN/",
'source-data-url' => "http://www.$DOMAIN/particulares/televisao/guia-tv/",
! 'generator-info-name' => 'XMLTV',
! 'generator-info-url' => 'http://xmltv.org/',
! };
# default language
--- 116,122 ----
my $HEAD = { 'source-info-url' => "http://$DOMAIN/",
'source-data-url' => "http://www.$DOMAIN/particulares/televisao/guia-tv/",
! 'generator-info-name' => 'XMLTV',
! 'generator-info-url' => 'http://xmltv.org/',
! };
# default language
***************
*** 134,138 ****
$opt_configure, $opt_config_file, $opt_gui, $opt_quiet,
$opt_list_channels, $opt_offset, $opt_days, $opt_fast, $opt_icons,
! $opt_debug);
$opt_quiet = 0; # default
$opt_days = 7; # default
--- 134,138 ----
$opt_configure, $opt_config_file, $opt_gui, $opt_quiet,
$opt_list_channels, $opt_offset, $opt_days, $opt_fast, $opt_icons,
! $opt_debug);
$opt_quiet = 0; # default
$opt_days = 7; # default
***************
*** 141,156 ****
$opt_debug = 0;
GetOptions('help' => \$opt_help,
! 'configure' => \$opt_configure,
! 'config-file=s' => \$opt_config_file,
! 'gui:s' => \$opt_gui,
! 'output=s' => \$opt_output,
! 'quiet' => \$opt_quiet,
! 'list-channels' => \$opt_list_channels,
! 'offset=i' => \$opt_offset,
'days=i' => \$opt_days,
! 'fast' => \$opt_fast,
! 'icons' => \$opt_icons, # Fetches channels icons/logos [deprecated - this is now the default]
! 'debug' => \$opt_debug, # undocumented
! )
or usage(0);
usage(1) if $opt_help;
--- 141,156 ----
$opt_debug = 0;
GetOptions('help' => \$opt_help,
! 'configure' => \$opt_configure,
! 'config-file=s' => \$opt_config_file,
! 'gui:s' => \$opt_gui,
! 'output=s' => \$opt_output,
! 'quiet' => \$opt_quiet,
! 'list-channels' => \$opt_list_channels,
! 'offset=i' => \$opt_offset,
'days=i' => \$opt_days,
! 'fast' => \$opt_fast,
! 'icons' => \$opt_icons, # Fetches channels icons/logos [deprecated - this is now the default]
! 'debug' => \$opt_debug, # undocumented
! )
or usage(0);
usage(1) if $opt_help;
***************
*** 173,179 ****
my $mode = XMLTV::Mode::mode('grab', # default
! $opt_configure => 'configure',
! $opt_list_channels => 'list-channels',
! );
# File that stores which channels to download.
--- 173,179 ----
my $mode = XMLTV::Mode::mode('grab', # default
! $opt_configure => 'configure',
! $opt_list_channels => 'list-channels',
! );
# File that stores which channels to download.
***************
*** 216,228 ****
my @want = ask_many_boolean(1, @qs);
foreach (@chs) {
! my $w = shift @want;
! warn("cannot read input, stopping channel questions"), last
! if not defined $w;
! # No need to print to user - XMLTV::Ask is verbose enough.
! # Print a config line, but comment it out if channel not wanted.
! print CONF '#' if not $w;
! my $name = shift @names;
! print CONF "channel $_.$DOMAIN\n";
}
--- 216,228 ----
my @want = ask_many_boolean(1, @qs);
foreach (@chs) {
! my $w = shift @want;
! warn("cannot read input, stopping channel questions"), last
! if not defined $w;
! # No need to print to user - XMLTV::Ask is verbose enough.
! # Print a config line, but comment it out if channel not wanted.
! print CONF '#' if not $w;
! my $name = shift @names;
! print CONF "channel $_.$DOMAIN\n";
}
***************
*** 253,257 ****
start_writing;
foreach (@ch_all) {
! $_{'icon'} = [{'src' => $icons{$_}}] if(defined($icons{$_}));
}
$writer->write_channel($_) foreach @ch_all;
--- 253,257 ----
start_writing;
foreach (@ch_all) {
! $_{'icon'} = [{'src' => $icons{$_}}] if(defined($icons{$_}));
}
$writer->write_channel($_) foreach @ch_all;
***************
*** 312,317 ****
#
! my $bar = new XMLTV::ProgressBar('getting listings',
! scalar @channels)
if not $opt_quiet;
--- 312,316 ----
#
! my $bar = new XMLTV::ProgressBar('getting listings', scalar @channels)
if not $opt_quiet;
***************
*** 323,328 ****
my $channel = { 'id' => $channels{$ch_did}->{'id'},
'display-name' => $channels{$ch_did}->{'display-name'},
! 'icon' => $channels{$ch_did}->{'icon'},
! };
$channel->{'icon'} = [{'src' => $icons{$ch_did}}] if(defined($icons{$ch_did}));
--- 322,327 ----
my $channel = { 'id' => $channels{$ch_did}->{'id'},
'display-name' => $channels{$ch_did}->{'display-name'},
! 'icon' => $channels{$ch_did}->{'icon'},
! };
$channel->{'icon'} = [{'src' => $icons{$ch_did}}] if(defined($icons{$ch_did}));
***************
*** 339,349 ****
my $some=0;
foreach my $ch_did (@channels) {
! #skip legacy channels...
! next unless $channels{$ch_did};
! foreach (process_table($ch_did)) {
! $writer->write_programme($_);
! $some = 1;
! }
! update $bar if $bar;
}
if (not $some) {
--- 338,348 ----
my $some=0;
foreach my $ch_did (@channels) {
! #skip legacy channels...
! next unless $channels{$ch_did};
! foreach (process_table($ch_did)) {
! $writer->write_programme($_);
! $some = 1;
! }
! update $bar if $bar;
}
if (not $some) {
***************
*** 360,370 ****
eval { require Log::TraceMessages };
if ($@) {
! *t = sub {};
! *d = sub { '' };
}
else {
! *t = \&Log::TraceMessages::t;
! *d = \&Log::TraceMessages::d;
! Log::TraceMessages::check_argv();
}
--- 359,369 ----
eval { require Log::TraceMessages };
if ($@) {
! *t = sub {};
! *d = sub { '' };
}
else {
! *t = \&Log::TraceMessages::t;
! *d = \&Log::TraceMessages::d;
! Log::TraceMessages::check_argv();
}
***************
*** 385,393 ****
sub _tidy( $ ) {
for (my $s = shift) {
! # Character 150 seems to be used for 'versus' in sporting
! # events, but I don't know what that is in Portuguese.
! #
! #s/\s\226\s/ vs /g;
! return $_;
}
}
--- 384,392 ----
sub _tidy( $ ) {
for (my $s = shift) {
! # Character 150 seems to be used for 'versus' in sporting
! # events, but I don't know what that is in Portuguese.
! #
! #s/\s\226\s/ vs /g;
! return $_;
}
}
***************
*** 433,591 ****
$ch_xmltv_id =~ /(.+?)\.zon\.pt/;
! # This seems like a useful link but I can't see how to get the channelindex
! # http://www.zon.pt/_layouts/EPGGetProgramsForChannels.aspx?cIndex=1&day=1&order=grelha&category=&numChannels=1
! # http://www.zon.pt/tv/guiaTV/Pages/Guia-TV-programacao.aspx?channelSigla=5
! # 2014-05-19 http://www.nos.pt/particulares/televisao/guia-tv/Pages/channel.aspx?channel=5
! #
my $url = $HEAD->{'source-data-url'} . 'Pages/channel.aspx?channel='.$ch_xmltv_id;
! print STDERR " URL= $url \n" if $opt_debug;
t $url;
my $tree = get_nice_tree($url, '', 'UTF-8');
! my $programmes = {};
! my $firstdaynum;
!
! if ( my $h = $tree->look_down('_tag' => 'div', 'id' => 'programs-container') ) {
! if ( my @h2 = $h->look_down('_tag' => 'div', 'class' => qr/programs-day-list/) ) {
! DAY:
! foreach my $h_day (@h2) { # schedule for a day
! my ($daynum) = $h_day->attr('id') =~ /day(\d*)/;
! $firstdaynum = $daynum if !defined $firstdaynum;
!
! my $dt = $today_date->clone()->set_day($daynum);
! $dt->add( months => 1 ) if $daynum < $firstdaynum;
! #print STDERR "\n" . $dt->strftime("%Y%m%d%H%M%S %z") . "\n";
!
! next DAY if $dt->epoch() < $grab_start || $dt->epoch() >= $grab_stop;
! if ( my @h3 = $h_day->look_down('_tag' => 'li') ) { # progs for a day
! my $j = 0;
! PROG:
! foreach my $h_prog (@h3) { # each prog
! $j++;
! #<li style="height:119px;">
! # <span style="height:55px">
! # <a class="series" id="71841" href="#" title="Anatomia de Grey T.9 Ep.22">
! # <span class="program">Anatomia de Grey T.9 Ep.22</span><br>
! # <span class="duration">02:19 - 03:03</span>
! # </a>
! # </span>
! #</li>
! my ( $p_id, $p_category, $p_title, $p_desc, $p_timespan, $p_start, $p_stop, $p_start_epoch, $p_stop_epoch, $p_episode_num );
! if ( my $a = $h_prog->look_down('_tag' => 'a') ) {
! $p_category = $a->attr('class');
! $p_id = $a->attr('id');
! $p_title = $a->attr('title');
! if ( my $s = $a->look_down('_tag' => 'span', 'class' => 'program') ) {
! $p_desc = tidy $s->as_text();
! }
! if ( my $s = $a->look_down('_tag' => 'span', 'class' => 'duration') ) {
! my ($start_h, $start_m, $stop_h, $stop_m) = $s->as_text() =~ /(\d\d):(\d\d)\s-\s(\d\d):(\d\d)/;
! my $start = $dt->clone(); $start->set( 'hour' => $start_h, 'minute' => $start_m );
! my $stop = $dt->clone(); $stop->set ( 'hour' => $stop_h, 'minute' => $stop_m );
! if ($stop_h < $start_h) { # stop hh < start hh = assume we've gone to the next (or previous) day
! $start->subtract( days => 1 ) if $j == 1; # first programme in day
! $stop->add( days => 1 ) if $j != 1; # not first programme in day
! }
! $p_start = $start->strftime("%Y%m%d%H%M%S %z");
! $p_stop = $stop->strftime("%Y%m%d%H%M%S %z");
! $p_start_epoch = $start->epoch();
! $p_stop_epoch = $stop->epoch();
! $p_timespan = $s->as_text();
! }
! # strip the SnnEnn out of the title (e.g. "Anatomia de Grey T.9 Ep.24")
! my ($p_ser, $p_ep) = ('', ''); my $p_match;
! if ( ($p_match, $p_ser, $p_ep) = $p_title =~ /.*(T\.(\d*)\sEp\.(\d*))/ ) {
! $p_episode_num = --$p_ser . ' . ' . --$p_ep . ' . ';
! } elsif ( ($p_match, $p_ep) = $p_title =~ /.*(Ep\.(\d*))/ ) {
! $p_episode_num = ' . ' . --$p_ep . ' . ';
! }
! $p_title =~ s/$p_match// if $p_match;
! trim $p_title;
! }
! next PROG if $p_start_epoch < $grab_start || $p_start_epoch >= $grab_stop;
! my %prog;
! $prog{'channel'} = "$ch_xmltv_id.$DOMAIN";
! $prog{'id'} = $p_id;
! $prog{'title'} = $p_title;
! $prog{'category'} = $p_category;
! $prog{'start'} = $p_start;
! $prog{'stop'} = $p_stop;
! $prog{'episode-num'} = $p_episode_num;
! $prog{'timespan'} = $p_timespan; # not an xmltv item: used in process_details_page()
! # if user wants details then get them from the programme page
! if (!$opt_fast) {
! process_details_page ( $ch_xmltv_id, \%prog, $tree );
! }
! # store the programme avoiding duplicates
! # also check for duplicate start times and set clumpidx
! {
! if ( defined $programmes->{ $ch_xmltv_id }->{ $p_start_epoch } ) {
! # duplicate prog or contemporary?
! my $dup = 0; my $_P;
! foreach $_P ( @{ $programmes->{ $ch_xmltv_id }->{ $p_start_epoch } } ) {
! $dup = 1 if ( $_P->{'title'} eq $prog{'title'} ); # duplicate
! }
! next PROG if $dup; # ignore duplicates (go to next programme)
! if (!$dup) {
! # contemporary programme so set clumpidx
! my $numclumps = scalar @{ $programmes->{ $ch_xmltv_id }->{ $p_start_epoch } } + 1;
! # set (or adjust) clumpidx of existing programmes
! my $i = 0;
! foreach $_P ( @{ $programmes->{ $ch_xmltv_id }->{ $p_start_epoch } } ) {
! $_P->{'clumpidx'} = "$i/$numclumps";
! $i++;
! }
! # set clumpidx for new programme
! $prog{'clumpidx'} = "$i/$numclumps";
! }
! }
! }
! # store the programme
! push @{ $programmes->{ $ch_xmltv_id }->{ $p_start_epoch } }, \%prog;
! } # end each prog
! } # end progs for each day
! } # schedule for a day
! }
! }
! # did we get any programmes?
! if ( scalar $programmes == 0 ) {
warn "$url ($ch_xmltv_id) : no programmes found\n";
! return;
}
! # format the programmes ready for XMLTV::Writer
my @r;
! foreach ( keys %{$programmes} ) {
! my $_ch_progs = $programmes->{$_};
! foreach ( sort keys %{$_ch_progs} ) {
! my $_dt_progs = $_ch_progs->{$_};
! foreach (@{ $_dt_progs }) {
! push @r, make_programme_hash( $ch_xmltv_id, $_ );
! }
! }
}
return @r;
--- 432,587 ----
$ch_xmltv_id =~ /(.+?)\.zon\.pt/;
! # This seems like a useful link but I can't see how to get the channelindex
! # http://www.zon.pt/_layouts/EPGGetProgramsForChannels.aspx?cIndex=1&day=1&order=grelha&category=&numChannels=1
! # http://www.zon.pt/tv/guiaTV/Pages/Guia-TV-programacao.aspx?channelSigla=5
! # 2014-05-19 http://www.nos.pt/particulares/televisao/guia-tv/Pages/channel.aspx?channel=5
! #
my $url = $HEAD->{'source-data-url'} . 'Pages/channel.aspx?channel='.$ch_xmltv_id;
! print STDERR " URL= $url \n" if $opt_debug;
t $url;
my $tree = get_nice_tree($url, '', 'UTF-8');
! my $programmes = {};
! my $firstdaynum;
+ if ( my $h = $tree->look_down('_tag' => 'div', 'id' => 'programs-container') ) {
+ if ( my @h2 = $h->look_down('_tag' => 'div', 'class' => qr/programs-day-list/) ) {
+ DAY:
+ foreach my $h_day (@h2) { # schedule for a day
+ my ($daynum) = $h_day->attr('id') =~ /day(\d*)/;
+ $firstdaynum = $daynum if !defined $firstdaynum;
! my $dt = $today_date->clone()->set_day($daynum);
! $dt->add( months => 1 ) if $daynum < $firstdaynum;
! #print STDERR "\n" . $dt->strftime("%Y%m%d%H%M%S %z") . "\n";
! next DAY if $dt->epoch() < $grab_start || $dt->epoch() >= $grab_stop;
! if ( my @h3 = $h_day->look_down('_tag' => 'li') ) { # progs for a day
! my $j = 0;
! PROG:
! foreach my $h_prog (@h3) { # each prog
! $j++;
! #<li style="height:119px;">
! # <span style="height:55px">
! # <a class="series" id="71841" href="#" title="Anatomia de Grey T.9 Ep.22">
! # <span class="program">Anatomia de Grey T.9 Ep.22</span><br>
! # <span class="duration">02:19 - 03:03</span>
! # </a>
! # </span>
! #</li>
! my ( $p_id, $p_category, $p_title, $p_desc, $p_timespan, $p_start, $p_stop, $p_start_epoch, $p_stop_epoch, $p_episode_num );
! if ( my $a = $h_prog->look_down('_tag' => 'a') ) {
! $p_category = $a->attr('class');
! $p_id = $a->attr('id');
! $p_title = $a->attr('title');
! if ( my $s = $a->look_down('_tag' => 'span', 'class' => 'program') ) {
! $p_desc = tidy $s->as_text();
! }
! if ( my $s = $a->look_down('_tag' => 'span', 'class' => 'duration') ) {
! my ($start_h, $start_m, $stop_h, $stop_m) = $s->as_text() =~ /(\d\d):(\d\d)\s-\s(\d\d):(\d\d)/;
! my $start = $dt->clone(); $start->set( 'hour' => $start_h, 'minute' => $start_m );
! my $stop = $dt->clone(); $stop->set ( 'hour' => $stop_h, 'minute' => $stop_m );
+ if ($stop_h < $start_h) { # stop hh < start hh = assume we've gone to the next (or previous) day
+ $start->subtract( days => 1 ) if $j == 1; # first programme in day
+ $stop->add( days => 1 ) if $j != 1; # not first programme in day
+ }
! $p_start = $start->strftime("%Y%m%d%H%M%S %z");
! $p_stop = $stop->strftime("%Y%m%d%H%M%S %z");
! $p_start_epoch = $start->epoch();
! $p_stop_epoch = $stop->epoch();
! $p_timespan = $s->as_text();
! }
! # strip the SnnEnn out of the title (e.g. "Anatomia de Grey T.9 Ep.24")
! my ($p_ser, $p_ep) = ('', ''); my $p_match;
! if ( ($p_match, $p_ser, $p_ep) = $p_title =~ /.*(T\.(\d*)\sEp\.(\d*))/ ) {
! $p_episode_num = --$p_ser . ' . ' . --$p_ep . ' . ';
! } elsif ( ($p_match, $p_ep) = $p_title =~ /.*(Ep\.(\d*))/ ) {
! $p_episode_num = ' . ' . --$p_ep . ' . ';
! }
! $p_title =~ s/$p_match// if $p_match;
! trim $p_title;
! }
! next PROG if $p_start_epoch < $grab_start || $p_start_epoch >= $grab_stop;
+ my %prog;
+ $prog{'channel'} = "$ch_xmltv_id.$DOMAIN";
+ $prog{'id'} = $p_id;
+ $prog{'title'} = $p_title;
+ $prog{'category'} = $p_category;
+ $prog{'start'} = $p_start;
+ $prog{'stop'} = $p_stop;
+ $prog{'episode-num'} = $p_episode_num;
+ $prog{'timespan'} = $p_timespan; # not an xmltv item: used in process_details_page()
! # if user wants details then get them from the programme page
! if (!$opt_fast) {
! process_details_page ( $ch_xmltv_id, \%prog, $tree );
! }
! # store the programme avoiding duplicates
! # also check for duplicate start times and set clumpidx
! {
! if ( defined $programmes->{ $ch_xmltv_id }->{ $p_start_epoch } ) {
! # duplicate prog or contemporary?
! my $dup = 0; my $_P;
! foreach $_P ( @{ $programmes->{ $ch_xmltv_id }->{ $p_start_epoch } } ) {
! $dup = 1 if ( $_P->{'title'} eq $prog{'title'} ); # duplicate
! }
! next PROG if $dup; # ignore duplicates (go to next programme)
! if (!$dup) {
! # contemporary programme so set clumpidx
! my $numclumps = scalar @{ $programmes->{ $ch_xmltv_id }->{ $p_start_epoch } } + 1;
! # set (or adjust) clumpidx of existing programmes
! my $i = 0;
! foreach $_P ( @{ $programmes->{ $ch_xmltv_id }->{ $p_start_epoch } } ) {
! $_P->{'clumpidx'} = "$i/$numclumps";
! $i++;
! }
! # set clumpidx for new programme
! $prog{'clumpidx'} = "$i/$numclumps";
! }
! }
! }
! # store the programme
! push @{ $programmes->{ $ch_xmltv_id }->{ $p_start_epoch } }, \%prog;
! } # end each prog
! } # end progs for each day
! } # schedule for a day
! } # programs-day-list
! } # programs-container
! # did we get any programmes?
! if ( scalar $programmes == 0 ) {
warn "$url ($ch_xmltv_id) : no programmes found\n";
! return;
}
! # format the programmes ready for XMLTV::Writer
my @r;
! foreach ( keys %{$programmes} ) {
! my $_ch_progs = $programmes->{$_};
! foreach ( sort keys %{$_ch_progs} ) {
! my $_dt_progs = $_ch_progs->{$_};
! foreach (@{ $_dt_progs }) {
! push @r, make_programme_hash( $ch_xmltv_id, $_ );
! }
! }
}
return @r;
***************
*** 598,655 ****
t "Getting prog details $$prog{'id'} \n";
! # I don't know how much of this url is actually required, but let's try to follow it as far as poss (for stealth reasons)
! #
! # http://www.zon.pt/_layouts/EPGGetProgramDetails.aspx?c=SIC&p=79302&h=0&sh=03:45%20&eh=%2006:00
! #
! # jQuery code:
! # channelAcronym1 = $("#channel-logo img").attr('alt');
! # programId1 = $(this).attr('id');
! #
! # var hasDifferentTime = "";
! # if (programId1 == "-2") {
! # hasDifferentTime = ($(this).find('.duration')).text();
! # }
! #
! # var substr = ($(this).find('.duration')).text().split('-');
! #
! # $.get('/_layouts/EPGGetProgramDetails.aspx?c=' + channelAcronym1 + '&p=' + programId1+ '&h=' + $("#ctl00_PlaceHolderMain_channelProgr_HoursToAddOrRemove").val() + "&sh=" + substr[0] + "&eh=" + substr[1], function (data) {...});
! #
! my $channelAcronym1;
! if ( my $h = $s_tree->look_down('_tag' => 'div', 'id' => 'channel-logo') ) {
! if ( my $h2 = $h->look_down('_tag' => 'img') ) {
! $channelAcronym1 = $h2->attr('alt');
! }
! }
! my $HoursToAddOrRemove = 0;
! if ( my $h = $s_tree->look_down('_tag' => 'input', 'id' => 'ctl00_PlaceHolderMain_channelProgr_HoursToAddOrRemove') ) {
! $HoursToAddOrRemove = $h->attr('value');
! }
! my $programId1 = $$prog{'id'};
! my ($timespan) = $$prog{'timespan'} =~ s/ /%20/g;
! my @substr = split(/-/, $$prog{'timespan'});
my $url = $HEAD->{'source-info-url'} . '_layouts/EPGGetProgramDetails.aspx?c='.$channelAcronym1.'&p='.$programId1.'&h='.$HoursToAddOrRemove.'&sh='.$substr[0].'&eh='.$substr[1];
! print STDERR " URL= $url \n" if $opt_debug;
t $url;
! # This is what the page returns. Looks like an old school delimited list
! # (c.f. OnCallGetProgramDetailsComplete JS code)
! #
! # Anatomia de Grey T.9 Ep.23_#|$_O drama médico mais famoso da televisão centra a sua história nas vidas profissionais e pessoais de um grupo de médicos cirurgiões e dos seus supervisores._#|$_277055_resized_352x198.jpg_#|$_02:47 _#|$_ 03:28_#|$_RTP 1_#|$_2014-05-07T02:47:00+01:00_#|$_2014-05-07T03:28:00+01:00_#|$_false
! #
my $content = get_nice($url);
$content = decode('UTF-8', $content);
! my @data = split(/_#\|\$_/, $content);
! # We could check the title matches what we already have but why not just trust the 'id' is correct ;-)
! $$prog{'desc'} = tidy $data[1]; # store the description in our prog hash
! $$prog{'icon'} = "http://images.$DOMAIN/" . $data[2]; # [2] is a uri to the programme image
! return;
! }
--- 594,651 ----
t "Getting prog details $$prog{'id'} \n";
! # I don't know how much of this url is actually required, but let's try to follow it as far as poss (for stealth reasons)
! #
! # http://www.zon.pt/_layouts/EPGGetProgramDetails.aspx?c=SIC&p=79302&h=0&sh=03:45%20&eh=%2006:00
! #
! # jQuery code:
! # channelAcronym1 = $("#channel-logo img").attr('alt');
! # programId1 = $(this).attr('id');
! #
! # var hasDifferentTime = "";
! # if (programId1 == "-2") {
! # hasDifferentTime = ($(this).find('.duration')).text();
! # }
! #
! # var substr = ($(this).find('.duration')).text().split('-');
! #
! # $.get('/_layouts/EPGGetProgramDetails.aspx?c=' + channelAcronym1 + '&p=' + programId1+ '&h=' + $("#ctl00_PlaceHolderMain_channelProgr_HoursToAddOrRemove").val() + "&sh=" + substr[0] + "&eh=" + substr[1], function (data) {...});
! #
! my $channelAcronym1;
! if ( my $h = $s_tree->look_down('_tag' => 'div', 'id' => 'channel-logo') ) {
! if ( my $h2 = $h->look_down('_tag' => 'img') ) {
! $channelAcronym1 = $h2->attr('alt');
! }
! }
! my $HoursToAddOrRemove = 0;
! if ( my $h = $s_tree->look_down('_tag' => 'input', 'id' => 'ctl00_PlaceHolderMain_channelProgr_HoursToAddOrRemove') ) {
! $HoursToAddOrRemove = $h->attr('value');
! }
! my $programId1 = $$prog{'id'};
! my ($timespan) = $$prog{'timespan'} =~ s/ /%20/g;
! my @substr = split(/-/, $$prog{'timespan'});
my $url = $HEAD->{'source-info-url'} . '_layouts/EPGGetProgramDetails.aspx?c='.$channelAcronym1.'&p='.$programId1.'&h='.$HoursToAddOrRemove.'&sh='.$substr[0].'&eh='.$substr[1];
! print STDERR " URL= $url \n" if $opt_debug;
t $url;
! # This is what the page returns. Looks like an old school delimited list
! # (c.f. OnCallGetProgramDetailsComplete JS code)
! #
! # Anatomia de Grey T.9 Ep.23_#|$_O drama médico mais famoso da televisão centra a sua história nas vidas profissionais e pessoais de um grupo de médicos cirurgiões e dos seus supervisores._#|$_277055_resized_352x198.jpg_#|$_02:47 _#|$_ 03:28_#|$_RTP 1_#|$_2014-05-07T02:47:00+01:00_#|$_2014-05-07T03:28:00+01:00_#|$_false
! #
my $content = get_nice($url);
$content = decode('UTF-8', $content);
! my @data = split(/_#\|\$_/, $content);
! # We could check the title matches what we already have but why not just trust the 'id' is correct ;-)
! $$prog{'desc'} = tidy $data[1]; # store the description in our prog hash
! $$prog{'icon'} = "http://images.$DOMAIN/" . $data[2]; # [2] is a uri to the programme image
! return;
! }
***************
*** 683,689 ****
my %channels;
! # retrieve channels via a dummy call to the schedule page
! # http://www.zon.pt/tv/guiaTV/Pages/GuiaTV.aspx
! # 2014-05-19 http://www.nos.pt/particulares/televisao/guia-tv/Pages/default.aspx
my $url = $HEAD->{'source-data-url'} . 'Pages/default.aspx';
t $url;
--- 679,685 ----
my %channels;
! # retrieve channels via a dummy call to the schedule page
! # http://www.zon.pt/tv/guiaTV/Pages/GuiaTV.aspx
! # 2014-05-19 http://www.nos.pt/particulares/televisao/guia-tv/Pages/default.aspx
my $url = $HEAD->{'source-data-url'} . 'Pages/default.aspx';
t $url;
***************
*** 691,729 ****
my $tree = get_nice_tree($url, '', 'UTF-8');
! # <div id="channels-list-container">
! # <ul id="channels-list-slider">
! # <li>
! # <span class="channel-number">001</span>
! # <span class="channel-logo">
! # <a href='/tv/guiaTV/Pages/Guia-TV-programacao.aspx?channelSigla=5' title='RTP 1'>
! # <img src='/EPGChannelImages/RTP1.png' alt='logótipo RTP 1' />
! # </a>
! # </span>
! # </li>
! # 2014-05-19
! # <li>
! # <span class="channel-logo">
! # <a href="/particulares/televisao/guia-tv/Pages/channel.aspx?channel=5" title="RTP 1">
! # <img src="//images.nos.pt/EPGChannelImages/RTP1.png" alt="logótipo RTP 1">
! # </a>
! # </span>
! # <span class="channel-number">001</span>
! # </li>
! # http://images.nos.pt/EPGChannelImages/RTP1.png
! #
! if ( my $h = $tree->look_down('_tag' => 'div', 'id' => 'channels-list-container') ) {
! if ( my $h2 = $h->look_down('_tag' => 'ul', 'id' => 'channels-list-slider') ) {
! my @h3 = $h2->look_down('_tag' => 'li');
! foreach my $elem (@h3) {
! my ($channel_id, $channel_name, $channel_logo);
! if ( my $h4 = $elem->look_down('_tag' => 'a') ) {
! $channel_name = toUTF8( $h4->attr('title') );
! ($channel_id) = $h4->attr('href') =~ /channel=(\d*)/;
! }
! if ( my $h4 = $elem->look_down('_tag' => 'img') ) {
! $channel_logo = 'http:' . $h4->attr('src');
! }
! # store the channel
! my $ch =
{
'channel-name' => $channel_name,
--- 687,725 ----
my $tree = get_nice_tree($url, '', 'UTF-8');
! # <div id="channels-list-container">
! # <ul id="channels-list-slider">
! # <li>
! # <span class="channel-number">001</span>
! # <span class="channel-logo">
! # <a href='/tv/guiaTV/Pages/Guia-TV-programacao.aspx?channelSigla=5' title='RTP 1'>
! # <img src='/EPGChannelImages/RTP1.png' alt='logótipo RTP 1' />
! # </a>
! # </span>
! # </li>
! # 2014-05-19
! # <li>
! # <span class="channel-logo">
! # <a href="/particulares/televisao/guia-tv/Pages/channel.aspx?channel=5" title="RTP 1">
! # <img src="//images.nos.pt/EPGChannelImages/RTP1.png" alt="logótipo RTP 1">
! # </a>
! # </span>
! # <span class="channel-number">001</span>
! # </li>
! # http://images.nos.pt/EPGChannelImages/RTP1.png
! #
! if ( my $h = $tree->look_down('_tag' => 'div', 'id' => 'channels-list-container') ) {
! if ( my $h2 = $h->look_down('_tag' => 'ul', 'id' => 'channels-list-slider') ) {
! my @h3 = $h2->look_down('_tag' => 'li');
! foreach my $elem (@h3) {
! my ($channel_id, $channel_name, $channel_logo);
! if ( my $h4 = $elem->look_down('_tag' => 'a') ) {
! $channel_name = toUTF8( $h4->attr('title') );
! ($channel_id) = $h4->attr('href') =~ /channel=(\d*)/;
! }
! if ( my $h4 = $elem->look_down('_tag' => 'img') ) {
! $channel_logo = 'http:' . $h4->attr('src');
! }
! # store the channel
! my $ch =
{
'channel-name' => $channel_name,
***************
*** 732,741 ****
'icon' => [ { 'src' => $channel_logo } ],
};
! $channels{$channel_id} = $ch;
! push @ch_all, $ch;
! } #foreach
! }
! }
die "no channels could be found" if not keys %channels;
--- 728,737 ----
'icon' => [ { 'src' => $channel_logo } ],
};
! $channels{$channel_id} = $ch;
! push @ch_all, $ch;
! } #foreach
! }
! }
die "no channels could be found" if not keys %channels;
***************
*** 752,756 ****
}
! sub get_icons { # deprecated
my %icons;
my $url= $HEAD->{"source-info-url"}."/Televisao/ListaProgramas.aspx?dia=0&package=9&cat=&channelSigla=";
--- 748,752 ----
}
! sub get_icons { # deprecated
my %icons;
my $url= $HEAD->{"source-info-url"}."/Televisao/ListaProgramas.aspx?dia=0&package=9&cat=&channelSigla=";
***************
*** 777,781 ****
$icons{$_} = $tag->attr('src');
! $icons{$_} =~ s/\.\./$HEAD->{'source-info-url'}/;
$tb->delete;
--- 773,777 ----
$icons{$_} = $tag->attr('src');
! $icons{$_} =~ s/\.\./$HEAD->{'source-info-url'}/;
$tb->delete;
***************
*** 790,795 ****
sub get_default_dir {
my $winhome = $ENV{HOMEDRIVE} . $ENV{HOMEPATH}
! if defined( $ENV{HOMEDRIVE} )
! and defined( $ENV{HOMEPATH} );
my $home = $ENV{HOME} || $winhome || ".";
--- 786,790 ----
sub get_default_dir {
my $winhome = $ENV{HOMEDRIVE} . $ENV{HOMEPATH}
! if defined( $ENV{HOMEDRIVE} ) and defined( $ENV{HOMEPATH} );
my $home = $ENV{HOME} || $winhome || ".";
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
xmltv-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmltv-commit