Changeset 877

Show
Ignore:
Timestamp:
07/23/07 22:04:08 (6 years ago)
Author:
max
Message:

shepherd: flag as FAIL when grabbers return unparseable XMLTV. (Suspect machine-specific issue with xmltv_parse_date, but not sure yet.) Also add --skippost option and don't count --dontcallgrabbers runs in history.

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • applications/shepherd

    r858 r877  
    22 
    33my $progname = 'shepherd'; 
    4 my $version = '1.2.0'; 
     4my $version = '1.2.1'; 
    55 
    66# tv_grab_au 
     
    227227    if ($any_data) 
    228228    { 
    229         &postprocess_data; 
     229        &postprocess_data unless ($opt->{skippost}); 
    230230        &output_data; 
    231231        &finalize_stats; 
     
    750750    delete $pending_messages->{$progname}->{FAIL}; 
    751751    &add_pending_message($progname, "SUCCESS", $sysid, $starttime, (time-$starttime), $region, $components_used); 
    752     $last_successful_run = time; 
    753     my $total_wanted = $plugin_data->{$progname}->{total_duration} + $plugin_data->{$progname}->{total_missing}; 
    754     $last_successful_run_data = ($total_wanted ? 100* $plugin_data->{$progname}->{total_duration} / $total_wanted : 0); 
    755  
    756     $last_successful_runs->{$last_successful_run} = $last_successful_run_data; 
     752    unless ($opt->{dontcallgrabbers}) 
     753    { 
     754        $last_successful_run = time; 
     755        my $total_wanted = $plugin_data->{$progname}->{total_duration} + $plugin_data->{$progname}->{total_missing}; 
     756        $last_successful_run_data = ($total_wanted ? 100* $plugin_data->{$progname}->{total_duration} / $total_wanted : 0); 
     757 
     758        $last_successful_runs->{$last_successful_run} = $last_successful_run_data; 
     759    } 
    757760} 
    758761 
     
    774777    { 
    775778        &log("Not posting usage statistics due to --" . ($opt->{nonotify} ? 'nonotify' : 'dontcallgrabbers' ) . " option.\n"); 
     779        &log("Would have posted: ".Dumper($pending_messages)) if ($debug); 
    776780    } 
    777781    else 
     
    15511555                        noupdate 
    15521556                        skipupdate 
     1557                        skippost 
    15531558                        disable=s 
    15541559                        enable=s 
     
    27942799        my $msg; 
    27952800        my $component_start = time; 
    2796         if ((defined $opt->{dontcallgrabbers}) && ($opt->{dontcallgrabbers})) { 
     2801        if ($grabber eq 'yahoo7widget' or (defined $opt->{dontcallgrabbers}) && ($opt->{dontcallgrabbers})) { 
    27972802            &log("SHEPHERD: not calling grabber because of --dontcallgrabbers option, but will instead use existing $output\n"); 
    27982803            &log(1, "SHEPHERD: would have called: $comm\n"); 
     
    36463651    my $xmltv = $this_plugin->{xmltv}; 
    36473652    my ($encoding, $credits, $chan, $progs) = @$xmltv; 
    3648     $this_plugin->{total_duration} = 0; 
    3649     $this_plugin->{programmes} = 0; 
    3650     $this_plugin->{progs_with_invalid_date} = 0;        # explicitly track unparsable dates 
    3651     $this_plugin->{progs_too_long} = 0;                 # explicitly track exxcessive programme durations 
    3652     $this_plugin->{progs_with_unknown_channel} = 0;     # explicitly track unknown channels 
     3653 
     3654    # explicitly track unparsable dates, excessive durations, etc 
     3655    foreach ( qw( programmes total_duration progs_with_invalid_date progs_too_long progs_too_short progs_with_unknown channel progs_outside_window)) 
     3656    { 
     3657        $this_plugin->{$_} = 0; 
     3658    } 
    36533659 
    36543660    my $seen_channels_with_data = 0; 
     
    37063712            if ($this_duration < 1) { 
    37073713                &log(sprintf "- WARNING: plugin '%s' returned programme data with invalid duration (%s to %s): ignored.\n", $pluginname, $prog->{start}, $prog->{stop}); 
     3714                $this_plugin->{progs_too_short}++; 
    37083715                next; 
    37093716            } 
     
    37253732 
    37263733                # programme is outside the timeslots we are interested in. 
    3727                 next if ($t1 > $policy{endtime}); 
    3728                 next if ($t2 < $policy{starttime}); 
     3734                if ($t1 > $policy{endtime} or $t2 < $policy{starttime}) 
     3735                { 
     3736                    $this_plugin->{progs_outside_window}++; 
     3737                    next; 
     3738                } 
    37293739 
    37303740                # store timeslot info 
     
    37473757                    $channel_data->{$ch}->{timeslots}[$slotnum]++; 
    37483758                    $this_plugin->{timeslots}->{$ch}[$slotnum]++; 
     3759                    $this_plugin->{slots_filled}++; 
    37493760                } 
    37503761            } 
     
    37693780        (defined $this_plugin->{earliest_data_seen} ? POSIX::strftime("%a%d%b", localtime($this_plugin->{earliest_data_seen})) : 'no'), 
    37703781        (defined $this_plugin->{latest_data_seen} ? POSIX::strftime("%a%d%b", localtime($this_plugin->{latest_data_seen})) : 'data'); 
     3782 
     3783    if (!$this_plugin->{slots_filled}) 
     3784    { 
     3785        # Call this a failure if there was some kind of weirdness. If 
     3786        # the grabber genuinely couldn't retrieve any shows for the  
     3787        # requested period, that's MISSING_DATA, but if it did and 
     3788        # we couldn't understand them, that's a FAIL. 
     3789 
     3790        if ($this_plugin->{progs_with_invalid_date} 
     3791                or 
     3792            $this_plugin->{progs_too_long} 
     3793                or 
     3794            $this_plugin->{progs_too_short} 
     3795                or 
     3796            $this_plugin->{progs_outside_window} 
     3797                or 
     3798            $this_plugin->{progs_with_unknown_channel}) 
     3799        { 
     3800            $this_plugin->{valid} = 0; 
     3801            $this_plugin->{failure_reason} =  
     3802                sprintf "Unparseable: %d ch, %d shows, %d dur, %d slots, %d invalid_date, %d too_long, %d too_short, %d outside_window, %d unknown_channel", 
     3803                    $seen_channels_with_data,  
     3804                    $this_plugin->{programmes}, 
     3805                    $this_plugin->{total_duration}, 
     3806                    $this_plugin->{slots_filled}, 
     3807                    $this_plugin->{progs_with_invalid_date}, 
     3808                    $this_plugin->{progs_too_long}, 
     3809                    $this_plugin->{progs_too_short}, 
     3810                    $this_plugin->{progs_outside_window}, 
     3811                    $this_plugin->{progs_with_unknown_channel}; 
     3812        } 
     3813    } 
    37713814 
    37723815    $plugin_data->{$plugin} = $this_plugin; 
  • status

    r876 r877  
    1 application     shepherd            1.2.0 
     1application     shepherd            1.2.1 
    22reference       channel_list        4 
    33reference       Shepherd/Common.pm  0.23