xmltv/grab/uk_tvguide test.conf, 1.2, 1.3 tv_grab_uk_tvguide, 1.13, 1.14 tv_grab_uk_tvguide.map.conf, 1.1, 1.2

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-serv30761

Modified Files:
	test.conf tv_grab_uk_tvguide tv_grab_uk_tvguide.map.conf 
Log Message:
unbreak after source site changed

Index: tv_grab_uk_tvguide
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/uk_tvguide/tv_grab_uk_tvguide,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** tv_grab_uk_tvguide	2 Apr 2014 13:48:42 -0000	1.13
--- tv_grab_uk_tvguide	3 Dec 2014 17:11:38 -0000	1.14
***************
*** 56,62 ****
  my $GRABBER_DESC 						= 'UK - TV Guide (tvguide.co.uk)';
  my $GRABBER_URL 						= 'http://wiki.xmltv.org/index.php/XMLTVProject';
! my $ROOT_URL                = 'http://www.tvguide.co.uk/';
  my $SOURCE_NAME							= 'TV Guide UK';
! my $SOURCE_URL							= 'http://www.tvguide.co.uk/';
  #
  my $generator_info_name 		= $GRABBER_NAME;
--- 56,62 ----
  my $GRABBER_DESC 						= 'UK - TV Guide (tvguide.co.uk)';
  my $GRABBER_URL 						= 'http://wiki.xmltv.org/index.php/XMLTVProject';
! my $ROOT_URL                = 'http://my.tvguide.co.uk/';
  my $SOURCE_NAME							= 'TV Guide UK';
! my $SOURCE_URL							= 'http://my.tvguide.co.uk/';
  #
  my $generator_info_name 		= $GRABBER_NAME;
***************
*** 76,79 ****
--- 76,80 ----
  			version 					=> $VERSION,
  			description 			=> $GRABBER_DESC,
+ 			extra_options			=> [qw/nodetailspage/],
  });
  
***************
*** 243,249 ****
  							# 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*)\);/;
--- 244,257 ----
  							# 2014-04-02 site changed
  							#    <a href="http://www.tvguide.co.uk/detail/138990373/88745969/breakfast" target="_blank"...
+ 							# 2014-11-26 site changed
+ 							#    <a href="http://watch.tvguide.co.uk/engage/2057116/103685857-fake_britain" target="_blank"...
  							#
  							#  my $webdetails = $show->look_down('_tag' => 'a', 'href' => qr/javascript:popup/);
