xmltv/grab/fi/fi/source yle.pm,2.03,2.04

Stefan Becker <[email protected]>
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab/fi/fi/source
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv26363/grab/fi/fi/source

Modified Files:
	yle.pm 
Log Message:
- programme: increase time accuracy to seconds
- yle: improve title extraction
- yle: ignore programs where start == end time


Index: yle.pm
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/fi/fi/source/yle.pm,v
retrieving revision 2.03
retrieving revision 2.04
diff -C2 -d -r2.03 -r2.04
*** yle.pm	14 Jun 2014 18:18:36 -0000	2.03
--- yle.pm	15 Jun 2014 17:27:26 -0000	2.04
***************
*** 101,104 ****
--- 101,105 ----
      #              ...
      #              <a class="link-grey" href="...">Suunnistuksen Jukolan viesti</a>
+     #              <span class="label movie">Elokuva</span>
      #              ...
      #            </div>
***************
*** 125,129 ****
  	      my $start = $programme->look_down("class", "dtstart");
  	      my $end   = $programme->look_down("class", "dtend");
! 	      my $title = $programme->look_down("class", "program-title");
  	      my $desc  = $programme->look_down("class", "program-desc");
  
--- 126,130 ----
  	      my $start = $programme->look_down("class", "dtstart");
  	      my $end   = $programme->look_down("class", "dtend");
! 	      my $title  = $programme->look_down("class", "program-title");
  	      my $desc  = $programme->look_down("class", "program-desc");
  
***************
*** 131,152 ****
  		$start = $date->parse($start->attr("datetime")) ? undef : $date->secs_since_1970_GMT();
  		$end   = $date->parse($end->attr("datetime"))   ? undef : $date->secs_since_1970_GMT();
- 		$title = $title->as_text();
- 		$desc  = $desc->find("p");
  
! 		$title =~ s/^\s+//;
! 		$title =~ s/\s+$//;
  
! 		if ($start && $end && length($title)) {
! 		  $desc  = $desc ? $desc->as_text() : "";
! 		  $desc  =~ s/^\s+//;
! 		  $desc  =~ s/\s+$//;
  
! 		  debug(3, "List entry $channel ($start -> $end) $title");
! 		  debug(4, $desc) if $desc;
  
! 		  # Create program object
! 		  my $object = fi::programme->new($id, $code, $title, $start, $end);
! 		  $object->description($desc);
! 		  push(@objects, $object);
  		}
  	      }
--- 132,163 ----
  		$start = $date->parse($start->attr("datetime")) ? undef : $date->secs_since_1970_GMT();
  		$end   = $date->parse($end->attr("datetime"))   ? undef : $date->secs_since_1970_GMT();
  
! 		my $link     = $title->find("a");
! 		my $category = $title->look_down("class" => "label movie") ? "elokuvat" : undef;
  
! 		# NOTE: entries with same start and end time are invalid
! 		if ($start && $end && $link && ($start != $end)) {
  
! 		  $title = $link->as_text();
! 		  $title =~ s/^\s+//;
! 		  $title =~ s/\s+$//;
  
! 		  if (length($title)) {
! 
! 		    $desc = $desc->find("p");
! 		    $desc = $desc ? $desc->as_text() : "";
! 		    $desc =~ s/^\s+//;
! 		    $desc =~ s/\s+$//;
! 
! 		    debug(3, "List entry $channel ($start -> $end) $title");
! 		    debug(4, $desc);
! 		    debug(4, $category) if defined $category;
! 
! 		    # Create program object
! 		    my $object = fi::programme->new($id, $code, $title, $start, $end);
! 		    $object->category($category);
! 		    $object->description($desc);
! 		    push(@objects, $object);
! 		  }
  		}
  	      }


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
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.