xmltv/grab/dtv_la tv_grab_dtv_la, 1.11, 1.12 test.conf, 1.2, 1.3

Nick Morrott <[email protected]> Tue, 15 Mar 2016 01:13:13 +0000
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab/dtv_la
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23828/grab/dtv_la

Modified Files:
	tv_grab_dtv_la test.conf 
Log Message:
Update grabber for source site changes and regenerate test configuration

Index: tv_grab_dtv_la
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/dtv_la/tv_grab_dtv_la,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** tv_grab_dtv_la	14 Mar 2016 20:58:48 -0000	1.11
--- tv_grab_dtv_la	15 Mar 2016 01:13:11 -0000	1.12
***************
*** 1,3 ****
! #!/usr/bin/perl -w
  =pod
  
--- 1,3 ----
! #!/usr/bin/perl
  =pod
  
***************
*** 98,132 ****
  (	#(facilitate code-folding)
  #
! # 2014-04-19
  #
  #  URLS
! #    http://www.directv.com.ar/programacion/guia-de-programacion
  #    http://www.directv.com.ar/programacion/guia-de-canales
  #
! #    http://www.directv.cl/guia/guia.aspx?type=&link=nav/
  #    http://www.directv.cl/planes/guia-de-canales
  #
! #    http://www.directv.com.co/guia/guia.aspx?type=
  #    http://www.directv.com.co/paquetes/guia-de-canales
  #
! #    http://www.directv.com.ec/guia/guia.aspx?type=
  #    http://www.directv.com.ec/planes/guia-de-canales
  #
! #    http://www.directv.com.pe/guia/guia.aspx?type=
  #    http://www.directv.com.pe/paquetes/guia-de-canales
  #
! #    http://www.directv.com.uy/guia/guia.aspx?type=
  #    http://www.directv.com.uy/paquetes/guia-de-canales
  #
! #    http://www.directv.com.ve/guia/guia.aspx?type=
  #    http://www.directv.com.ve/planes/guia-de-canales
  #
- #    note the Sky BR site is very dirfferent layout (& appears broken)
- #    http://www.sky.com.br/servicos/Guiadatv/gradecanais.aspx
- #    https://www.sky.com.br/servicos/Guiadatv/GravacaoDistancia.aspx
- #
- #    the Sky MX site is rubbish
- #    http://www.sky.com.mx/sky/gu%C3%ADa-de-programaci%C3%B3n
- #
  );
  
--- 98,136 ----
  (	#(facilitate code-folding)
  #
! # 2016-03-14
  #
  #  URLS
! #    http://www.directv.com.ar/
! #    https://www.directv.com.ar/programacion/guia-de-programacion
  #    http://www.directv.com.ar/programacion/guia-de-canales
  #
! #    http://www.directv.cl/
! #    https://www.directv.cl/guia/guia.aspx?type=&link=nav/
  #    http://www.directv.cl/planes/guia-de-canales
  #
! #    http://www.directv.com.co/
! #    https://www.directv.com.co/guia/guia.aspx?type=
  #    http://www.directv.com.co/paquetes/guia-de-canales
  #
! #    http://www.directv.com.ec/
! #    https://www.directv.com.ec/guia/guia.aspx?type=
  #    http://www.directv.com.ec/planes/guia-de-canales
  #
! #    http://www.directv.com.pe/
! #    https://www.directv.com.pe/guia/guia.aspx?type=
  #    http://www.directv.com.pe/paquetes/guia-de-canales
  #
! #    http://www2.directvpr.com/
! #    https://www.directvpr.com/guia/guia.aspx?type=&link=nav
! #    http://www.directvpr.com/guia-de-canales?link=nav
! 
! #    http://www.directv.com.uy/
! #    https://www.directv.com.uy/guia/guia.aspx?type=
  #    http://www.directv.com.uy/paquetes/guia-de-canales
  #
! #    http://www.directv.com.ve
! #    https://www.directv.com.ve/guia/guia.aspx
  #    http://www.directv.com.ve/planes/guia-de-canales
  #
  );
  
***************
*** 135,138 ****
--- 139,145 ----
  ## REQUIRED LIBRARIES
  ######################################################################
+ use warnings;
+ use strict;
+ 
  use XMLTV;
  use XMLTV::Version '$Id$ ';
