Changeset 959
- Timestamp:
- 10/27/07 10:27:33 (6 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
grabbers/yahoo7widget (modified) (9 diffs)
-
status (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/grabbers/yahoo7widget
r947 r959 22 22 23 23 my $progname = "yahoo7widget"; 24 my $version = "1.9 3";24 my $version = "1.94"; 25 25 26 26 use XMLTV; … … 43 43 my $channels, my $opt_channels; 44 44 my $tv_guide; 45 my $time_offset = 0;46 45 my $input_xml; 47 46 my $d; … … 62 61 'days=i' => \$opt->{days}, 63 62 'offset=i' => \$opt->{offset}, 64 'timezone=s' => \$opt->{timezone},65 63 'channels_file=s' => \$opt->{channels_file}, 66 64 'cachefile=s' => \$opt->{obsolete}, … … 100 98 die "no channel file specified, see --help for instructions\n", unless (defined $opt->{channels_file}); 101 99 100 $ENV{TZ}="Australia/Melbourne"; # yahoo7widget times are always localtime on Eastern States .. 101 102 102 $opt->{days} = 8 if $opt->{days} > 8; # no data beyond 8 days 103 103 … … 107 107 108 108 # normalize starttime to an hour.. 109 my $starttime = time - $time_offset;109 my $starttime = $script_start_time; 110 110 my $endtime = $starttime + ($opt->{days} * 86400); 111 111 $starttime += (86400 * $opt->{offset}) if (defined $opt->{offset}); 112 &calculate_time_offset; 113 114 &log(sprintf "going to grab %d days%s of data into %s (%s%s) region %s, time offset %d", 112 113 &log(sprintf "going to grab %d days%s of data into %s (%s%s) region %s", 115 114 $opt->{days}, 116 115 ($opt->{offset} ? " (skipping first $opt->{offset} days)" : ""), … … 118 117 (defined $opt->{fast} ? "with haste" : "slowly"), 119 118 (defined $opt->{warper} ? ", anonymously" : ""), 120 $opt->{region} , $time_offset);119 $opt->{region}); 121 120 122 121 if (-r $opt->{channels_file}) { … … 201 200 --obfuscate pretend to be a proxy servicing multiple clients 202 201 --lang=[s] set language of xmltv output data (default $opt->{lang}) 203 --timezone=HHMM timezone for channel data (default: system-local timezone)204 202 205 203 --scan-chan=(chanfile) (debugging) check channel discrepancies … … 210 208 211 209 exit(0); 212 }213 214 ######################################################################################################215 # yahoo7widget times are always localtime on Eastern States ..216 # we need to calculate the amount of time to offset the data to the user's local timezone.217 218 sub calculate_time_offset219 {220 my $local_time_offset = POSIX::strftime("%z",localtime(time));221 222 $ENV{TZ}="Australia/Melbourne";223 my $melbourne_time_offset = POSIX::strftime("%z",localtime(time));224 225 $time_offset =226 ((int(substr($melbourne_time_offset,1,2))-int(substr($local_time_offset,1,2)))*(60*60)) +227 ((int(substr($melbourne_time_offset,3,2))-int(substr($local_time_offset,3,2)))*(60));228 229 # set TZ variable back to an appropriate setting230 if ($opt->{region} =~ /^(74|108|81|107|82|83|85|86)$/) {231 $ENV{TZ} = "Australia/Adelaide"; # NT/SA232 } elsif ($opt->{region} =~ /^(101|102)$/) {233 $ENV{TZ} = "Australia/Perth"; # WA234 } elsif ($opt->{region} =~ /^(75|78|79|114)$/) {235 $ENV{TZ} = "Australia/Brisbane"; # QLD236 } elsif ($opt->{region} =~ /^(88)$/) {237 $ENV{TZ} = "Australia/Hobart"; # TAS238 } elsif ($opt->{region} =~ /^(63)$/) {239 $ENV{TZ} = "Australia/Broken_Hill"; # NSW Broken Hill240 } else {241 $ENV{TZ} = "Australia/Melbourne"; # VIC/NSW242 }243 210 } 244 211 … … 531 498 $tv_guide->{$channel}->{data}->{$event_id}->{'channel'} = $opt_channels->{$channel} if (defined $opt_channels->{$channel}); 532 499 533 $tv_guide->{$channel}->{data}->{$event_id}->{'start'} = POSIX::strftime("%Y%m%d%H%M", localtime($event_start +$time_offset));534 $tv_guide->{$channel}->{data}->{$event_id}->{'stop'} = POSIX::strftime("%Y%m%d%H%M", localtime($event_end +$time_offset));500 $tv_guide->{$channel}->{data}->{$event_id}->{'start'} = POSIX::strftime("%Y%m%d%H%M", localtime($event_start)); 501 $tv_guide->{$channel}->{data}->{$event_id}->{'stop'} = POSIX::strftime("%Y%m%d%H%M", localtime($event_end)); 535 502 $tv_guide->{$channel}->{data}->{$event_id}->{'title'} = [[ $e{title}, $opt->{lang} ]] if $e{title}; 536 503 $tv_guide->{$channel}->{data}->{$event_id}->{'sub-title'} = [[ $e{subtitle}, $opt->{lang} ]] if $e{subtitle}; -
trunk/status
r958 r959 3 3 reference Shepherd/Common.pm 0.29 4 4 reference Shepherd/MythTV.pm 0.6 5 grabber yahoo7widget 1.9 35 grabber yahoo7widget 1.94 6 6 grabber rex 3.6.2 7 7 grabber abc_website 3.14-r1
