xmltv/grab/pt tv_grab_pt,1.53,1.54

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-serv22584/grab/pt

Modified Files:
	tv_grab_pt 
Log Message:
Trailing whitespace

Index: tv_grab_pt
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/pt/tv_grab_pt,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** tv_grab_pt	31 May 2014 19:29:48 -0000	1.53
--- tv_grab_pt	13 Apr 2015 15:26:04 -0000	1.54
***************
*** 157,161 ****
  
  # Initialise the web page cache
! HTTP::Cache::Transparent::init( { 
      BasePath => get_default_cachedir(),
      NoUpdate => 4*3600,         # cache time in seconds
--- 157,161 ----
  
  # Initialise the web page cache
! HTTP::Cache::Transparent::init( {
      BasePath => get_default_cachedir(),
      NoUpdate => 4*3600,         # cache time in seconds
***************
*** 220,224 ****
      	  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;
--- 220,224 ----
      	  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;
***************
*** 315,319 ****
  				                          scalar @channels)
    if not $opt_quiet;
!   
  # write the <channels> elements
  foreach my $ch_did (@channels) {
--- 315,319 ----
  				                          scalar @channels)
    if not $opt_quiet;
! 
  # write the <channels> elements
  foreach my $ch_did (@channels) {
***************
*** 336,341 ****
  my $grab_stop  = $grab_start + ($opt_days * 86400);
  print STDERR "\n start/end grab: $grab_start $grab_stop \n" if $opt_debug;
! 				
! my $some=0;	
  foreach my $ch_did (@channels) {
  	#skip legacy channels...
--- 336,341 ----
  my $grab_stop  = $grab_start + ($opt_days * 86400);
  print STDERR "\n start/end grab: $grab_start $grab_stop \n" if $opt_debug;
! 
! my $some=0;
  foreach my $ch_did (@channels) {
  	#skip legacy channels...
***************
*** 369,382 ****
      }
  
!     # Use Encode module if available  
!     eval { require Encode; }; 
!     if ($@) { 
!         require Unicode::UTF8simple; 
!         my $uref = new Unicode::UTF8simple; 
!      
!         *toUTF8 = sub { return fix_utf8( $uref->toUTF8(@_) ); } 
!     } else { 
!         #   *toUTF8 = sub { my $str = $_[1]; Encode::from_to($str, $_[0], "utf-8"); return $str; } 
!         *toUTF8 = sub { return fix_utf8( Encode::encode("utf-8", $_[0]) ); } 
      }
  }
--- 369,382 ----
      }
  
!     # Use Encode module if available
!     eval { require Encode; };
!     if ($@) {
!         require Unicode::UTF8simple;
!         my $uref = new Unicode::UTF8simple;
! 
!         *toUTF8 = sub { return fix_utf8( $uref->toUTF8(@_) ); }
!     } else {
!         #   *toUTF8 = sub { my $str = $_[1]; Encode::from_to($str, $_[0], "utf-8"); return $str; }
!         *toUTF8 = sub { return fix_utf8( Encode::encode("utf-8", $_[0]) ); }
      }
  }
***************
*** 395,399 ****
  # Remove bad chars from an element
  sub tidy( $ ) {
!     return $_[0] if !defined $_[0];	
      $_[0] =~ s/(\s)\xA0/$1/og;    # replace 'space-&nbsp;' with 'space'
      $_[0] =~ s/\xA0/ /og;         # replace any remaining &nbsp; with space
--- 395,399 ----
  # Remove bad chars from an element
  sub tidy( $ ) {
!     return $_[0] if !defined $_[0];
      $_[0] =~ s/(\s)\xA0/$1/og;    # replace 'space-&nbsp;' with 'space'
      $_[0] =~ s/\xA0/ /og;         # replace any remaining &nbsp; with space
***************
*** 432,439 ****
  
      $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
--- 432,439 ----
  
      $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
***************
*** 447,462 ****
  	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;
  
--- 447,462 ----
  	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;
  
***************
*** 490,494 ****
  							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  );
--- 490,494 ----
  							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  );
***************
*** 537,541 ****
                      }
  
- 						
  						# store the programme avoiding duplicates
  						# also check for duplicate start times and set clumpidx
--- 537,540 ----
***************
*** 548,552 ****
  								}
  								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;
--- 547,551 ----
  								}
  								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;
***************
*** 572,576 ****
          }
  
! 		
  	# did we get any programmes?
  	if ( scalar $programmes == 0 ) {
--- 571,575 ----
          }
  
! 
  	# did we get any programmes?
  	if ( scalar $programmes == 0 ) {
***************
*** 579,583 ****
      }
  
! 	# format the programmes ready for XMLTV::Writer 
      my @r;
  	foreach ( keys %{$programmes} ) {
--- 578,582 ----
      }
  
! 	# format the programmes ready for XMLTV::Writer
      my @r;
  	foreach ( keys %{$programmes} ) {
***************
*** 643,651 ****
      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
--- 642,650 ----
      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
***************
*** 683,687 ****
      my $bar = new XMLTV::ProgressBar( 'getting list of channels', 1 )  if not $opt_quiet;
      my %channels;
! 	
  	# retrieve channels via a dummy call to the schedule page
  	#   http://www.zon.pt/tv/guiaTV/Pages/GuiaTV.aspx
--- 682,686 ----
      my $bar = new XMLTV::ProgressBar( 'getting list of channels', 1 )  if not $opt_quiet;
      my %channels;
! 
  	# retrieve channels via a dummy call to the schedule page
  	#   http://www.zon.pt/tv/guiaTV/Pages/GuiaTV.aspx
***************
*** 735,739 ****
  				$channels{$channel_id} = $ch;
  				push @ch_all, $ch;
! 				
          }    #foreach
  		}
--- 734,738 ----
  				$channels{$channel_id} = $ch;
  				push @ch_all, $ch;
! 
          }    #foreach
  		}
***************
*** 790,801 ****
  # Get the user's home directory
  sub get_default_dir {
!     my $winhome = $ENV{HOMEDRIVE} . $ENV{HOMEPATH} 
! 			if defined( $ENV{HOMEDRIVE} ) 
! 					and defined( $ENV{HOMEPATH} ); 
!     
      my $home = $ENV{HOME} || $winhome || ".";
      return $home;
  }
!  	  	 
  # Set default cache dir = $HOME/.xmltv/cache
  sub get_default_cachedir {
--- 789,800 ----
  # Get the user's home directory
  sub get_default_dir {
!     my $winhome = $ENV{HOMEDRIVE} . $ENV{HOMEPATH}
! 			if defined( $ENV{HOMEDRIVE} )
! 					and defined( $ENV{HOMEPATH} );
! 
      my $home = $ENV{HOME} || $winhome || ".";
      return $home;
  }
! 
  # Set default cache dir = $HOME/.xmltv/cache
  sub get_default_cachedir {


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