Changeset 1079

Show
Ignore:
Timestamp:
07/01/08 23:47:26 (5 years ago)
Author:
max
Message:

Added "expanded" grabbing mode, which looks for channel-days filled by grabbers that don't support sub-titles and requests backup data from any Type 2 (fast) grabbers that do support sub-titles.

Location:
trunk
Files:
12 modified

Legend:

Unmodified
Added
Removed
  • trunk/applications/shepherd

    r1077 r1079  
    22 
    33our $progname = 'shepherd'; 
    4 my $version = '1.3.11'; 
     4my $version = '1.3.12'; 
    55 
    66# tv_grab_au 
     
    225225    &calc_date_range; 
    226226    &start_tor; 
     227 
    227228    &grab_data("standard"); 
     229 
    228230    &grab_data("paytv") if (defined $want_paytv_channels); 
     231 
     232    &grab_data("expanded");     # Use C2 grabbers to fill missing sub-titles 
     233 
    229234    $any_data = &reconcile_data; 
    230235    if ($any_data) 
     
    26022607 
    26032608    $find_microgaps = 0; 
     2609    $missing_unfillable = undef; 
    26042610 
    26052611    my $used_grabbers = 0; 
    26062612    &log("\nSHEPHERD: Grabber stage ($grab_policy).\n"); 
     2613    &log("SHEPHERD: Seeking supplementary data for episode names ('sub-titles').\n"); 
    26072614    &log("SHEPHERD: " . 
    26082615         (($opt->{mode} and grep($_ eq lc($opt->{mode}), qw(quality speed))) ? 
     
    26452652                 ($find_microgaps ? 'microgaps within ' : '') . 
    26462653                 display_best_timeslice()); 
    2647  
    2648             record_requested_chandays($grabber, $timeslice); 
    26492654 
    26502655            if ($timeslice->{start} != 0) 
     
    26962701            $comm .= " --channels_file $channels_file"; 
    26972702        } 
     2703 
     2704        &record_requested_chandays($grabber, $timeslice); 
    26982705 
    26992706        if ((defined $plugin_data->{tor_pid}) && 
     
    27592766 
    27602767        my $missing_before = convert_dayhash_to_list($missing); 
    2761         my $missing_after = convert_dayhash_to_list(detect_missing_data(1)); 
     2768        my $missing_after = convert_dayhash_to_list(detect_missing_data($grab_policy, 1)); 
    27622769        my $list = List::Compare->new($missing_before, $missing_after); 
    27632770        my @grabbed = $list->get_symmetric_difference(); 
     
    27802787 
    27812788        last if ($data_found_all); 
    2782         if ($data_satisfies_policy) 
     2789        if ($data_satisfies_policy and $grab_policy ne 'expanded') 
    27832790        { 
    27842791            $find_microgaps = 1; 
     
    28212828    my $grabber_policy = shift; 
    28222829 
    2823     $missing = detect_missing_data() if ($grabber_policy ne "paytv"); 
     2830    $missing = detect_missing_data($grabber_policy) if ($grabber_policy ne "paytv"); 
    28242831    my $total; 
    28252832 
     
    28542861            $timeslice = find_best_timeslice(); 
    28552862 
    2856             if ($timeslice->{chandays} == 0 && !$find_microgaps) { 
     2863            if ($timeslice->{chandays} == 0 && !$find_microgaps and $grabber_policy eq 'standard') { 
    28572864                &log("SHEPHERD: No fillable timeslices, trying microgaps!\n\n"); 
    28582865                $find_microgaps = 1; 
    2859                 $missing = detect_missing_data(); 
     2866                $missing = detect_missing_data($grabber_policy); 
    28602867                remove_missing_unfillable(); 
    28612868                $timeslice = find_best_timeslice(); 
     
    30853092        } 
    30863093 
    3087         if (!supports_region($grabber)) 
    3088         { 
    3089             &log(1, "Zeroing $grabber due to no region support\n"); 
     3094        if ($grabber_policy eq 'expanded' and ($cat != 2 or !&query_config($grabber, 'has_subtitles'))) 
     3095        { 
    30903096            $hits = 0; 
    30913097        } 
     3098        elsif (!supports_region($grabber)) 
     3099        { 
     3100#           &log(1, "Zeroing $grabber due to no region support\n"); 
     3101            $hits = 0; 
     3102        } 
    30923103        elsif (($find_microgaps) and (!query_config($grabber, 'micrograbs'))) 
    30933104        { 
    3094             &log(1, "Zeroing $grabber due to non-micrograbbing\n"); 
     3105#           &log(1, "Zeroing $grabber due to non-micrograbbing\n"); 
    30953106            $hits = 0; 
    30963107        } 
     
    31613172                            $dq, 
    31623173                            $score) if ($hits); 
    3163         &log(1, "$str.\n"); 
     3174#       &log(1, "$str.\n"); 
    31643175 
    31653176        if ($score and query_config($grabber, 'option_anon_socks') and !defined $plugin_data->{tor_pid})  
    31663177        { 
    3167             &log(1, "Grabber $grabber needs Tor to run efficiently: reducing score.\n"); 
     3178#           &log(1, "Grabber $grabber needs Tor to run efficiently: reducing score.\n"); 
    31683179            $score = int($score/10)+1; 
    31693180        } 
     
    31933204                $total -= $gscore->{$_}; 
    31943205                $gscore->{$_} = 0; 
    3195                 &log(1, "Zeroing grabber $_ due to low data quality.\n"); 
     3206#               &log(1, "Zeroing grabber $_ due to low data quality.\n"); 
    31963207            } 
    31973208        } 
     
    33053316 
    33063317# Build a dayhash of what channel/day data we're currently missing. 
    3307 # Only policy-violating holes count unless it's sent the detect_microgaps 
    3308 # flag. 
     3318# Only policy-violating holes count unless $find_microgaps is set. 
    33093319sub detect_missing_data 
    33103320{ 
    3311     my ($quiet) = @_; 
     3321    my ($grabber_policy, $quiet) = @_; 
    33123322 
    33133323    my $m = { }; 
    33143324 
    33153325    &log("SHEPHERD: Hunting for microgaps!\n") if ($find_microgaps and !$quiet); 
    3316     my @chans; 
    33173326    foreach my $ch (keys %$channels) 
    33183327    { 
     
    33293338                    push (@{($m->{$day})}, $ch); 
    33303339                    $lastday = $day; 
    3331                     push (@chans, $ch) unless (grep ($_ eq $ch, @chans)); 
    33323340                } 
     3341            } 
     3342        } 
     3343        elsif ($grabber_policy eq 'expanded') 
     3344        { 
     3345            # Search our guide data for any channel-days that were filled 
     3346            # by grabbers that don't support sub-titles. 
     3347 
     3348            foreach my $day (@{($channel_data->{$ch}->{analysis}->{day})}) 
     3349            { 
     3350                my $str; 
     3351 
     3352                foreach my $plugin (keys %$plugin_data) 
     3353                { 
     3354                    next unless ($plugin =~ /^(.*)-\d+$/); 
     3355                    my $pluginname = $1; 
     3356 
     3357                    next unless ($components->{$pluginname} and $components->{$pluginname}->{type} eq 'grabber'); 
     3358 
     3359                    if ($plugin_data->{$plugin}->{analysis}->{$ch}->{day}->[$day->{num}]->{have}) 
     3360                    { 
     3361                        # This grabber has supplied some data for this channel-day  
     3362     
     3363                        if (&query_config($pluginname, 'has_subtitles')) 
     3364                        { 
     3365                            # The grabber supports subtitles 
     3366         
     3367                            if (!$plugin_data->{$plugin}->{analysis}->{$ch}->{day}->[$day->{num}]->{missing}) 
     3368                            { 
     3369                                # A subtitle-supporting grabber supplied this channel-day; 
     3370                                # no need for further data. 
     3371 
     3372                                $m->{$day->{num}} = [ grep($_ ne $ch, @{$m->{$day->{num}}}) ]; 
     3373                                delete $m->{$day->{num}} unless (@{$m->{$day->{num}}}); 
     3374                                undef $str; 
     3375                                last; 
     3376                            } 
     3377 
     3378                            # Otherwise this grabber didn't fill the whole day, so 
     3379                            # we still should seek data 
     3380                        } 
     3381                        else 
     3382                        { 
     3383                            # The grabber that supplied data doesn't support sub-titles; 
     3384                            # add this channel-day to our list of holes. 
     3385 
     3386                            $str = "May lack episode names: $ch day $day->{num} (filled by $pluginname)\n"; 
     3387                            push(@{($m->{($day->{num})})}, $ch); 
     3388                        } 
     3389                    } 
     3390                } 
     3391                &log(1, "SHEPHERD: $str") if ($str);    # If we get this far, it's a 'suspect' channel-day 
    33333392            } 
    33343393        } 
     
    33383397            { 
    33393398                push(@{($m->{($day->{num})})}, $ch) unless ($day->{day_ok}); 
    3340                 push (@chans, $ch) unless (grep ($_ eq $ch, @chans)); 
    3341             } 
    3342         } 
    3343     } 
    3344  
     3399            } 
     3400        } 
     3401    } 
     3402 
     3403    my @chans; 
    33453404    foreach my $day (keys %$m) 
    33463405    { 
    33473406        $m->{$day} = [ sort @{$m->{$day}} ]; 
     3407        foreach my $ch (@{$m->{$day}}) 
     3408        { 
     3409            push (@chans, $ch) unless (grep ($_ eq $ch, @chans)); 
     3410        } 
    33483411    } 
    33493412 
  • trunk/grabbers/abc_website.conf

    r1009 r1079  
    1111            'micrograbs' => 1, 
    1212            'quality' => 2, 
     13            'has_subtitles' => 1, 
    1314            'cache' => 1, 
    1415            'max_runtime' => '120', 
  • trunk/grabbers/channelnsw_gov.conf

    r728 r1079  
    1212            'category' => 2, 
    1313            'quality' => 3, 
     14            'has_subtitles' => 1, 
    1415            'option_days' => '--days' 
    1516          }; 
  • trunk/grabbers/oztivo.conf

    r1062 r1079  
    99            'type' => 'both', 
    1010            'max_runtime' => '15', 
     11            'has_subtitles' => 1, 
    1112            'quality' => 1 
    1213          }; 
  • trunk/grabbers/rex.conf

    r1072 r1079  
    1919            }, 
    2020            'max_runtime' => '240', 
     21            'has_subtitles' => 1, 
    2122            'option_days' => '--days', 
    2223            'micrograbs' => 1, 
  • trunk/grabbers/sbsnews_website.conf

    r966 r1079  
    1111            'micrograbs' => 1, 
    1212            'quality' => 3, 
     13            'has_subtitles' => 1, 
    1314            'max_runtime' => '15', 
    1415            'option_days' => '--days' 
  • trunk/grabbers/sbsweb.conf

    r1059 r1079  
    1212            'category' => 2, 
    1313            'quality' => 2, 
     14            'has_subtitles' => 1, 
    1415            'option_days' => '--days' 
    1516          }; 
  • trunk/grabbers/southerncross_website.conf

    r1061 r1079  
    1414            'category' => 2, 
    1515            'quality' => '2.5', 
     16            'has_subtitles' => 1, 
    1617            'option_days' => '--days' 
    1718          }; 
  • trunk/grabbers/ten_website.conf

    r507 r1079  
    1313            'micrograbs' => 1, 
    1414            'quality' => 3, 
     15            'has_subtitles' => 1, 
    1516            'cache' => 1, 
    1617            'option_days' => '--days' 
  • trunk/grabbers/yahoo7widget.conf

    r1076 r1079  
    1616            'category' => 2, 
    1717            'quality' => 3, 
     18            'has_subtitles' => 1, 
    1819            'option_days' => '--days', 
    1920            'channel_support_exceptions' => '63:-7HD,TEN_HD 67:-Prime_HD,Nine_HD,TEN_HD 69:-Nine_HD,TEN_HD 71:-Nine_HD,TEN_HD 73:-Channel_NSW,ACC,EXPO 74:-7HD,Nine_HD,TEN_HD 79:-Nine_HD,TEN_HD 82:-Nine_HD,TEN_HD 83:-Nine_HD,TEN_HD 85:-Nine_HD,TEN_HD 86:-7HD,Nine_HD,TEN_HD 88:-7HD,Nine_HD,TEN_HD 90:-Nine_HD,TEN_HD 95:-Nine_HD,TEN_HD 98:-7HD,Nine_HD,TEN_HD 102:-7HD,Nine_HD,TEN_HD 106:-7HD,Prime_HD,Nine_HD 107:-7HD,Nine_HD 108:-7HD,Nine_HD 114:-7HD,Nine_HD 126:-Nine_HD,TEN_HD 184:-Nine_HD,TEN_HD 253:-Nine_HD,TEN_HD 254:-Nine_HD,TEN_HD 256:-Nine_HD,TEN_HD 257:-Nine_HD,TEN_HD 258:-Nine_HD,TEN_HD 259:-Nine_HD,TEN_HD 261:-Nine_HD,TEN_HD 262:-Nine_HD,TEN_HD 263:-Nine_HD,TEN_HD 264:-Nine_HD,TEN_HD 266:-Nine_HD,TEN_HD 267:-Nine_HD,TEN_HD 268:-Nine_HD,TEN_HD', 
  • trunk/status

    r1077 r1079  
    1 application     shepherd            1.3.11 
     1application     shepherd            1.3.12 
    22reference       channel_list        22 
    33reference       Shepherd/Common.pm  0.36 
    44reference       Shepherd/MythTV.pm  0.7 
    55reference       Shepherd/Configure.pm   0.1 
    6 grabber         yahoo7widget        1.106-r1 
    7 grabber         rex                 3.6.8-r1 
    8 grabber         abc_website         3.21 
    9 grabber         sbsnews_website     1.00 
    10 grabber         oztivo              2.19 
     6grabber         yahoo7widget        1.106-r2 
     7grabber         rex                 3.6.8-r2 
     8grabber         abc_website         3.21-r1 
     9grabber         sbsnews_website     1.00-r1 
     10grabber         oztivo              2.19-r1 
    1111grabber         yahoo7web           0.34-r1 
    1212grabber         foxtel_swf          0.27 
    13 grabber         channelnsw_gov      0.8 
    14 grabber         southerncross_website   0.20 
    15 grabber         ten_website         1.06 
     13grabber         channelnsw_gov      0.8-r1 
     14grabber         southerncross_website   0.20-r1 
     15grabber         ten_website         1.06-r1 
    1616grabber         citysearch          3.0.1 
    1717grabber         acctv_website       0.08 
    18 grabber         sbsweb              1.02 
     18grabber         sbsweb              1.02-r1 
    1919reconciler      reconciler_mk2      0.39 
    2020postprocessor   imdb_augment_data   0.44 
  • trunk/util/gconf-builder

    r812 r1079  
    166166} 
    167167 
    168 print   "\nCATEGORY: Data Quality\n\n" . 
     168print   "\nCATEGORY: Data Accuracy\n\n" . 
    169169        "Rate the accuracy of the data $grabber fetches; i.e. how often it\n" . 
    170170        "can be relied upon to report the right programs in the right timeslots.\n" . 
     
    176176 
    177177$config->{quality} = ask_choice("Data quality?", 3, 1, 2, 3); 
     178 
     179print   "\nCATEGORY: Data Comprehensiveness (sub-titles)\n\n"; 
     180$config->{has_subtitles} = ask_boolean("Does $grabber gather episode names?", 1); 
    178181 
    179182print   "\nCATEGORY: Granularity\n\n" .