! 							
! 							# 2014-12-03 The new website seems a bit flakey with these details pages, often returning a 500 Server Error
! 							#    Here's an option to disable the details pages  (  --nodetailspage )
! 						if (!$opt->{nodetailspage}) {
! 							
! 							my $webdetails = $show->look_down('_tag' => 'a', 'href' => qr/\/engage\//);
  							my $href = $webdetails->attr('href');
  							#    my ($id) = $href =~ /javascript:popup\((\d*)\);/;
***************
*** 256,262 ****
  							my $treedetail = XMLTV::Get_nice::get_nice_tree($url, \&utf8);
  							
! 							# 	<table border="0" cellpadding="0" style="background:black;border-collapse: collapse;background-image: url(http://i.g8.tv/logobackgrounds/857.jpg); background-repeat: no-repeat;" width="677" height="258px" id="table3" >		
! 					
! 							my $showdetail = $treedetail->look_down('_tag' => 'table', 'border' => '0', 'cellpadding' => '0', 'style' => qr/background:\s*black;border-collapse:\s*collapse;/);						
  							#	$showdetail->dump;
  							
--- 264,268 ----
  							my $treedetail = XMLTV::Get_nice::get_nice_tree($url, \&utf8);
  							
! 							my $showdetail = $treedetail->look_down('_tag' => 'div', 'id' => 'content-engage');						
  							#	$showdetail->dump;
  							
***************
*** 264,360 ****
  								# Details page contains Director names and a better list of Actors
  								
! 								# Whitespace between the <span>s stops right() working so we'll try a different approach.  All the data we want are in <span> tags, so we'll
! 								#	extract them into a new tree
! 								my (@spans) = $showdetail->as_HTML =~ /(<span.*?\/span>)/g;
! 								my $spans = join('', @spans);
! 								my $treespans = HTML::TreeBuilder->new_from_content($spans);
! 								# $treespans->dump;
  								
! 								# v---- this code is geting ugly... should convert it an array-based loop   ###########
  								
! 								# director
! 								# 	<span class="role">Director</span> <span class="actor">Anthony Page</span></a><br>
! 								my $showdirector = $treespans->look_down('_tag' => 'span', 'class' => 'role', sub { $_[0]->as_text =~ /^Director/ } );
! 								if ($showdirector) {
! 									$showdirector = $showdirector->right;
! 									#$showdirector = $showdirector->right if ($showdirector->tag eq 'a');
! 									if ($showdirector->tag eq 'span' && $showdirector->attr('class') eq 'actor') {
! 										if ($showdirector->as_text) {
! 											foreach ( split(', ', $showdirector->as_text) ) {
! 												push @{$prog{'credits'}{'director'}}, encode('utf-8', $_);
! 											}
  										}
! 									}
! 									$showdirector->detach;
! 								}
! 								
! 								#	producer
! 								my $showproducer = $treespans->look_down('_tag' => 'span', 'class' => 'role', sub { $_[0]->as_text =~ /^Producer/ } );
! 								if ($showproducer) {
! 									$showproducer = $showproducer->right;
! 									#$showproducer = $showproducer->right if ($showproducer->tag eq 'a');
! 									if ($showproducer->tag eq 'span' && $showproducer->attr('class') eq 'actor') {
! 										if ($showproducer->as_text) {
! 											foreach ( split(', ', $showproducer->as_text) ) {
! 												push @{$prog{'credits'}{'producer'}}, encode('utf-8', $_);
! 											}
  										}
! 									}
! 									$showproducer->detach;
  								} else {
! 									$showproducer = $treespans->look_down('_tag' => 'span', 'class' => 'role', sub { $_[0]->as_text =~ /^Series Producer/ } );
! 									if ($showproducer) {
! 										$showproducer = $showproducer->right;
! 										#$showproducer = $showproducer->right if ($showproducer->tag eq 'a');
! 										if ($showproducer->tag eq 'span' && $showproducer->attr('class') eq 'actor') {
! 											if ($showproducer->as_text) {
! 												foreach ( split(', ', $showproducer->as_text) ) {
! 													push @{$prog{'credits'}{'producer'}}, encode('utf-8', $_);
! 												}
! 											}
! 										}
! 										$showproducer->detach;
! 									}
! 								}
! 								
! 								#	 writer
! 								my $showwriter = $treespans->look_down('_tag' => 'span', 'class' => 'role', sub { $_[0]->as_text =~ /^Writer/ } );
! 								if ($showwriter) {
! 									$showwriter = $showwriter->right;
! 									#$showwriter = $showwriter->right if ($showwriter->tag eq 'a');
! 									if ($showwriter->tag eq 'span' && $showwriter->attr('class') eq 'actor') {
! 										if ($showwriter->as_text) {
! 											foreach ( split(', ', $showwriter->as_text) ) {
! 												push @{$prog{'credits'}{'writer'}}, encode('utf-8', $_);
! 											}
! 										}
! 									}
! 									$showwriter->detach;
! 								}
! 								
! 								#	drop the "Series Producer" (if it's still present)
! 								$showproducer = $treespans->look_down('_tag' => 'span', 'class' => 'role', sub { $_[0]->as_text =~ /^Series Producer/ } );
! 								if ($showproducer) { 
! 									$showproducer = $showproducer->right;
! 									$showproducer->detach; 
  								}
  								
! 								#	drop the "Executive Producer"
! 								$showproducer = $treespans->look_down('_tag' => 'span', 'class' => 'role', sub { $_[0]->as_text =~ /^Executive Producer/ } );
! 								if ($showproducer) { 
! 									$showproducer = $showproducer->right;
! 									$showproducer->detach; 
  								}
  								
- 								#		all the "role" left should be Actors
- 								my @showactors = $treespans->look_down('_tag' => 'span', 'class' => 'actor');
- 								if (scalar @showactors > 0) {
- 									foreach my $showactor (@showactors) {
- 										if ($showactor->as_text ne '(IMDB)') { 	# ignore IMDB link spans
- 											push @{$prog{'credits'}{'actor'}}, encode('utf-8', $showactor->as_text);
- 										}
- 									}
  								}
  								
  								#	rating 		i.e. "Certificate"
  								my $showcertificate = $treespans->look_down('_tag' => 'span', 'class' => 'tvchannel', sub { $_[0]->as_text =~ /Certificate/ } );
--- 270,315 ----
  								# Details page contains Director names and a better list of Actors
  								
! 								if ( my ($cast) = $showdetail->look_down('_tag' => 'div', 'class' => qr/castoverlay/) ) {
  								
! 									# Get the cast and extract them into a new tree
! 									my @lis = $cast->look_down('_tag' => 'li');		
  								
! 									LOOP:
! 									foreach my $person (@lis) {
! 										#    <div>Don Sharp </div><div class="partname">Director</div>
! 										#    <div>Antonio Banderas</div>  <div class='partname' >Ahmed Ibn Fahdlan</div>
! 										#
! 										my ($name, $role);
! 										if ( my ($_name) = $person->look_down('_tag' => 'div') ) {
! 											$name = $_name->as_text;
  										}
! 										if ( my ($_role) = $person->look_down('_tag' => 'div', 'class' => 'partname') ) {
! 											$role = $_role->as_text;
  										}
! 										#	drop the "Executive Director" & "Executive Producer"   - any others we should drop?
! 										next LOOP  if ( $role =~ /^(Executive Director|Executive Producer)/ );
! 
! 										# map the website role to an xmltv role
! 										my %xmltvroles = ( 'Director'=>'director', 'Producer'=>'producer', 'Series Producer'=>'producer', 'Writer'=>'writer', 'Co-Director'=>'director', 'Presenter'=>'presenter', 'Commentator'=>'commentator', 'Guest'=>'guest' );
! 										
! 										my $credit;
! 										if (exists $xmltvroles{$role}) {
! 											$credit = $xmltvroles{$role};
  								} else {
! 											$credit = 'actor';
  								}
  								
! 										if ($credit eq 'actor' && defined $role) {
! 											push @{$prog{'credits'}{$credit}}, [ encode('utf-8', $name), encode('utf-8', $role) ];
! 										} else {
! 											push @{$prog{'credits'}{$credit}}, encode('utf-8', $name);
  								}
  								
  								}
  								
+ 									
+ 									# removed after site changed 2014-11-26
+ 									if (0) {  my ($treespans);
+ 									
  								#	rating 		i.e. "Certificate"
  								my $showcertificate = $treespans->look_down('_tag' => 'span', 'class' => 'tvchannel', sub { $_[0]->as_text =~ /Certificate/ } );
***************
*** 427,433 ****
  								}
  								
  								
! 								undef $treespans;
  							}	# end showdetail
  								
  								
--- 382,393 ----
  								}
  								
+ 									}
+ 									
+ 									
+ 									undef @lis;
  								
