Changeset 1283


Ignore:
Timestamp:
Jul 2, 2010, 5:14:20 PM (8 years ago)
Author:
max
Message:

southerncross_website: Format change. Committed half-working version 0.99, disabled centrally.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grabbers/southerncross_website

    r1208 r1283  
    3434 
    3535my $progname = "southerncross_website"; 
    36 my $version = "0.21"; 
     36my $version = "0.99"; 
    3737 
    3838#use LWP::UserAgent; 
     
    279279  # From http://www.southerncrossbroadcasting.com.au/TVGuide 
    280280  my $channel; 
    281   my $url = "http://www.southerncrossbroadcasting.com.au/TVGuide/eguide.asp?ch="; 
     281#  my $url = "http://www.southerncrossbroadcasting.com.au/TVGuide/eguide.asp?ch="; 
     282  my $url = "http://www.scmedia.com.au/content/eguide.aspx?ch="; 
     283   
    282284 
    283285  # non "Sthn Cross TEN" has different page layout (all Capitals, (year)) 
     
    559561 
    560562  my @table_rows = $tree->find_by_tag_name('table'); 
    561   if (@table_rows < 2) { 
     563  if (@table_rows < 1) { 
    562564    &log("Format has changed for url '$url'"); 
    563565    $stats{bad_html}++; 
     
    566568 
    567569  my $progs_in_day = 0; 
    568   my @tds = $table_rows[1]->find_by_tag_name('td'); # from second table 
     570  my @tds = $table_rows[0]->find_by_tag_name('td'); 
     571  foreach (@tds) 
     572  { 
     573      print " - " . $_->as_trimmed_text() . "\n"; 
     574  } 
    569575  my $td = shift @tds; 
    570576  my $text = $td->as_trimmed_text() if $td; 
     
    582588        POSIX::strftime("%Y%m%d%H%M", localtime($prog->{start})))  
    583589        if $opt->{debug}; 
     590 
    584591    $td = shift @tds || last; 
    585     $text = $td->as_trimmed_text(); 
    586  
    587     next if (not $text); # title 
    588     my $b = $td->find_by_tag_name('b') || next; 
    589     my $title = $b->as_trimmed_text(); 
    590     my $subtitle = $b->right(); 
    591     $subtitle =~ s/ - // if $subtitle; 
     592    my $title = $td->as_trimmed_text(); 
     593 
     594    $td = shift @tds || last; 
     595    my $rating = &Shepherd::Common::subrating($td->as_trimmed_text()); 
     596    &log("parse_page debug: rating : $rating") if $opt->{debug}; 
     597 
     598    $td = shift @tds || last; 
     599    $td = shift @tds || last; 
     600    my $text = $td->as_trimmed_text(); 
     601 
    592602    # <b>Saturday Late Night Movie</b> - Run Lola Run 
    593603    # <b>Sunday Afternoon Premiere Movie</b> - Rat 
    594604    # <b>Sunday Afternoon Movie</b> - Evolution 
    595     my ($rating, %type); 
     605    my (%type); 
    596606    my $post_desc=""; 
    597     if ($subtitle and $title =~ /^(Friday|Saturday|Sunday) .* Movie$/i) { 
     607    if ($title =~ /^(Friday|Saturday|Sunday) .* Movie$/i) { 
    598608      $type{movie} = 1; 
    599609      $type{premiere} = 1 if ($title =~ /Premiere/i); 
    600       &log("parse_page debug: Changing title $title to $subtitle")  
    601           if $opt->{debug}; 
    602       $post_desc .= "($title)"; 
    603       $title = $subtitle; 
    604       $subtitle = undef; 
    605610    } 
    606611    # (Network Premiere) 
     
    625630        $type{repeat} = 1 if ($tag =~ /(^|\W)Replay(\W|$)/i); 
    626631    } 
    627     $type{live} = 1 if ($subtitle and $subtitle =~ /live from/i); 
    628632    $prog->{title} = [[$title, $opt->{lang}]]; 
    629633    &log("parse_page debug: title     : $title $post_desc") if ($opt->{debug}); 
    630     if ($subtitle) { 
    631       $prog->{'sub-title'} = [[$subtitle, $opt->{lang}]]; 
    632       &log("parse_page debug: sub-title : $subtitle") if $opt->{debug}; 
    633     } 
    634     $td = shift @tds || goto PART; 
    635     $text = $td->as_trimmed_text(); 
    636  
    637     if ($text) { # rating 
    638       $rating = $text; 
    639       &log("parse_page debug: rating    : $text") if $opt->{debug}; 
    640     } 
    641     $td = shift @tds || goto PART; 
    642     $text = $td->as_trimmed_text(); 
    643  
    644     if ($text eq chr(160)) { # &nbsp; 
    645       $td = shift @tds || goto PART; 
    646       $text = $td->as_trimmed_text(); 
    647  
    648       if ($text) { 
     634 
     635    if ($text) { 
    649636        # - Live from Aurora  
    650637        # Hosted by Mike Goldman & Bree Amer, this ... # how to parse all 
     
    666653        $prog->{desc} = [[$text, $opt->{lang}]] if $text; # desc 
    667654        &log("parse_page debug: desc      : $text") if $opt->{debug}; 
    668       } 
    669       $td = shift @tds || goto PART; 
    670       $text = $td->as_trimmed_text(); 
    671  
    672       goto PART if ($text ne chr(160)); # &nbsp; 
    673       $td = shift @tds || goto PART; 
    674       $text = $td->as_trimmed_text(); 
    675     } 
    676  
    677     if ($text eq "" and not $td->attr('colspan')) { 
    678       $td = shift @tds || goto PART; 
    679       $text = $td->as_trimmed_text(); 
    680  
    681       if ($text) { # verbose rating 
    682         $post_desc .= $text; 
    683         if ($rating) { 
    684           $rating .= " " . &Shepherd::Common::subrating($text); 
    685         } else { 
    686           $rating = &Shepherd::Common::subrating($text); 
    687         } 
    688         &log("parse_page debug: verbose rating : $text") if $opt->{debug}; 
    689       } 
    690       $td = shift @tds || goto PART; 
    691       $text = $td->as_trimmed_text(); 
    692  
    693       goto PART if ($text ne "" or $td->attr('colspan')); # &nbsp; 
    694       $td = shift @tds || goto PART; 
    695       $text = $td->as_trimmed_text(); 
    696     } 
     655    } 
     656 
    697657  PART: 
    698658    my $category = category_from_title($title); 
  • trunk/status

    r1282 r1283  
    1111grabber         yahoo7widget        2.13 
    1212grabber         foxtel_swf          2.03 
    13 grabber         southerncross_website   0.21 
    1413grabber         ten_website         2.10 
    1514grabber         citysearch          3.0.1-r5 
Note: See TracChangeset for help on using the changeset viewer.