Changeset 66

Show
Ignore:
Timestamp:
10/12/06 21:27:51 (7 years ago)
Author:
max
Message:

Rex version bump.

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • grabbers/rex

    r63 r66  
    33# "Rex" 
    44 
    5 my $version  = '3.2.2'; 
     5my $version  = '3.3.1'; 
    66 
    77# An Australian TV Guide Grabber (a.k.a. tv_grab_au) 
     
    5757# 3.1.0   : Feature: --ready option 
    5858# 3.2.0   : Feature: gzip compression, report KB downloaded 
    59 # 3.2.1   : Bugfix : handle failed downloads better 
     59# 3.2.1   : Bugfix : handle failed downloads properly 
    6060# 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 
    6165 
    6266use strict; 
     
    126130help() if ($opt->{help}); 
    127131 
    128 read_channels_file() if ($opt->{channels_file}); 
    129  
    130 setup_javascript(); 
    131  
    132132set_defaults(); 
     133 
     134read_channels_file(); 
    133135 
    134136if ($opt->{test}) 
     
    146148} 
    147149 
    148 #Date_Init("TZ=$opt->{TZ}"); # explicitly Set Timezone 
    149  
    150150if ($debug or $opt->{show_config}) 
    151151{ 
     
    161161  exit 0; 
    162162} 
     163 
     164setup_javascript(); 
    163165 
    164166# --------------------------------------------------------------------------- 
     
    260262      { 
    261263        $shows{$pid} = $show; 
     264        $cached->{$pid} = $show; 
    262265        $count_detail++; 
    263266      } 
     
    352355  return if ($opt->{test} or $opt->{nowrite_cache}); 
    353356  print "Saving cache.\n"; 
    354   Storable::store(\%shows, $cache_file); 
     357  Storable::store($cached, $cache_file); 
    355358} 
    356359 
     
    470473  { 
    471474    print "Retrieved " . keys(%$cached) . " cached items from file.\n"; 
     475    clean_cache(); 
    472476  } 
    473477  else 
     
    476480    print "Not using cache.\n"; 
    477481  } 
     482} 
     483 
     484sub 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"; 
    478499} 
    479500 
     
    763784          $_ = [ $_, 'advisory', undef ]; 
    764785        } 
    765         $show->{'rating'} = [[ $1, 'CTVA', undef],  @extra ]; 
     786        $show->{'rating'} = [[ $1, 'ABA', undef],  @extra ]; 
    766787      } 
    767788      else 
    768789      { 
    769         $show->{'rating'} = [[ $1, "CTVA", undef]]; 
     790        $show->{'rating'} = [[ $1, "ABA", undef]]; 
    770791      } 
    771792    } 
     
    774795      $show->{'credits'}{'actor'} = [ split(/, /, strip_whitespace($1)) ]; 
    775796    } 
    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); 
    779800    } 
    780801    elsif ($str =~ /Other:(.+)/) 
     
    782803      next unless (strip_whitespace($1)); 
    783804      $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); 
    786807      foreach my $bit (@extra) 
    787808      { 
     
    789810        $bit = strip_whitespace($bit); 
    790811        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        } 
    791835        push (@to_add, $bit); 
     836        $show->{'video'} = \%video if (%video); 
    792837      } 
    793838      foreach (@to_add) 
     
    846891    else 
    847892    { 
    848         print "Unable to read channels file.\n"; 
     893        print "Unable to read config file.\n"; 
    849894    } 
    850895} 
     
    852897sub get_command_line_options 
    853898{ 
    854   GetOptions( 'config-file=s'   => \$opt->{configfile}, 
    855               'help'            => \$opt->{help}, 
     899  GetOptions( 'help'            => \$opt->{help}, 
    856900              'debug'           => \$debug, 
    857901              'days=i'          => \$opt->{days}, 
     
    951995{ 
    952996  my $t = shift; 
    953  
    954997  $t =~ s/\./:/; 
    955998  my $ret = ParseDate($t); 
  • status

    r65 r66  
    11shepherd:0.2.10:shepherd 
    2 rex:3.2.2:grabber 
     2rex:3.3.1:grabber 
    33oztivo:0.6:grabber 
    44abc_website:1.55-r2:grabber