Changeset 1754
- Timestamp:
- 10/15/06 17:39:24
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Plugin/Filter/GuessTimeZoneByDomain.pm
r1750 r1754 38 38 my($self, $context, $args) = @_; 39 39 40 return unless $args->{entry}->date && $args->{entry}->date->time_zone->is_floating; 40 return unless $args->{entry}->date && 41 ($args->{entry}->date->time_zone->is_floating || $args->{entry}->date->time_zone->name eq 'UTC'); 41 42 42 43 my $uri = URI->new($args->{entry}->permalink); … … 77 78 =head1 NAME 78 79 79 Plagger::Plugin::Filter::GuessTimeZoneByDomain - Guess timezone by domains if datetime is floating 80 Plagger::Plugin::Filter::GuessTimeZoneByDomain - Guess timezone by domains if datetime is floating or UTC 80 81 81 82 =head1 SYNOPSIS … … 86 87 87 88 This plugin guesses feed date timezone by domains, if dates are 88 floating . It uses the mapping table from ISO 3166 country code to89 floating or UTC. It uses the mapping table from ISO 3166 country code to 89 90 timezones available in Olson database (hence requires 90 91 DateTime::TimeZone 0.51). … … 94 95 of its domain name (ccTLD). 95 96 96 For example, if the datetime is floating in the feed of I<example.jp>, 97 it is resolved to I<Asia/Tokyo> since its ccTLD is I<jp>. In the case 98 of I<www.asahi.com>, ccTLD is null but the IP address is assigned to 99 Japan, hence it is resolved to I<Asia/Tokyo> as well. 97 For example, if the datetime is floating or UTC set in the feed of 98 I<example.jp>, it is resolved to I<Asia/Tokyo> since its ccTLD is 99 I<jp>. In the case of I<www.asahi.com>, ccTLD is null but the IP 100 address is assigned to Japan, hence it is resolved to I<Asia/Tokyo> as 101 well. 100 102 101 103 =head1 CONFIG trunk/plagger/t/plugins/Filter-GuessTimeZoneByDomain/base.t
r1748 r1754 91 91 is $context->update->feeds->[0]->entries->[0]->date->time_zone->name, "America/New_York"; 92 92 93 === Force upgrade GMT 94 --- input config 95 plugins: 96 - module: CustomFeed::Debug 97 config: 98 title: Foo 99 entry: 100 - link: http://bulknews.net/ 101 date: 2006/10/14 12:00:00 GMT 102 - module: Filter::GuessTimeZoneByDomain 103 config: 104 conflict_policy: ip 105 --- expected 106 is $context->update->feeds->[0]->entries->[0]->date->time_zone->name, "Asia/Tokyo"; 107 is $context->update->feeds->[0]->entries->[0]->date->iso8601, "2006-10-14T21:00:00"; 108