! 								}
  							}	# end showdetail
+ 						}
  								
  								
***************
*** 518,526 ****
  								$showflags->detach;
  							}
! 							$showflags = $show->look_down('_tag' => 'span', 'class' => 'tvchannel', sub { $_[0]->as_text =~ /Audio Described/ } );
! 							if ($showflags) {
! 								push @{$prog{'subtitles'}}, {'type' => 'deaf-signed'};
! 								$showflags->detach;
! 							}
  							$showflags = $show->look_down('_tag' => 'span', 'class' => 'tvchannel', sub { $_[0]->as_text =~ /Repeat/ } );
  							if ($showflags) {
--- 478,486 ----
  								$showflags->detach;
  							}
! 							#$showflags = $show->look_down('_tag' => 'span', 'class' => 'tvchannel', sub { $_[0]->as_text =~ /Audio Described/ } );
! 							#if ($showflags) {
! 							#	push @{$prog{'subtitles'}}, {'type' => 'deaf-signed'};    <-- Audio Described is not deaf-signed
! 							#	$showflags->detach;
! 							#}
  							$showflags = $show->look_down('_tag' => 'span', 'class' => 'tvchannel', sub { $_[0]->as_text =~ /Repeat/ } );
  							if ($showflags) {
***************
*** 567,571 ****
--- 527,535 ----
  							my $showeptitle = $show->look_down('_tag' => 'span', 'class' => 'tvchannel');
  							if ($showeptitle) {
+ 							  if ($showeptitle->as_text =~ /\(?Premiere\)?/) {
+ 									$prog{'premiere'} = [];
+ 							  } else {									
  								$prog{'sub-title'} = [[ encode('utf-8', $showeptitle->as_text), 'en' ]];
+ 								}
  								$showeptitle->detach;
  							}

Index: tv_grab_uk_tvguide.map.conf
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/uk_tvguide/tv_grab_uk_tvguide.map.conf,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tv_grab_uk_tvguide.map.conf	17 Oct 2013 12:21:53 -0000	1.1
--- tv_grab_uk_tvguide.map.conf	3 Dec 2014 17:11:38 -0000	1.2
***************
*** 38,41 ****
--- 38,42 ----
  map==89==bbc2.tvguide.co.uk
  map==172==itv1.tvguide.co.uk
+ map==145==film4.tvguide.co.uk
  
  

Index: test.conf
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/uk_tvguide/test.conf,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test.conf	18 Oct 2013 08:45:51 -0000	1.2
--- test.conf	3 Dec 2014 17:11:38 -0000	1.3
***************
*** 3,4 ****
--- 3,5 ----
  channel!89
  channel!172
+ channel=145


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
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.