xmltv/grab/uk_tvguide tv_grab_uk_tvguide,1.12,1.13

Geoff <[email protected]>
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab/uk_tvguide
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16467

Modified Files:
	tv_grab_uk_tvguide 
Log Message:
fixes for changes on source site

Index: tv_grab_uk_tvguide
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/uk_tvguide/tv_grab_uk_tvguide,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** tv_grab_uk_tvguide	31 Jan 2014 11:01:35 -0000	1.12
--- tv_grab_uk_tvguide	2 Apr 2014 13:48:42 -0000	1.13
***************
*** 218,222 ****
  							if ($i == ($opt->{offset} -1)) {
  								my $showstart = $show->look_down('_tag' => 'span', 'class' => 'tvchannel');
! 								my ($h, $i, $a) = $showstart->as_text =~ /(\d*):(\d*)(am|pm)/;
  								if ($a eq 'am' && ($h < 6 || $h == 12)) {
  									# continue processing of pre-6am programme
--- 218,227 ----
  							if ($i == ($opt->{offset} -1)) {
  								my $showstart = $show->look_down('_tag' => 'span', 'class' => 'tvchannel');
! 								my ($h, $i, $a) = $showstart->as_text =~ /(\d*):(\d*)\s*(am|pm)/;
! 								# 2014-04-02  see note below
! 								if (!defined $a) {
! 									$showstart = $show->look_down('_tag' => 'span', 'class' => 'season');
! 									($h, $i, $a) = $showstart->as_text =~ /(\d*):(\d*)\s*(am|pm)/;
! 								}
  								if ($a eq 'am' && ($h < 6 || $h == 12)) {
  									# continue processing of pre-6am programme
***************
*** 236,245 ****
  							# 2013-12-14 site changed
  							#    <a href="javascript:popupshow('http://www.tvguide.co.uk/detail/1889599/94819598/saturday-kitchen-live');" target="_blank" ...
  							#
! 							my $webdetails = $show->look_down('_tag' => 'a', 'href' => qr/javascript:popup/);
  							my $href = $webdetails->attr('href');
  							#    my ($id) = $href =~ /javascript:popup\((\d*)\);/;
  							#    $url = $ROOT_URL . 'detail.asp?id=' . $id;
! 							my ($url) = $href =~ /javascript:popupshow\('(.*)'\);/;
  							#debug "Fetching: $url";
  
--- 241,254 ----
  							# 2013-12-14 site changed
  							#    <a href="javascript:popupshow('http://www.tvguide.co.uk/detail/1889599/94819598/saturday-kitchen-live');" target="_blank" ...
+ 							# 2014-04-02 site changed
+ 							#    <a href="http://www.tvguide.co.uk/detail/138990373/88745969/breakfast" target="_blank"...
  							#
! 							#  my $webdetails = $show->look_down('_tag' => 'a', 'href' => qr/javascript:popup/);
! 							my $webdetails = $show->look_down('_tag' => 'a', 'href' => qr/\/detail\//);
  							my $href = $webdetails->attr('href');
  							#    my ($id) = $href =~ /javascript:popup\((\d*)\);/;
  							#    $url = $ROOT_URL . 'detail.asp?id=' . $id;
! 							#    my ($url) = $href =~ /javascript:popupshow\('(.*)'\);/;
! 							my ($url) = $href;
  							#debug "Fetching: $url";
  
***************
*** 438,444 ****
  							#		<span class="tvchannel">3:00pm </span>
  							# (don't add it even we already have it from the detail page but we still need to delete it from the tree)
  							my $showstart = $show->look_down('_tag' => 'span', 'class' => 'tvchannel');
  							if (!$prog{'start'}) {
! 								my ($h, $i, $a) = $showstart->as_text =~ /(\d*):(\d*)(am|pm)/;
  								$h += 12 if $a eq 'pm' && $h  < 12;		# e.g. 12:30pm means 12:30 !
  								$h -= 12 if $a eq 'am' && $h == 12;		# e.g. 12:30am means 00:30 !
--- 447,462 ----
  							#		<span class="tvchannel">3:00pm </span>
  							# (don't add it even we already have it from the detail page but we still need to delete it from the tree)
+ 
+ 							# @ 2014-04-02 the site has changed to 
+ 							#                         <span class="season">6:00 am </span>
+ 							# but this just doesn't sound right to me (i.e. I think it might change again), so let's try both ways
+ 							#
  							my $showstart = $show->look_down('_tag' => 'span', 'class' => 'tvchannel');
  							if (!$prog{'start'}) {
! 								my ($h, $i, $a) = $showstart->as_text =~ /(\d*):(\d*)\s*(am|pm)/;
! 								if (!defined $a) {
! 									$showstart = $show->look_down('_tag' => 'span', 'class' => 'season');
! 									($h, $i, $a) = $showstart->as_text =~ /(\d*):(\d*)\s*(am|pm)/;
! 								}
  								$h += 12 if $a eq 'pm' && $h  < 12;		# e.g. 12:30pm means 12:30 !
  								$h -= 12 if $a eq 'am' && $h == 12;		# e.g. 12:30am means 00:30 !
***************
*** 519,522 ****
--- 537,545 ----
  							#	push @{$prog{'previously-shown'}}, {};
  							#}
+ 							$showflags = $show->look_down('_tag' => 'span', 'class' => 'tvchannel', sub { $_[0]->as_text =~ /Interactive/ } );
+ 							if ($showflags) {
+ 								# no flag in DTD for this
+ 								$showflags->detach;
+ 							}
  						
  						


------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.