Changeset 974

Show
Ignore:
Timestamp:
12/04/07 05:23:12 (6 years ago)
Author:
paul
Message:

7HD: remove sd from 7HD

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/postprocessors/flag_aus_hdtv

    r973 r974  
    1313 
    1414my $progname = "flag_aus_hdtv"; 
    15 my $version = "0.23"; 
     15my $version = "0.24"; 
    1616 
    1717$| = 1; 
     
    7070my %stats; 
    7171my $channels, my $reverse_channels, my $detailed_reverse_channels, my $opt_channels, my %channel_xmlid_to_opt_channel_xmlid; 
    72 my $d, my $o, my $hd; 
     72my $d, my $ar, my $sd, my $hd; 
    7373my $override_settings = { }; 
    7474my %amp = ( nbsp => ' ', qw{ amp & lt < gt > apos ' quot " } ); 
     
    286286 
    287287        foreach my $hdchannel (keys %$hd_to_sds) { 
    288                 if (exists $channels->{$hdchannel}) { 
     288                if (defined $channels->{$hdchannel}) { 
    289289                        foreach my $sdchannel (@{$hd_to_sds->{$hdchannel}}) { 
    290                                 if (exists $channels->{$sdchannel}) { 
     290                                if (defined $channels->{$sdchannel}) { 
    291291                                        # there can be only one SD channel for the 7HD channel 
    292292                                        $channel_xmlid_to_opt_channel_xmlid{$channels->{$sdchannel}} = 
    293                                                          $channels->{$hdchannel}; 
     293                                                        $channels->{$hdchannel}; 
    294294                                        print "  '$hdchannel' with xmlid '$channels->{$hdchannel}'" . 
    295295                                                        " populated with programs provided by " . 
     
    354354 
    355355            if (defined $opt_channels->{$oldname."HD"}) { 
    356                 if (exists $channel_xmlid_to_opt_channel_xmlid{$chanid}) { 
     356                if (defined $channel_xmlid_to_opt_channel_xmlid{$chanid}) { 
    357357                    print " - Skipping '${oldname}HD' treated as '${name}HD' with xmlid '" . 
    358358                            $opt_channels->{$oldname."HD"} . "' " . 
     
    629629#print "process later high definition channel programmes - $this_title - $reverse_channels->{$this_chan}\n"; 
    630630                $prog->{video}->{quality} = "HDTV" unless (defined $opt->{notag}); 
    631                 $o->{$reverse_channels->{$this_chan}}->{Shepherd::Common::parse_xmltv_date($prog->{start})} = $prog; 
     631                $ar->{$reverse_channels->{$this_chan}}->{Shepherd::Common::parse_xmltv_date($prog->{start})} = $prog; 
    632632                return; 
     633        } 
     634 
     635        # keep a copy of standard definition related to high definition channel programmes for program removal later 
     636        if (defined $channel_xmlid_to_opt_channel_xmlid{$this_chan} && 
     637                        defined $detailed_reverse_channels->{$channel_xmlid_to_opt_channel_xmlid{$this_chan}}) { 
     638                $sd->{$detailed_reverse_channels->{$channel_xmlid_to_opt_channel_xmlid{$this_chan}}}-> 
     639                                {Shepherd::Common::parse_xmltv_date($prog->{start})} = $prog; 
    633640        } 
    634641 
     
    697704sub write_hd    # currently doesn't fill any gaps between programs 
    698705{ 
     706        # remove from argument channel identical (time, title, sub-title) programs found on sd channel 
     707        foreach my $hdchannel (keys %$ar) { 
     708#print "removal for hdchannel $hdchannel\n"; 
     709 
     710                my @aprogs = sort {$a <=> $b} keys %{$ar->{$hdchannel}}; 
     711                my $aprog = $ar->{$hdchannel}->{shift @aprogs}; 
     712 
     713                my @progs = sort {$a <=> $b} keys %{$sd->{$hdchannel}}; 
     714                my $prog = $sd->{$hdchannel}->{shift @progs}; 
     715                last if !defined $prog; 
     716                my $start = Shepherd::Common::parse_xmltv_date($prog->{start}); 
     717                my $stop = Shepherd::Common::parse_xmltv_date($prog->{stop}); 
     718#print "found programs\n"; 
     719 
     720                while (defined $aprog) { 
     721                        my $astart = Shepherd::Common::parse_xmltv_date($aprog->{start}); 
     722                        my $astop = Shepherd::Common::parse_xmltv_date($aprog->{stop}); 
     723 
     724                        # skip any sd programs before this argument programs time 
     725                        while (defined $prog && $start < $astart) { 
     726#print "skip prog\n"; 
     727                                $prog = $sd->{$hdchannel}->{shift @progs}; 
     728                                last if !defined $prog; 
     729                                $start = Shepherd::Common::parse_xmltv_date($prog->{start}); 
     730                                $stop = Shepherd::Common::parse_xmltv_date($prog->{stop}); 
     731                        } 
     732                        last if !defined $prog; 
     733 
     734                        if ($astart == $start && $astop == $stop && 
     735                                        (!defined $aprog->{title} || !defined $prog->{title} || 
     736                                                $aprog->{title}->[0]->[0] eq $prog->{title}->[0]->[0]) && 
     737                                        (!defined $aprog->{'sub-title'} || !defined $prog->{'sub-title'} || 
     738                                                $aprog->{'sub-title'}->[0]->[0] eq $prog->{'sub-title'}->[0]->[0])) { 
     739#print "delete aprog\n"; 
     740                                delete $ar->{$hdchannel}->{$astart}; 
     741                        } 
     742 
     743                        $aprog = $ar->{$hdchannel}->{shift @aprogs}; 
     744                } 
     745        } 
     746 
    699747        foreach my $xmlid (keys %$hd) { 
    700748#print "processing channel xmlid $xmlid\n"; 
    701749 
    702                 my ($argument, @arguments, $aprog); 
     750                my ($argument, @aprogs, $aprog); 
    703751 
    704752                # if an argument channel exists, sort the programs ready for inserting 
     
    708756 
    709757                        print "  channel '"; 
    710                         if (exists $detailed_reverse_channels->{$channel_xmlid_to_opt_channel_xmlid{$xmlid}}) { 
     758                        if (defined $detailed_reverse_channels->{$channel_xmlid_to_opt_channel_xmlid{$xmlid}}) { 
    711759                                print $detailed_reverse_channels->{$channel_xmlid_to_opt_channel_xmlid{$xmlid}}; 
    712760                        } else { 
     
    716764                                        " augmented with programs from channel '$argument'\n"; 
    717765 
    718                         if (defined $o->{$argument}) { 
    719                                 @arguments = sort {$a <=> $b} keys %{$o->{$argument}}; 
    720                                 $aprog = $o->{$argument}->{shift @arguments}; 
     766                        if (defined $ar->{$argument}) { 
     767                                @aprogs = sort {$a <=> $b} keys %{$ar->{$argument}}; 
     768                                $aprog = $ar->{$argument}->{shift @aprogs}; 
    721769                        } 
    722770#print "first argument program at $aprog->{start}\n"; 
     
    744792                                } 
    745793 
    746                                 $aprog = $o->{$argument}->{shift @arguments}; 
     794                                $aprog = $ar->{$argument}->{shift @aprogs}; 
    747795                        } 
    748796 
     
    761809#print "wrote left over argument program $aprog->{title}->[0]->[0]\n"; 
    762810 
    763                         $aprog = $o->{$argument}->{shift @arguments}; 
     811                        $aprog = $ar->{$argument}->{shift @aprogs}; 
    764812                } 
    765813        } 
  • trunk/status

    r973 r974  
    1919postprocessor   imdb_augment_data   0.35 
    2020postprocessor   tvdb_augment_data   0.11 
    21 postprocessor   flag_aus_hdtv       0.23 
     21postprocessor   flag_aus_hdtv       0.24 
    2222postprocessor   augment_timezone    0.17