Changeset 679

Show
Ignore:
Timestamp:
05/23/07 18:26:09 (6 years ago)
Author:
lincoln
Message:

refine the way we process ABC/ABC2 station close: with some ABC programming, ABC no longer indicate station close on some days, they're broadcasting 24 hours.

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • grabbers/abc_website

    r674 r679  
    2222 
    2323my $progname = "abc_website"; 
    24 my $version = "3.01"; 
     24my $version = "3.02"; 
    2525 
    2626use LWP::UserAgent; 
     
    292292        my $unprocessed_programmes = 0; 
    293293        my $stop_fetching = 0; 
    294         my @unprocessed_progname, my @unprocessed_starttime, my @unprocessed_url; 
     294        my @unprocessed_progname, my @unprocessed_starttime, my @unprocessed_url, my @unprocessed_day; 
    295295 
    296296        my $to_skip = $opt_offset; 
     
    391391                                                                        $unprocessed_progname[$unprocessed_programmes] = $programme; 
    392392                                                                        $unprocessed_starttime[$unprocessed_programmes] = $found_time; 
     393                                                                        $unprocessed_day[$unprocessed_programmes] = $daynum; 
    393394                                                                        $unprocessed_url[$unprocessed_programmes] = "http://www.abc.net.au".$progurl; 
    394395                                                                        $unprocessed_programmes++; 
     
    414415                                $unprocessed_progname[$unprocessed_programmes] = "Station Close"; 
    415416                                $unprocessed_starttime[$unprocessed_programmes] = $station_close_data->{$xmlid}->[$daynum]; 
     417                                $unprocessed_day[$unprocessed_programmes] = $daynum; 
    416418                                $unprocessed_url[$unprocessed_programmes] = ""; 
    417419                                $unprocessed_programmes++; 
    418                         } else { 
    419                                 # throw away last programme from each day - we can't use it as 
    420                                 # we don't have a 'stop' time for it 
    421  
    422                                 printf "throwing away '%s' (%s) because we won't have a valid stop time\n", 
    423                                         $unprocessed_progname[$unprocessed_programmes-1], 
    424                                         POSIX::strftime("%Y%m%d%H%M", localtime($unprocessed_starttime[$unprocessed_programmes-1])) 
    425                                         if $debug; 
    426                                 $unprocessed_progname[$unprocessed_programmes-1] = ""; 
    427420                        } 
    428421                } else { 
     
    440433 
    441434        for (my $i = 0; $i < ($unprocessed_programmes-1); $i++) { 
    442                 next if ($unprocessed_progname[$i] eq ""); 
     435                # if we've found a programme which is between days, evaluate whether we can 
     436                # use it or need to drop it (because we won't necessarily have a 'stop' time 
     437                if (($unprocessed_day[$i] != $unprocessed_day[($i+1)]) && 
     438                    ($unprocessed_progname[$i] ne "Station Close")) { 
     439                        # we'd normally throw away last programme from each day - we can't use it 
     440                        # as we don't have a 'stop' time for it. 
     441                        # with some ABC programming, ABC no longer indicate any station close 
     442                        # on some days - they're broadcasting 24 hours. 
     443                        # only throw away the last programme if: 
     444                        #   1. it is seen to run longer than 3.5 hours 
     445                        #   2. it is a different title 
     446                        if ((($unprocessed_starttime[$i+1] - $unprocessed_starttime[$i]) > (3.5*3600)) && 
     447                            ($unprocessed_progname[$i] ne $unprocessed_progname[$i+1])) { 
     448                                printf "throwing away '%s' (%s) because we won't have a valid stop time (%s) and title is different (%s)\n", 
     449                                        $unprocessed_progname[$i], 
     450                                        POSIX::strftime("%Y%m%d%H%M", localtime($unprocessed_starttime[$i])), 
     451                                        POSIX::strftime("%Y%m%d%H%M", localtime($unprocessed_starttime[$i+1])), 
     452                                        $unprocessed_progname[$i+1] 
     453                                        if $debug; 
     454                                next; 
     455                        } 
     456                } 
    443457 
    444458                # if we are micro-gap fetching, only include programmes which match our micro gaps 
  • status

    r678 r679  
    22grabber         yahoo7widget        1.83-r1 
    33grabber         rex                 3.4.10 
    4 grabber         abc_website         3.01-r1 
     4grabber         abc_website         3.02 
    55grabber         sbsnews_website     0.14 
    66grabber         oztivo              0.29