Changeset 66
- Timestamp:
- 10/12/06 21:27:51 (7 years ago)
- Files:
-
- 2 modified
-
grabbers/rex (modified) (16 diffs)
-
status (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
grabbers/rex
r63 r66 3 3 # "Rex" 4 4 5 my $version = '3. 2.2';5 my $version = '3.3.1'; 6 6 7 7 # An Australian TV Guide Grabber (a.k.a. tv_grab_au) … … 57 57 # 3.1.0 : Feature: --ready option 58 58 # 3.2.0 : Feature: gzip compression, report KB downloaded 59 # 3.2.1 : Bugfix : handle failed downloads better59 # 3.2.1 : Bugfix : handle failed downloads properly 60 60 # 3.2.2 : Bugfix : no empty sub-titles in cache; no output buffering 61 # 3.3.0 : Feature: categorize HDTV, premieres, repeats, original airdates, 62 # and widescreen broadcats correctly in XMLTV (not all 63 # (supported by MythTV, alas) 64 # 3.3.1 : Bugfix : stop dumping cache items unnecessarily 61 65 62 66 use strict; … … 126 130 help() if ($opt->{help}); 127 131 128 read_channels_file() if ($opt->{channels_file});129 130 setup_javascript();131 132 132 set_defaults(); 133 134 read_channels_file(); 133 135 134 136 if ($opt->{test}) … … 146 148 } 147 149 148 #Date_Init("TZ=$opt->{TZ}"); # explicitly Set Timezone149 150 150 if ($debug or $opt->{show_config}) 151 151 { … … 161 161 exit 0; 162 162 } 163 164 setup_javascript(); 163 165 164 166 # --------------------------------------------------------------------------- … … 260 262 { 261 263 $shows{$pid} = $show; 264 $cached->{$pid} = $show; 262 265 $count_detail++; 263 266 } … … 352 355 return if ($opt->{test} or $opt->{nowrite_cache}); 353 356 print "Saving cache.\n"; 354 Storable::store( \%shows, $cache_file);357 Storable::store($cached, $cache_file); 355 358 } 356 359 … … 470 473 { 471 474 print "Retrieved " . keys(%$cached) . " cached items from file.\n"; 475 clean_cache(); 472 476 } 473 477 else … … 476 480 print "Not using cache.\n"; 477 481 } 482 } 483 484 sub clean_cache 485 { 486 my $r = expand_date(localtime().""); 487 my $c = 0; 488 print "Removing cache items that finish earlier than $r.\n" if ($debug); 489 foreach (keys %$cached) 490 { 491 if (Date_Cmp($r, $cached->{$_}->{stop}) == 1) 492 { 493 print "Removing $cached->{$_}->{title}[0][0].\n" if ($debug); 494 delete $cached->{$_}; 495 $c++; 496 } 497 } 498 print "Removed $c stale items from cache.\n"; 478 499 } 479 500 … … 763 784 $_ = [ $_, 'advisory', undef ]; 764 785 } 765 $show->{'rating'} = [[ $1, ' CTVA', undef], @extra ];786 $show->{'rating'} = [[ $1, 'ABA', undef], @extra ]; 766 787 } 767 788 else 768 789 { 769 $show->{'rating'} = [[ $1, " CTVA", undef]];790 $show->{'rating'} = [[ $1, "ABA", undef]]; 770 791 } 771 792 } … … 774 795 $show->{'credits'}{'actor'} = [ split(/, /, strip_whitespace($1)) ]; 775 796 } 776 elsif ($str =~ /Year: (\d+)/)777 { 778 #$show->{'date'} = strip_whitespace($1);797 elsif ($str =~ /Year:\s*(\d+)/) 798 { 799 $show->{'date'} = strip_whitespace($1); 779 800 } 780 801 elsif ($str =~ /Other:(.+)/) … … 782 803 next unless (strip_whitespace($1)); 783 804 $str = $tag->as_HTML(); 784 @extra = split(/<br >/, $tag->as_HTML());785 my @to_add;805 @extra = split(/<br \/>/, $tag->as_HTML()); 806 my (@to_add, %video); 786 807 foreach my $bit (@extra) 787 808 { … … 789 810 $bit = strip_whitespace($bit); 790 811 next unless ($bit); 812 if ($bit eq 'Repeat') 813 { 814 $show->{'previously-shown'} = { }; 815 next; # Don't need this in the desc as well as it's 816 # highlighted by MythTV 817 } 818 elsif ($bit eq 'Widescreen') 819 { 820 $video{'aspect'} = '16:9'; 821 } 822 elsif ($bit eq 'Closed Captions') 823 { 824 $show->{'subtitles'} = [ { 'type' => 'teletext' } ]; 825 next; # Just clutters up the desc 826 } 827 elsif ($bit eq 'Premiere') 828 { 829 $show->{'premiere'} = [ [ $bit, $lang ] ]; 830 } 831 elsif ($bit eq 'High Definition') 832 { 833 $video{'quality'} = 'HDTV'; 834 } 791 835 push (@to_add, $bit); 836 $show->{'video'} = \%video if (%video); 792 837 } 793 838 foreach (@to_add) … … 846 891 else 847 892 { 848 print "Unable to read c hannelsfile.\n";893 print "Unable to read config file.\n"; 849 894 } 850 895 } … … 852 897 sub get_command_line_options 853 898 { 854 GetOptions( 'config-file=s' => \$opt->{configfile}, 855 'help' => \$opt->{help}, 899 GetOptions( 'help' => \$opt->{help}, 856 900 'debug' => \$debug, 857 901 'days=i' => \$opt->{days}, … … 951 995 { 952 996 my $t = shift; 953 954 997 $t =~ s/\./:/; 955 998 my $ret = ParseDate($t); -
status
r65 r66 1 1 shepherd:0.2.10:shepherd 2 rex:3. 2.2:grabber2 rex:3.3.1:grabber 3 3 oztivo:0.6:grabber 4 4 abc_website:1.55-r2:grabber
