xmltv/grab/il tv_grab_il,1.25,1.26

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

Modified Files:
	tv_grab_il 
Log Message:
added option "--slow" to output programme descriptions in the xml

Index: tv_grab_il
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/il/tv_grab_il,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** tv_grab_il	19 Dec 2011 22:40:41 -0000	1.25
--- tv_grab_il	24 May 2014 15:49:20 -0000	1.26
***************
*** 22,26 ****
  
  tv_grab_il [--config-file FILE]
!            [--days N] [--offset N]
             [--output FILE] [--quiet] [--debug]
  
--- 22,26 ----
  
  tv_grab_il [--config-file FILE]
!            [--days N] [--offset N] [--slow]
             [--output FILE] [--quiet] [--debug]
  
***************
*** 61,64 ****
--- 61,67 ----
  B<--offset N> Start grabbing at today + N days.  N may be negative.
  
+ B<--slow> Get programme descriptions as well as title.  (Will take a
+ long time with lots of channels selected.)
+ 
  B<--quiet> Suppress the progress-bar normally shown on standard error.
  
***************
*** 114,117 ****
--- 117,132 ----
  use DateTime;
  
+ 
+ # only used while testing the 'slow' option
+ ##$XMLTV::Get_nice::Delay = 0;
+ ##use HTTP::Cache::Transparent;
+ ##HTTP::Cache::Transparent::init( { 
+ ##    BasePath => '/root/.xmltv/cache',
+ ##    NoUpdate => 60*60,			# cache time in seconds
+ ##    MaxAge => 24,				# flush time in hours
+ ##    Verbose => 1,
+ ##} );
+ 
+ 
  my $channel_link_regexp = "\\?w=\\/[0-9]\\/\\/[0-9]*\\/\\/[A-Za-z]*\\/1";
  my $channel_link_id = "\\?w=\\/[0-9]\\/\\/([0-9]*)\\/\\/[A-Za-z]*\\/1";
***************
*** 124,128 ****
    listchannels_sub => \&fetch_channels,
    version => '$Id$',
!   description => "Israel (tv.walla.co.il)"
  });
  
--- 139,144 ----
    listchannels_sub => \&fetch_channels,
    version => '$Id$',
!   description => "Israel (tv.walla.co.il)",
!   extra_options    => [qw/slow/],      # grab descriptions from sub-page
  });
  
***************
*** 248,256 ****
              $show_time->set(hour => $show_hour[0], minute => $show_hour[1], second => 0);
  
!             push @{$programmes}, {
                start => $show_time->strftime("%Y%m%d%H%M%S %z"),
                title => [[ encode( 'utf-8', decode( 'windows-1255', $title->as_text())), 'he']],
                channel => $channel_id
              };
            }
  
--- 264,301 ----
              $show_time->set(hour => $show_hour[0], minute => $show_hour[1], second => 0);
  
!             
!             # If user wants descriptions then get them from the sub-page
!             #  (can also get stop time while we're there!)
!             my ($start, $stop, $desc) = ('', '', ''); my $stop_time;
!             if ( defined $opt->{slow} && $opt->{slow} ) {
!               
!               if ( my $detailtree = XMLTV::Get_nice::get_nice_tree('http://tv.walla.co.il/'.$title->attr('href')) ) {
!                 if ( my $table = $detailtree->look_down('_tag', 'table', 'class', 'wp-0-b') ) {   # get 1st "wp-0-b" table
!                   if ( my $td = $table->look_down('_tag', 'td', 'class', 'w2b', sub{ !$_[0]->look_down('_tag', 'h2') } ) ) {
!                     ($start, $stop) = $td->as_text() =~ /(\d\d:\d\d).*(\d\d:\d\d)/;
!                   }
!                   if ( my $td = $table->look_down('_tag', 'td', 'class', 'w3') ) {
!                     $desc = $td->as_text();
!                   }
!                 }
!               }
!               if ( $stop ne '' ) {
!                 my @stop_hour = split(/:/, $stop);
!                 $stop_time = $show_time->clone();
!                 $stop_time->add (days => 1)  if ( $stop_hour[0] < $show_hour[0] );  # assumes prog not last > 24hours!
!                 $stop_time->set(hour => $stop_hour[0], minute => $stop_hour[1], second => 0);
!               }
!               
!             }
!             
!             my $prog= {
                start => $show_time->strftime("%Y%m%d%H%M%S %z"),
                title => [[ encode( 'utf-8', decode( 'windows-1255', $title->as_text())), 'he']],
                channel => $channel_id
              };
+             $prog->{'stop'} = $stop_time->strftime("%Y%m%d%H%M%S %z")  if defined $stop_time;
+             $prog->{'desc'} = [[ encode( 'utf-8', decode( 'windows-1255', $desc)), 'he']]  if $desc ne '';
+             push @{$programmes}, $prog;
+             
            }
  


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
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.