***************
*** 390,395 ****
  	$strdt=~ /^(\w*)\s+(\d{1,2}:\d{1,2})/;
  	if ( defined $1 and defined $2) {
! 		$weekday=$1;
! 		$time=UnixDate($2,"%H:%M");
  		if ( UnixDate($date,"%a") eq $weekday ){
  		    return utc_offset("$date $time", $TZ)
--- 397,402 ----
  	$strdt=~ /^(\w*)\s+(\d{1,2}:\d{1,2})/;
  	if ( defined $1 and defined $2) {
! 		my $weekday=$1;
! 		my $time=UnixDate($2,"%H:%M");
  		if ( UnixDate($date,"%a") eq $weekday ){
  		    return utc_offset("$date $time", $TZ)
***************
*** 445,454 ****
  			##print Dumper(@li);die;
  
! 			foreach $li (@li) {
  
  				# <li id="PG_ctl02_Prog_ctl00_liItem" class="" style="width:267px" eventId="121190335202" channel="121"><a href="javascript:return false;" class="ChannelArrowLeft"></a><span id="PG_ctl02_Prog_ctl00_HDCh" style="padding-left:10px;"><literal id="PG_ctl02_Prog_ctl00_litHDCh">Las aventuras de Robin Hood</literal></span><a href="/guia/RecordBox.aspx?iframe&eventId=121190335202&page=grid" class="Action loginAvailable"></a></li>
  				# <li id="PG_ctl02_Prog_ctl01_liItem" class=" toolTip" style="width:99.5px" title="Enciclopedia digital del cosmos" eventId="121190335203" channel="121"><span id="PG_ctl02_Prog_ctl01_HDCh"><literal id="PG_ctl02_Prog_ctl01_litHDCh">Enciclopedia di...</literal></span><a href="/guia/RecordBox.aspx?iframe&eventId=121190335203&page=grid" class="Action loginAvailable"></a></li>
  
! 				# <li id="PG_ctl214_Prog_ctl00_liItem" class=" PpvVenezuela toolTip last disabled" style="width:806px" eventid="" channel="1003" original-title="Programación no disponible"><span id="PG_ctl214_Prog_ctl00_HDCh" style="padding-right:10px;" class="HdActive"><literal id="PG_ctl214_Prog_ctl00_litHDCh">Programación no disponible</literal><span id="PG_ctl214_Prog_ctl00_imgIcon" class="3d"></span></span><a href="javascript:return false;" class="ChannelArrowRight"></a><a href="https://www.directv.com.ve/midirectv/PPVBrowse.aspx?language=&amp;section=DOD&amp;film=" class="Action loginAvailable"></a></li>
  
  				# Method:
--- 452,461 ----
  			##print Dumper(@li);die;
  
! 			foreach my $li (@li) {
  
  				# <li id="PG_ctl02_Prog_ctl00_liItem" class="" style="width:267px" eventId="121190335202" channel="121"><a href="javascript:return false;" class="ChannelArrowLeft"></a><span id="PG_ctl02_Prog_ctl00_HDCh" style="padding-left:10px;"><literal id="PG_ctl02_Prog_ctl00_litHDCh">Las aventuras de Robin Hood</literal></span><a href="/guia/RecordBox.aspx?iframe&eventId=121190335202&page=grid" class="Action loginAvailable"></a></li>
  				# <li id="PG_ctl02_Prog_ctl01_liItem" class=" toolTip" style="width:99.5px" title="Enciclopedia digital del cosmos" eventId="121190335203" channel="121"><span id="PG_ctl02_Prog_ctl01_HDCh"><literal id="PG_ctl02_Prog_ctl01_litHDCh">Enciclopedia di...</literal></span><a href="/guia/RecordBox.aspx?iframe&eventId=121190335203&page=grid" class="Action loginAvailable"></a></li>
  
! 				# <li id="PG_ctl214_Prog_ctl00_liItem" class=" PpvVenezuela toolTip last disabled" style="width:806px" eventid="" channel="1003" original-title="Programación no disponible"><span id="PG_ctl214_Prog_ctl00_HDCh" style="padding-right:10px;" class="HdActive"><literal id="PG_ctl214_Prog_ctl00_litHDCh">Programación no disponible</literal><span id="PG_ctl214_Prog_ctl00_imgIcon" class="3d"></span></span><a href="javascript:return false;" class="ChannelArrowRight"></a><a href="https://www.directv.com.ve/midirectv/PPVBrowse.aspx?language=&amp;section=DOD&amp;film=" class="Action loginAvailable"></a></li>
  
  				# Method:
***************
*** 467,471 ****
  				next if $hasStarted;						# if prog has already started
  				next if ! $_channels{ $channelId };			# if channel not wanted
! 				next if !defined $eventId || $eventId eq '';# e.g. Programación no disponible (can't output anything since no start/stop time!)
  
  				# post content: { "eventId":121190335202, "day":20, "time":"4","minute":"0", "month":"4", "year":"2014" }
--- 474,478 ----
  				next if $hasStarted;						# if prog has already started
  				next if ! $_channels{ $channelId };			# if channel not wanted
! 				next if !defined $eventId || $eventId eq '';# e.g. Programación no disponible (can't output anything since no start/stop time!)
  
  				# post content: { "eventId":121190335202, "day":20, "time":"4","minute":"0", "month":"4", "year":"2014" }
***************
*** 498,502 ****
  				}
  				# 'title' is mandatory in the DTD. If we don't have one then set to unknown
! 				$p->{'title'} = ($LANG eq 'pt_BR' ? 'ignorado' : 'incógnito') if (!defined $p->{'title'} || $p->{'title'} eq '');
  
  
--- 505,509 ----
  				}
  				# 'title' is mandatory in the DTD. If we don't have one then set to unknown
! 				$p->{'title'} = ($LANG eq 'pt_BR' ? 'ignorado' : 'incógnito') if (!defined $p->{'title'} || $p->{'title'} eq '');
  
  
***************
*** 648,652 ****
  
  	# Form to call iteratively
! 	$form=HTML::Form->parse($form_elem->as_HTML(),get_channels_url());
  	my $input;
  
--- 655,659 ----
  
  	# Form to call iteratively
! 	my $form=HTML::Form->parse($form_elem->as_HTML(),get_channels_url());
  	my $input;
  
***************
*** 670,674 ****
  	# Now for each value of the select, we will call get_channels_from_tree subroutine
  	$input=$form->find_input($search_for_input);
! 	$default_value=$input->value;
  	foreach ($input->possible_values) {
  		if ($_ != $default_value) {
--- 677,681 ----
  	# Now for each value of the select, we will call get_channels_from_tree subroutine
  	$input=$form->find_input($search_for_input);
! 	my $default_value=$input->value;
  	foreach ($input->possible_values) {
  		if ($_ != $default_value) {
***************
*** 678,682 ****
  			my $t = new HTML::TreeBuilder;
  			#$t->utf8_mode(1);
! 			$data=$r->decoded_content('default_charset'=>'utf8');
  			#$data=from_to($data,'UTF-8',$OUT_ENCODING) if (is_utf8($data));
  			$t->parse($data) or die "Cannot parse content of Tree\n";
--- 685,689 ----
  			my $t = new HTML::TreeBuilder;
  			#$t->utf8_mode(1);
! 			my $data=$r->decoded_content('default_charset'=>'utf8');
  			#$data=from_to($data,'UTF-8',$OUT_ENCODING) if (is_utf8($data));
  			$t->parse($data) or die "Cannot parse content of Tree\n";
***************
*** 737,765 ****
  ## Get a list of possible countries
  sub get_countries( ) {
! 	my $country_codes = { 'Argentina' => 'AR', 'Caribe' => 'CB', 'Chile' => 'CL', 'Colombia' => 'CO', 'Ecuador' => 'EC', 'Peru' => 'PE', 'Puerto Rico' => 'PR', 'Trinidad' => 'TT', 'Uruguay' => 'UY', 'Venezuela' => 'VE' };
  
  	my $tree = get_tree($countries_list_url);
! 	my @options=$tree->look_down('_tag' => 'div', 'id' => 'country-selector-btm')->look_down('_tag' => 'li');
  	my %countries;
! 	foreach (@options){
! 		if ( my $tag = $_->look_down('_tag' => 'a') ) {
! 			my %country;
! 			$country{'name'} = $tag->as_text();
! 			$country{'url'} = $tag->attr('href');
! 			$country{'id'} = $country_codes->{$country{'name'}};
  
! 			# we won't do the Sky sites - they are very different to DirecTV
! 			if ( $country{'name'} =~ /(SKY Brasil|SKY Mexico)/ ) {
! 				#print "Skipping country - $country{'name'} \n" unless $opt_quiet;
! 				next;
! 			}
  
! 			if ( !defined $country_codes->{$country{'name'}} ) {
! 				print "Unknown country - $country{'name'} \n" unless $opt_quiet;
! 				next;
! 			}
  
  			$countries{$tag->as_text()} = \%country;
- 		}
  	}
  	return %countries;
--- 744,781 ----
  ## Get a list of possible countries
  sub get_countries( ) {
! 	my $country_codes = { 'Argentina' => 'AR'
!                         , 'Caribe' => 'CB'
!                         , 'Chile' => 'CL'
!                         , 'Colombia' => 'CO'
!                         , 'Ecuador' => 'EC'
!                         , 'Perú' => 'PE'
!                         , 'Puerto Rico' => 'PR'
!                         , 'Uruguay' => 'UY'
!                         , 'Venezuela' => 'VE'
!                         };
  
  	my $tree = get_tree($countries_list_url);
! 	my @options=$tree->look_down('_tag' => 'div', 'class' => 'box-menu')->look_down('_tag' => 'div', 'class' => 'items')->look_down('_tag' => 'a');
  	my %countries;
! 	foreach my $tag (@options){
! 		my %country;
! 		$country{'name'} = $tag->as_text();
! 		$country{'url'} = $tag->attr('href') . "/";
!         # Default  URLs to https://  - programme guide is https; channel lists will redirect to http
!         $country{'url'} =~ s/^http:/https:/;
! 		$country{'id'} = $country_codes->{$country{'name'}};
  
! 		# we won't do the Sky sites - they are very different to DirecTV
! 		if ( $country{'name'} =~ /(SKY Brazil|SKY México)/ ) {
! 			#print "Skipping country - $country{'name'} \n" unless $opt_quiet;
! 			next;
! 		}
  
! 		if ( !defined $country_codes->{$country{'name'}} ) {
! 			print "Unknown country - $country{'name'} \n" unless $opt_quiet;
! 			next;
! 		}
  
  			$countries{$tag->as_text()} = \%country;
  	}
  	return %countries;
***************
*** 769,773 ****
  ## Return the user-selected country
  sub select_country( ) {
! 	%countries = get_countries();
  	my @names = sort keys %countries;
  	my $choice = ask_choice("Select your country:", $names[0], @names);
--- 785,789 ----
  ## Return the user-selected country
  sub select_country( ) {
! 	my %countries = get_countries();
  	my @names = sort keys %countries;
  	my $choice = ask_choice("Select your country:", $names[0], @names);
***************
*** 789,793 ****
  		my $tr=$table->look_down(
  			'_tag'=>'tr',sub {
! 				@td=$_[0]->content_list();
  				defined $td[0] and $td[0]->as_text() =~ /\s*$ch_num\s*/
  		    }
--- 805,809 ----
  		my $tr=$table->look_down(
  			'_tag'=>'tr',sub {
! 				my @td=$_[0]->content_list();
  				defined $td[0] and $td[0]->as_text() =~ /\s*$ch_num\s*/
  		    }
***************
*** 941,945 ****
  	die "please select a country ('--loc xx')"  if (!defined $opt_loc || $opt_loc eq '');
  
! 	%countries = get_countries();
  	while ( ($key, $value) = each %countries ) {
  		undef $key;
--- 957,962 ----
  	die "please select a country ('--loc xx')"  if (!defined $opt_loc || $opt_loc eq '');
  
! 	my %countries = get_countries();
!     my ($key, $value);
  	while ( ($key, $value) = each %countries ) {
  		undef $key;

Index: test.conf
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/dtv_la/test.conf,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test.conf	21 Apr 2014 14:20:31 -0000	1.2
--- test.conf	15 Mar 2016 01:13:11 -0000	1.3
***************
*** 1,5 ****
! country VE Venezuela http://www.directv.com.ve/
  channel 105 Canal i (105)
- #channel 107 Venevisión Plus (107)
- #channel 108 VTV (108)
- channel 202 FOX (202)
--- 1,3 ----
! country VE Venezuela https://www.directv.com.ve/ 
! channel 102 Venevisión (102)
  channel 105 Canal i (105)

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140

_______________________________________________
xmltv-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmltv-commit