Changeset 977
- Timestamp:
- 12/06/07 06:25:12 (5 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
postprocessors/flag_aus_hdtv (modified) (18 diffs)
-
status (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/postprocessors/flag_aus_hdtv
r975 r977 13 13 14 14 my $progname = "flag_aus_hdtv"; 15 my $version = "0.2 5";15 my $version = "0.26"; 16 16 17 17 $| = 1; … … 71 71 my $channels, my $reverse_channels, my $detailed_reverse_channels, my $opt_channels, my %channel_xmlid_to_opt_channel_xmlid; 72 72 my $d, my $ar, my $sd, my $hd; 73 my $gapchannel, my $gaplaststop; 73 74 my $override_settings = { }; 74 75 my %amp = ( nbsp => ' ', qw{ amp & lt < gt > apos ' quot " } ); … … 81 82 $opt->{region} = 94; 82 83 $opt->{debug} = 1; 83 $opt->{action} = "copy ";84 $opt->{action} = "copysd"; 84 85 85 86 &parse_command_line; … … 95 96 &read_config_file($progname.".config",0); 96 97 &apply_setting_overrides; 97 98 # 5/12/2007 set everyones action to "copy", so in a few days can change default to "copysd"99 if (!defined $override_settings->{action}) {100 $override_settings->{action} = "copy";101 &write_config;102 }103 98 104 99 &read_config_file($opt->{channels_file},1); … … 186 181 187 182 --action=(policy) policy can be one of: 188 move - move progto HD channel (remove it from SD channel)189 copy - copy prog to HD channel (keep it in SD channel also) (default)190 copysd - copy all progs to HD channel, flag ing HD ones183 move - move HD progs to HD channel (remove it from SD channel) 184 copy - copy HD progs to HD channel (keep it in SD channel also) 185 copysd - copy all progs to HD channel, flagging HD ones (default) 191 186 --notag don't tag with HD flags (default: do) 192 187 … … 210 205 211 206 die "'--channels_file {file}' must be specified. see --help for details.\n" if (!$opt->{channels_file}); 212 die "unknown --action policy, see --help for details.\n" if ($opt->{action} !~ /^(copysd|copy|move)$/); 207 die "unknown --action policy, see --help for details.\n" 208 if (($opt->{action} ne "move") && ($opt->{action} ne "copy") && ($opt->{action} ne "copysd")) 213 209 } 214 210 … … 228 224 } elsif ($setting eq "action") { 229 225 die "--set value must be copy/move for setting '$setting'.\n" 230 if (($val ne " copysd") && ($val ne "copy") && ($val ne "move"));226 if (($val ne "move") && ($val ne "copy") && ($val ne "copysd")); 231 227 $override_settings->{$setting} = $val; 232 228 printf "%s: override parameter %s: %s\n", $progname, $setting, $val; … … 622 618 my $prog=shift; 623 619 my $this_chan = $prog->{channel}; 624 my $this_title; 625 626 $this_title = $prog->{title}->[0]->[0] 627 if (($prog->{title}) && ($prog->{title}->[0]) && ($prog->{title}->[0]->[0])); 628 # print "got programme ".Dumper($prog); 629 630 goto NOMATCH if (!defined $this_chan); 631 goto NOMATCH if (!defined $this_title); 632 633 # process later high definition channel programmes 634 if (defined $reverse_channels->{$this_chan} && 635 defined $hd_to_sds->{$reverse_channels->{$this_chan}}) { 636 return if $this_title eq "See main channel's listings for programming details"; 637 #print "process later high definition channel programmes - $this_title - $reverse_channels->{$this_chan}\n"; 638 $prog->{video}->{quality} = "HDTV" unless (defined $opt->{notag}); 639 $ar->{$reverse_channels->{$this_chan}}->{Shepherd::Common::parse_xmltv_date($prog->{start})} = $prog; 640 return; 641 } 642 643 # keep a copy of standard definition related to high definition channel programmes for program removal later 620 return if (!defined $this_chan); 621 622 # keep a copy of standard definition related to argumenting high definition channel programmes for program removal later 644 623 if (defined $channel_xmlid_to_opt_channel_xmlid{$this_chan} && 645 624 defined $detailed_reverse_channels->{$channel_xmlid_to_opt_channel_xmlid{$this_chan}}) { … … 647 626 {Shepherd::Common::parse_xmltv_date($prog->{start})} = $prog; 648 627 } 628 629 my $this_title; 630 $this_title = $prog->{title}->[0]->[0] 631 if (($prog->{title}) && ($prog->{title}->[0]) && ($prog->{title}->[0]->[0])); 632 # print "got programme ".Dumper($prog); 633 goto NOMATCH if (!defined $this_title); 649 634 650 635 # if programme is already marked as HDTV, just skip all of this … … 680 665 681 666 NOMATCH: 667 # process later argumenting high definition channel programmes 668 if (defined $reverse_channels->{$this_chan} && 669 defined $hd_to_sds->{$reverse_channels->{$this_chan}}) { 670 return if defined $this_title && $this_title eq "See main channel's listings for programming details"; 671 # just because its on 7HD doesn't make it high definition 672 $ar->{$reverse_channels->{$this_chan}}->{Shepherd::Common::parse_xmltv_date($prog->{start})} = $prog; 673 return; 674 } 675 682 676 $writer->write_programme($prog); 683 677 684 if ($opt->{action} =~ /copysd/ && defined $channel_xmlid_to_opt_channel_xmlid{$this_chan}) {685 delete $prog->{video}->{quality};678 # copy to high definition channel 679 if ($opt->{action} eq "copysd" && defined $channel_xmlid_to_opt_channel_xmlid{$this_chan}) { 686 680 $prog->{channel} = $channel_xmlid_to_opt_channel_xmlid{$this_chan}; 687 681 # but don't write HD channel until all programs read … … 694 688 $d->{seenprog}->{$this_title}++; 695 689 $prog->{video}->{aspect} = "16:9"; # widescreen 690 691 # process later argumenting high definition channel programmes 692 if (defined $reverse_channels->{$this_chan} && 693 defined $hd_to_sds->{$reverse_channels->{$this_chan}}) { 694 return if defined $this_title && $this_title eq "See main channel's listings for programming details"; 695 $prog->{video}->{quality} = "HDTV" unless (defined $opt->{notag}); 696 $ar->{$reverse_channels->{$this_chan}}->{Shepherd::Common::parse_xmltv_date($prog->{start})} = $prog; 697 return; 698 } 696 699 697 700 if (!defined $channel_xmlid_to_opt_channel_xmlid{$this_chan}) { … … 701 704 $stats{rewrote_prog_as_hdtv_inplace}++; 702 705 } else { 703 if ($opt->{action} =~ /copy/) {706 if ($opt->{action} eq "copy" || $opt->{action} eq "copysd") { 704 707 # SD channel 705 708 delete $prog->{video}->{quality}; … … 712 715 $prog->{channel} = $channel_xmlid_to_opt_channel_xmlid{$this_chan}; 713 716 # but don't write HD channel until all programs read 714 #print "but don't write HD channel until all programs read - $this_title - $hd_chan\n";715 717 $hd->{$this_chan}->{Shepherd::Common::parse_xmltv_date($prog->{start})} = $prog; 716 718 } … … 718 720 } 719 721 720 sub write_hd # currently doesn't fill any gaps between programs722 sub write_hd 721 723 { 722 724 # remove from argument channel identical (time, title, sub-title) programs found on sd channel 723 foreach my $hdchannel (keys %$ar) { 724 #print "removal for hdchannel $hdchannel\n"; 725 726 my @aprogs = sort {$a <=> $b} keys %{$ar->{$hdchannel}}; 727 my $aprog = $ar->{$hdchannel}->{shift @aprogs}; 728 729 my @progs = sort {$a <=> $b} keys %{$sd->{$hdchannel}}; 730 my $prog = $sd->{$hdchannel}->{shift @progs}; 731 last if !defined $prog; 732 my $start = Shepherd::Common::parse_xmltv_date($prog->{start}); 733 my $stop = Shepherd::Common::parse_xmltv_date($prog->{stop}); 734 #print "found programs\n"; 735 736 while (defined $aprog) { 737 my $astart = Shepherd::Common::parse_xmltv_date($aprog->{start}); 738 my $astop = Shepherd::Common::parse_xmltv_date($aprog->{stop}); 739 740 # skip any sd programs before this argument programs time 741 while (defined $prog && $start < $astart) { 742 #print "skip prog\n"; 743 $prog = $sd->{$hdchannel}->{shift @progs}; 744 last if !defined $prog; 745 $start = Shepherd::Common::parse_xmltv_date($prog->{start}); 746 $stop = Shepherd::Common::parse_xmltv_date($prog->{stop}); 725 foreach my $channel (keys %$ar) { 726 next if !defined $sd->{$channel}; 727 foreach my $start (keys %{$ar->{$channel}}) { 728 if (defined $sd->{$channel}->{$start}) { 729 my $aprog = $ar->{$channel}->{$start}; 730 my $prog = $sd->{$channel}->{$start}; 731 732 if (Shepherd::Common::parse_xmltv_date($aprog->{stop}) == 733 Shepherd::Common::parse_xmltv_date($prog->{stop}) && 734 (!defined $aprog->{title} || !defined $prog->{title} || 735 $aprog->{title}->[0]->[0] eq $prog->{title}->[0]->[0]) && 736 (!defined $aprog->{'sub-title'} || !defined $prog->{'sub-title'} || 737 $aprog->{'sub-title'}->[0]->[0] eq $prog->{'sub-title'}->[0]->[0])){ 738 delete $ar->{$channel}->{$start}; 739 } 747 740 } 748 last if !defined $prog; 749 750 if ($astart == $start && $astop == $stop && 751 (!defined $aprog->{title} || !defined $prog->{title} || 752 $aprog->{title}->[0]->[0] eq $prog->{title}->[0]->[0]) && 753 (!defined $aprog->{'sub-title'} || !defined $prog->{'sub-title'} || 754 $aprog->{'sub-title'}->[0]->[0] eq $prog->{'sub-title'}->[0]->[0])) { 755 #print "delete aprog\n"; 756 delete $ar->{$hdchannel}->{$astart}; 757 } 758 759 $aprog = $ar->{$hdchannel}->{shift @aprogs}; 760 } 761 } 762 741 } 742 } 743 744 # write high definition channel programs argumenting as needed 763 745 foreach my $xmlid (keys %$hd) { 764 #print "processing channel xmlid $xmlid\n";765 766 746 my ($argument, @aprogs, $aprog); 767 747 … … 784 764 $aprog = $ar->{$argument}->{shift @aprogs}; 785 765 } 786 #print "first argument program at $aprog->{start}\n";787 766 } 788 767 … … 796 775 Shepherd::Common::parse_xmltv_date($prog->{stop})) { 797 776 $aprog->{channel} = $channel_xmlid_to_opt_channel_xmlid{$xmlid}; 777 &gapfill($aprog->{channel}, $aprog->{start}, $aprog->{stop}); 798 778 $writer->write_programme($aprog); 799 779 $stats{wrote_prog_into_hdtv_channel}++; 800 801 #print "wrote argument program $aprog->{title}->[0]->[0]\n";802 780 803 781 # drop programs that conflict with argument program 804 782 while (Shepherd::Common::parse_xmltv_date($prog->{start}) < 805 783 Shepherd::Common::parse_xmltv_date($aprog->{stop})) { 806 #print "dropping conflicting program $prog->{title}->[0]->[0]\n";807 784 $prog = $hd->{$xmlid}->{shift @progs}; 808 785 } … … 811 788 } 812 789 790 &gapfill($prog->{channel}, $prog->{start}, $prog->{stop}); 813 791 $writer->write_programme($prog); 814 792 $stats{wrote_prog_into_hdtv_channel}++; … … 820 798 while (defined $aprog) { 821 799 $aprog->{channel} = $channel_xmlid_to_opt_channel_xmlid{$xmlid}; 800 &gapfill($prog->{channel}, $prog->{start}, $prog->{stop}); 822 801 $writer->write_programme($aprog); 823 802 $stats{wrote_prog_into_hdtv_channel}++; 824 803 825 #print "wrote left over argument program $aprog->{title}->[0]->[0]\n";826 827 804 $aprog = $ar->{$argument}->{shift @aprogs}; 828 805 } 806 } 807 } 808 809 sub gapfill 810 { 811 my $prog; 812 $prog->{channel} = shift; 813 $prog->{start} = $gaplaststop; 814 $prog->{stop} = shift; 815 $gaplaststop = shift; 816 817 if (defined $prog->{start} && defined $gapchannel && $gapchannel eq $prog->{channel}) { 818 if (Shepherd::Common::parse_xmltv_date($prog->{start}) != 819 Shepherd::Common::parse_xmltv_date($prog->{stop})) { 820 if ($opt->{action} eq "copysd") { 821 $prog->{title}->[0]->[0] = "Gap"; 822 } else { 823 $prog->{title}->[0]->[0] = "Upscaled SD or Loop"; 824 $prog->{desc}->[0]->[0] = 825 "This can be populated with programs by changing your Shepherd settings."; 826 } 827 $writer->write_programme($prog); 828 $stats{wrote_gapfill_into_hdtv_channel}++; 829 } 830 } else { 831 $gapchannel = $prog->{channel}; 829 832 } 830 833 } -
trunk/status
r976 r977 19 19 postprocessor imdb_augment_data 0.35 20 20 postprocessor tvdb_augment_data 0.11 21 postprocessor flag_aus_hdtv 0.2 521 postprocessor flag_aus_hdtv 0.26 22 22 postprocessor augment_timezone 0.17
