Changeset 584 for grabbers/rex

Show
Ignore:
Timestamp:
03/03/07 04:52:30 (6 years ago)
Author:
max
Message:

Rex support for regions 71, 79, and 90

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • grabbers/rex

    r550 r584  
    33# "Rex" 
    44 
    5 my $version  = '3.4.4'; 
     5my $version  = '3.5.0'; 
    66 
    77# An Australian TV Guide Grabber (a.k.a. tv_grab_au) 
     
    7676# 3.4.3   : Bugfix : don't die on corrupted cache file 
    7777# 3.4.4   : Bugfix : --dump-cache works 
     78# 3.4.5   : Bugfix : support regions with multiple channels of same name 
    7879 
    7980use strict; 
     
    649650  my $tree = HTML::TreeBuilder->new_from_content($guidedata); 
    650651  my $curchan = ''; 
     652  my @channels_seen; 
    651653  my ($pid, $block, $line, $link, $title); 
    652654  my $c = 0; 
     
    654656  { 
    655657    $c++; 
    656     next if ($curchan eq $tag->as_text()); # Ignore repeated Station name 
    657     $curchan = $tag->as_text(); 
    658     $curchan =~ s/\(.*\)//; 
     658    my $channame = $tag->as_text(); 
     659    my $curchan = translate_channel_name($tag->as_text(), grep($_ eq $channame, @channels_seen)); 
     660    push @channels_seen, $channame; 
    659661    if (!$channels->{$curchan}) 
    660662    { 
     
    758760    $lastpids->{$curchan} = $pid; 
    759761  } 
     762} 
     763 
     764# The guide pages for some regions don't provide any way to distinguish 
     765# between (eg) "Prime (Regional)" and "Prime (Albury)" in the same region, 
     766# other than the order in which they're listed. (They're both called 
     767# simply "Prime".) This func tracks which is which. 
     768sub translate_channel_name 
     769{ 
     770    my ($chan, $seen_before) = @_; 
     771 
     772    my $rchans = { 
     773        71 => { 'TEN' => [ 'TEN (NSW: Southern NSW)', 'TEN (Mildura Digital)' ], 
     774                'Prime' => [ 'Prime (Canberra/Wollongong/South Coast)', 'Prime (Wagga Wagga/Orange)' ] }, 
     775        79 => { 'WIN' => [ 'WIN (QLD: Regional)', 'WIN (Mackay/Wide Bay)' ], 
     776                'Seven' => [ 'Seven (Cairns/Townsville/Mackay/Wide Bay/Sunshine Coast)', 'Seven (Rockhampton/Toowoomba)' ] }, 
     777        90 => { 'Prime' => [ 'Prime (Regional)', 'Prime (Albury)' ] } 
     778        }; 
     779 
     780    my $region = $opt->{region}; 
     781    return $chan unless ($rchans->{$region} and $rchans->{$region}->{$chan}); 
     782    $seen_before = ($seen_before ? 1 : 0); 
     783    return $rchans->{$region}->{$chan}->[$seen_before]; 
    760784} 
    761785