Changeset 584 for grabbers/rex
- Timestamp:
- 03/03/07 04:52:30 (6 years ago)
- Files:
-
- 1 modified
-
grabbers/rex (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
grabbers/rex
r550 r584 3 3 # "Rex" 4 4 5 my $version = '3. 4.4';5 my $version = '3.5.0'; 6 6 7 7 # An Australian TV Guide Grabber (a.k.a. tv_grab_au) … … 76 76 # 3.4.3 : Bugfix : don't die on corrupted cache file 77 77 # 3.4.4 : Bugfix : --dump-cache works 78 # 3.4.5 : Bugfix : support regions with multiple channels of same name 78 79 79 80 use strict; … … 649 650 my $tree = HTML::TreeBuilder->new_from_content($guidedata); 650 651 my $curchan = ''; 652 my @channels_seen; 651 653 my ($pid, $block, $line, $link, $title); 652 654 my $c = 0; … … 654 656 { 655 657 $c++; 656 next if ($curchan eq $tag->as_text()); # Ignore repeated Station name657 $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; 659 661 if (!$channels->{$curchan}) 660 662 { … … 758 760 $lastpids->{$curchan} = $pid; 759 761 } 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. 768 sub 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]; 760 784 } 761 785
