Changeset 819

Show
Ignore:
Timestamp:
06/29/07 04:56:01 (6 years ago)
Author:
paul
Message:

reconcilor_mk2: remove ': ' spliting, allow 'SkyRacing?' to have programmes upto 12 hours long, redo remove duplicate categories

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • reconcilers/reconciler_mk2

    r808 r819  
    4040# 
    4141# other features: 
    42 #  - will automatically split titles with "title: subtitle" into "title" and 
    43 #    "subtitle" (controlled via $reclogic{min_title_for_colon_title_split}) 
    4442#  - will try to match "same titles" (including fuzzy title matching) for 
    4543#    duplicate programmes within 10 minutes (or whatever 
     
    9593 
    9694my $progname = "reconciler_mk2"; 
    97 my $version = "0.28"; 
     95my $version = "0.29"; 
    9896 
    9997use LWP::UserAgent; 
     
    136134$reclogic{always_add_new_channels} = 0; # don't 
    137135 
    138 # when we have a title with a ": " in the middle but no subtitle, split 
    139 # the title into "title: subtitle" provided title & subtitle are each at least 
    140 # 5 characters long 
    141 $reclogic{min_title_for_colon_title_split} = 5; 
    142  
    143136# don't accept programmes that last for longer than 8 hours. 
    144137$reclogic{max_programme_length} = (8 * 60 * 60); # 8 hours 
     138$reclogic{max_programme_length_sky_racing} = (12 * 60 * 60); # 12 hours 
    145139 
    146140# store a preferred title only if we have at least 1 alternative 
     
    10431037          (strftime "%a%e%b%H%M", localtime($t2)), ($t2 - $t1), $source)) if ($t1 && $t2); 
    10441038 
    1045         if ((($t2 - $t1) > $reclogic{max_programme_length}) && ($prog_title !~ /close/i)) { 
     1039        # limit programme length for any not called 'close' but a longer length of 'SkyRacing' 
     1040        if ((($t2 - $t1) > $reclogic{max_programme_length}) && ($prog_title !~ /\bclose\b/i) && 
     1041            (($in->{channels}->{$prog_chan}->{pref_desc} ne 'SkyRacing') || 
     1042             (($t2 - $t1) > $reclogic{max_programme_length_sky_racing}))) { 
    10461043                &log($reclogic{warn_on_invalid_time_in_prog}, 
    10471044                  (sprintf "WARNING: programme '%s' on channel '%s' from %s had a programme duration (%d) that exceeded max_programme_length (%d): start '%s' stop '%s'; ignored.", 
     
    10571054        $prog->{grabber_num} = ($in->{num_datafiles}-1); 
    10581055        my $prog_key = sprintf "%d:%d",$t1,$t2; 
    1059  
    1060         # if there is a ": " in title and no subtitle, split title into "title: subtitle" 
    1061         # provided each of title/subtitle will be at least $reclogic{min_title_for_colon_title_split} 
    1062         # characters 
    1063         if (!defined $prog_subtitle) { 
    1064                 my ($title1,$title2) = split(/: /,$prog_title,2); 
    1065  
    1066                 if (($title1) && ($title2) && 
    1067                     (length($title1) >= $reclogic{min_title_for_colon_title_split}) && 
    1068                     (length($title2) >= $reclogic{min_title_for_colon_title_split})) { 
    1069                         &log($reclogic{debug_subtitle_derived_from_title}, 
    1070                           (sprintf "split title \"%s\" into title \"%s\" subtitle \"%s\" since over min_title_for_colon_title_split (%d)", 
    1071                           $prog_title, $title1, $title2, $reclogic{min_title_for_colon_title_split})); 
    1072                         $stats{derived_subtitle_from_title}++; 
    1073  
    1074                         $prog_title = $title1; 
    1075                         $prog->{title}->[0]->[0] = $title1; 
    1076  
    1077                         $prog_subtitle = $title2; 
    1078                         $prog->{'sub-title'}->[0]->[0] = $title2; 
    1079                         $prog->{'sub-title'}->[0]->[1] = $prog->{'title'}->[0]->[1]; 
    1080                 } 
    1081  
    1082         }        
    10831056 
    10841057        # check to see if this grabber has supplied a programme with this start/stop on this 
     
    15201493                                        my $lang = $entry->[1]; 
    15211494                                        $lang = "BLANK" if (!$lang); 
    1522                                         $lang_added{$lang} = $val; 
     1495                                        push(@{$lang_added{$lang}}, $val); 
    15231496                                        $num_added++; 
    15241497                                } 
     
    15431516                                        #   'premiere' - don't pass it on but instead set premiere field. 
    15441517                                        #   'en'       - (as in language: en) - just strip 
     1518                                        #   duplicate  - just strip 
    15451519                                        if ($field eq 'category') { 
    15461520                                                if ($val eq "premiere") { 
     
    15511525                                                        &log($reclogic{debug_add_logic}," - stripped 'en' category"); 
    15521526                                                        next; 
     1527                                                } elsif (defined $lang_added{$lang} && grep($_ eq $val, @{$lang_added{$lang}})) { 
     1528                                                        &log($reclogic{debug_add_logic}," - stripped duplicate category"); 
     1529                                                        next; 
    15531530                                                } 
    15541531                                        } 
    15551532 
    1556                                         if (($field eq 'category') || ($field eq 'country')) { 
    1557                                                 # don't add duplicates 
    1558                                                 my $found; 
    1559                                                 foreach my $num (0 .. ($num_added-1)) { 
    1560                                                         if (($newprog->{$field}->[$num]->[0] eq $val) and 
    1561                                                                         ((not $newprog->{$field}->[$num]->[1] and ($lang eq "BLANK")) or 
    1562                                                                          ($newprog->{$field}->[$num]->[1] eq $lang))) { 
    1563                                                                 $found = 1; 
    1564                                                                 last; 
    1565                                                         } 
    1566                                                 } 
    1567                                                 next if ($found); 
    1568                                         } 
    1569  
    15701533                                        if ((!defined $lang_added{$lang}) || ($field eq 'category') || ($field eq 'country')) { 
    1571                                                 $lang_added{$lang} = $val; 
     1534                                                push(@{$lang_added{$lang}}, $val); 
    15721535 
    15731536                                                $newprog->{$field}->[$num_added]->[0] = $val; 
  • status

    r818 r819  
    1414grabber         southerncross_website   0.12 
    1515grabber         ten_website         1.01 
    16 reconciler      reconciler_mk2      0.28 
     16reconciler      reconciler_mk2      0.29 
    1717postprocessor   imdb_augment_data   0.21 
    1818postprocessor   tvdb_augment_data   0.04