Legend:
- Unmodified
- Added
- Removed
-
shepherd
r123 r124 284 284 query_config($grabber, 'option_days_offset') . 285 285 " " . 286 ($timeslice->{start} - 1);286 $timeslice->{start}; 287 287 } 288 288 289 my $n = $timeslice->{stop} ;290 if ($timeslice->{start} != 1289 my $n = $timeslice->{stop} + 1; 290 if ($timeslice->{start} != 0 291 291 and 292 292 !query_config($grabber, 'option_offset_eats_days')) … … 326 326 if ((defined $opt->{dontcallgrabbers}) && ($opt->{dontcallgrabbers})) { 327 327 printf "SHEPHERD: not calling grabber because of --dontcallgrabbers option, but will instead use existing $output\n"; 328 print "SHEPHERD: would have called: $comm\n" if ($debug); 328 329 } else { 329 330 print "SHEPHERD: Excuting command: $comm\n"; … … 553 554 } 554 555 556 # Return 1 if the grabber can provide data for this channel, 557 # else 0. 555 558 sub supports_channel 556 559 { … … 572 575 } 573 576 577 # Returns 0 if the grabber can't provide data for this day, 578 # 1 if it can reliably, and 0.5 if it can unreliably. 579 # 580 # Note that in grabber .confs, a max_days of 7 means the 581 # grabber can retrieve data for today plus 6 days. 574 582 sub supports_day 575 583 { 576 584 my ($grabber, $day) = @_; 577 585 578 return 0 unless ($day < =query_config($grabber, 'max_days'));579 return 0.5 if ($day > query_config($grabber, 'max_reliable_days'));586 return 0 unless ($day < query_config($grabber, 'max_days')); 587 return 0.5 if ($day >= query_config($grabber, 'max_reliable_days')); 580 588 return 1; 581 589 } … … 597 605 foreach my $day (keys %$missing) 598 606 { 599 my $date = substr(DateCalc("today", "+ " . ($day - 1) . "days"), 0, 8);607 my $date = substr(DateCalc("today", "+ $day days"), 0, 8); 600 608 foreach my $ch (@{$missing->{$day}}) 601 609 { … … 642 650 { 643 651 print "Need data for days " . join(", ", sort keys %$missing) . ".\n"; 652 print Dumper($missing); 644 653 } 645 654 return $missing; … … 648 657 # Takes a hash of what's missing in the format: 649 658 # { '1' => [ 'ABC', 'SBS' ], '2' => [ 'ABC' ], ... } 650 # and sets $timeslice to the biggest 'slice' of that.651 # For example,the biggest slice of the above is days 1 -2 of ABC.659 # and returns the largest timeslice of that. For example, 660 # the biggest slice of the above is days 1 -2 of ABC. 652 661 sub calculate_best_timeslice 653 662 { … … 656 665 my ($overlap, $a); 657 666 my $slice = { 'chandays' => 0 }; 658 foreach my $day ( 1 .. $days)667 foreach my $day (0 .. $days-1) 659 668 { 660 669 consider_slice($slice, $day, $day, @{$missing->{$day}}); 661 670 $overlap = $missing->{$day}; 662 foreach my $nextday (($day + 1) .. $days )671 foreach my $nextday (($day + 1) .. $days-1) 663 672 { 664 673 last unless ($missing->{$nextday}); … … 739 748 foreach my $day (keys %$h) 740 749 { 741 my $date = substr(DateCalc("today", "+ " . ($day - 1) . "days"), 0, 8);750 my $date = substr(DateCalc("today", "+ $day days"), 0, 8); 742 751 foreach my $ch (@{$h->{$day}}) 743 752 { … … 1347 1356 } 1348 1357 } 1349 1350 1358 } 1351 1359 … … 1906 1914 set_order(1,$order); 1907 1915 1916 print "\n"; 1908 1917 show_channels(); 1909 1918 unless(ask_boolean("\nCreate configuration file?"))
