Changeset 943
- Timestamp:
- 10/09/07 22:10:39 (6 years ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
grabbers/rex (modified) (13 diffs)
-
grabbers/southerncross_website (modified) (3 diffs)
-
references/Shepherd/Common.pm (modified) (2 diffs)
-
status (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/grabbers/rex
r942 r943 3 3 # "Rex" 4 4 5 my $version = '3. 5.10';5 my $version = '3.6.0'; 6 6 7 7 # An Australian TV Guide Grabber (a.k.a. tv_grab_au) … … 92 92 # 3.5.9 : Code change: use Shepherd::Common::read/write cache 93 93 # 3.5.10 : Bugfix : don't exit on unknown option 94 # 3.6.0 : Code change: use Shepherd::Common::print_stats 95 # Feature: cache guide pages for 3 hours, add subratings, 96 # Feature: capture director, writer, country, language 97 # Bugfix : fix previously-shown, aspect, subtitles, premiere, quality 94 98 95 99 use strict; … … 212 216 print stats(1); 213 217 218 Shepherd::Common::print_stats($progname, $version, $runtime, %stats); 219 214 220 exit 0; 215 221 … … 242 248 # Special bandwidth-saving URL for day 0 243 249 244 $guidedata = get_page($DATASOURCE_GUIDE_TODAY); 250 my $cacheid = $DATASOURCE_GUIDE_TODAY; 251 if ($cached->{$cacheid}) { 252 $guidedata = $cached->{$cacheid}->{data}; 253 } else { 254 $guidedata = get_page($DATASOURCE_GUIDE_TODAY); 255 if ($guidedata) { 256 $cached->{$cacheid}->{data} = $guidedata; 257 $cached->{$cacheid}->{stop} = POSIX::strftime("%Y%m%d%H%M%S", localtime($runtime)); 258 $cached->{$cacheid}->{title}[0][0] = $cacheid; 259 } 260 } 245 261 parse_guide($guidedata, $date) if ($guidedata); 246 262 } … … 251 267 for (1 .. 4) 252 268 { 253 $guidedata = get_page(url => $DATASOURCE_GUIDE, 254 postvars => 255 [ 'action' => "sessionTimes", 256 'region_id' => $rid, 257 'date' => $date, 258 'period' => $_, 259 'submit' => 'submit' 260 ]); 261 parse_guide($guidedata, $date, $_) if ($guidedata); 269 my $cacheid = "${DATASOURCE_GUIDE}?r=${rid}&d=${date}&p=$_"; 270 if ($cached->{$cacheid}) { 271 $guidedata = $cached->{$cacheid}->{data}; 272 } else { 273 $guidedata = get_page(url => $DATASOURCE_GUIDE, 274 postvars => 275 [ 'action' => "sessionTimes", 276 'region_id' => $rid, 277 'date' => $date, 278 'period' => $_, 279 'submit' => 'submit' 280 ]); 281 if ($guidedata) { 282 $cached->{$cacheid}->{data} = $guidedata; 283 $cached->{$cacheid}->{stop} = POSIX::strftime("%Y%m%d%H%M%S", localtime($runtime)); 284 $cached->{$cacheid}->{title}[0][0] = $cacheid; 285 } 286 } 287 parse_guide($guidedata, $date, $_) if ($guidedata); 262 288 } 263 289 } … … 513 539 sub clean_cache 514 540 { 515 my $r = expand_date(localtime(time() - 3 600)."");541 my $r = expand_date(localtime(time() - 3*3600).""); 516 542 my $c = 0; 517 543 print "Removing cache items that finish earlier than $r.\n" if ($debug); … … 818 844 if ($str and $str->as_text() =~ /movie/i) 819 845 { 820 unshift(@extra, 'movie');846 push (@extra, 'movie'); 821 847 } 822 848 … … 837 863 $_ = [ $_, 'advisory', undef ]; 838 864 } 839 $show->{'rating'} = [[ $1, 'ABA', undef], @extra ]; 865 my $sr = &Shepherd::Common::subrating($2); 866 $show->{'rating'} = [[ $sr ? "$1 $sr" : $1, 'ABA', undef], @extra ]; 840 867 } 841 868 else … … 848 875 $show->{'credits'}{'actor'} = [ split(/, /, strip_whitespace($1)) ]; 849 876 } 877 elsif ($str =~ /Director: (.+)/) 878 { 879 $show->{'credits'}{'director'} = [ split(/, /, strip_whitespace($1)) ]; 880 } 881 elsif ($str =~ /Writer: (.+)/) 882 { 883 $show->{'credits'}{'writer'} = [ split(/, /, strip_whitespace($1)) ]; 884 } 850 885 elsif ($str =~ /Year:\s*(\d+)/) 851 886 { 852 887 $show->{'date'} = strip_whitespace($1); 888 } 889 elsif ($str =~ /Country: (.+)/) 890 { 891 $show->{'country'} = [[ split(/, /, strip_whitespace($1)) ]]; 892 } 893 elsif ($str =~ /Language: (.+)/) 894 { 895 $show->{'language'} = [ strip_whitespace($1) ]; 853 896 } 854 897 elsif ($str =~ /Other:(.+)/) … … 856 899 next unless (strip_whitespace($1)); 857 900 $str = $tag->as_HTML(); 858 @extra = split(/<br \/>/, $tag->as_HTML());901 @extra = split(/<br ?\/?>/, $tag->as_HTML()); 859 902 my (@to_add, %video); 860 903 foreach my $bit (@extra) … … 866 909 { 867 910 $show->{'previously-shown'} = { }; 868 next; # Don't need this in the desc as well as it's869 # highlighted by MythTV870 911 } 871 912 elsif ($bit eq 'Widescreen') … … 876 917 { 877 918 $show->{'subtitles'} = [ { 'type' => 'teletext' } ]; 878 next; # Just clutters up the desc879 919 } 880 elsif ($bit eq 'Premiere' )920 elsif ($bit eq 'Premiere' || $bit eq 'New Episode') 881 921 { 882 922 $show->{'premiere'} = [ $bit ]; … … 888 928 push (@to_add, $bit); 889 929 $show->{'video'} = \%video if (%video); 890 }891 foreach (@to_add)892 {893 if ($show->{'desc'})894 {895 $show->{'desc'}[0][0] .= " $_.";896 }897 else898 {899 $show->{'desc'} = [[ "$_.", $lang ]];900 }901 930 } 902 931 } -
trunk/grabbers/southerncross_website
r832 r943 34 34 35 35 my $progname = "southerncross_website"; 36 my $version = "0.1 4";36 my $version = "0.15"; 37 37 38 38 #use LWP::UserAgent; … … 682 682 $post_desc .= $text; 683 683 if ($rating) { 684 $rating .= " " . subrating($text);684 $rating .= " " . &Shepherd::Common::subrating($text); 685 685 } else { 686 $rating = subrating($text);686 $rating = &Shepherd::Common::subrating($text); 687 687 } 688 688 &log("parse_page debug: verbose rating : $text") if $opt->{debug}; … … 761 761 return @categories; 762 762 } 763 764 # (Adult Themes)765 # (Some Violence, Adult Themes, Supernatural Themes)766 # (Drug References, Adult Themes)767 # (Very Coarse Language, Sexual References, Drug References, Adult Themes, Nudity)768 # (Some Violence)769 # (Drug Use, Strong Adult Themes)770 # (Some Violence, Adult Themes)771 # (Some Coarse Language)772 # (Sexual References)773 # (Mild Coarse Language, Sexual References)774 # (Sex Scenes, Adult Themes, Supernatural Themes)775 ## (Qualifying - Sat)776 sub subrating777 {778 my $string = shift;779 my @subrating;780 781 push(@subrating, "v") if $string =~ /Violence/i;782 push(@subrating, "l") if $string =~ /Language/i;783 push(@subrating, "s") if $string =~ /Sex/i;784 push(@subrating, "d") if $string =~ /Drug/i;785 push(@subrating, "a") if $string =~ /Adult/i;786 push(@subrating, "n") if $string =~ /Nudity/i;787 push(@subrating, "h") if $string =~ /Supernatural/i;788 789 return join(",",@subrating);790 } -
trunk/references/Shepherd/Common.pm
r936 r943 3 3 # Shepherd::Common library 4 4 5 my $version = '0.2 7';5 my $version = '0.28'; 6 6 7 7 # … … 770 770 ########################################################################## 771 771 772 # (Adult Themes) 773 # (Some Violence, Adult Themes, Supernatural Themes) 774 # (Drug References, Adult Themes) 775 # (Very Coarse Language, Sexual References, Drug References, Adult Themes, Nudity) 776 # (Some Violence) 777 # (Drug Use, Strong Adult Themes) 778 # (Some Violence, Adult Themes) 779 # (Some Coarse Language) 780 # (Sexual References) 781 # (Mild Coarse Language, Sexual References) 782 # (Sex Scenes, Adult Themes, Supernatural Themes) 783 ## (Qualifying - Sat) 784 sub subrating 785 { 786 my $string = shift; 787 my @subrating; 788 789 push(@subrating, "v") if $string =~ /Violence/i; 790 push(@subrating, "l") if $string =~ /Language/i; 791 push(@subrating, "s") if $string =~ /Sex/i; 792 push(@subrating, "d") if $string =~ /Drug/i; 793 push(@subrating, "a") if $string =~ /Adult/i; 794 push(@subrating, "n") if $string =~ /Nudity/i; 795 push(@subrating, "h") if $string =~ /Horror|Supernatural/i; 796 797 return join(",",@subrating); 798 } 799 800 ########################################################################## 801 772 802 sub log 773 803 { -
trunk/status
r942 r943 1 1 application shepherd 1.2.24 2 2 reference channel_list 6 3 reference Shepherd/Common.pm 0.2 73 reference Shepherd/Common.pm 0.28 4 4 reference Shepherd/MythTV.pm 0.6 5 5 grabber yahoo7widget 1.92 6 grabber rex 3. 5.106 grabber rex 3.6.0 7 7 grabber abc_website 3.14 8 8 grabber sbsnews_website 0.18 … … 12 12 grabber foxtel_swf 0.24 13 13 grabber channelnsw_gov 0.8 14 grabber southerncross_website 0.1 414 grabber southerncross_website 0.15 15 15 grabber ten_website 1.04 16 16 grabber selectv_website 0.02
