Changeset 1769
- Timestamp:
- 10/16/06 17:01:16
- Files:
-
- trunk/plagger/deps/Bundle-Defaults.yaml (added)
- trunk/plagger/deps/Namespace-ApplePhotocast.yaml (added)
- trunk/plagger/deps/Namespace-HatenaFotolife.yaml (added)
- trunk/plagger/deps/Namespace-MediaRSS.yaml (added)
- trunk/plagger/lib/Plagger.pm (modified) (1 diff)
- trunk/plagger/lib/Plagger/Plugin/Aggregator/Simple.pm (modified) (2 diffs)
- trunk/plagger/lib/Plagger/Plugin/Bundle/Defaults.pm (added)
- trunk/plagger/lib/Plagger/Plugin/Namespace (added)
- trunk/plagger/lib/Plagger/Plugin/Namespace/ApplePhotocast.pm (added)
- trunk/plagger/lib/Plagger/Plugin/Namespace/HatenaFotolife.pm (added)
- trunk/plagger/lib/Plagger/Plugin/Namespace/MediaRSS.pm (added)
- trunk/plagger/t/plugins/Bundle-Defaults (added)
- trunk/plagger/t/plugins/Bundle-Defaults/base.t (added)
- trunk/plagger/t/plugins/Namespace-ApplePhotocast (added)
- trunk/plagger/t/plugins/Namespace-ApplePhotocast/base.t (moved) (moved from trunk/plagger/t/core/photocast.t)
- trunk/plagger/t/plugins/Namespace-HatenaFotolife (added)
- trunk/plagger/t/plugins/Namespace-HatenaFotolife/base.t (moved) (moved from trunk/plagger/t/core/hatenafotolife.t)
- trunk/plagger/t/plugins/Namespace-MediaRSS (added)
- trunk/plagger/t/plugins/Namespace-MediaRSS/base.t (moved) (moved from trunk/plagger/t/core/mrss.t)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger.pm
r1741 r1769 286 286 my $self = shift; 287 287 288 $self->autoload_plugin({ module => 'Bundle::Defaults' }); 289 288 290 $self->run_hook('plugin.init'); 289 291 $self->run_hook('subscription.load'); 290 291 unless ( $self->is_loaded(qr/^Aggregator::/) ) {292 $self->load_plugin({ module => 'Aggregator::Simple' });293 }294 $self->autoload_plugin({ module => 'Summary::Auto' });295 $self->autoload_plugin({ module => 'Summary::Simple' });296 292 297 293 for my $feed ($self->subscription->feeds) { trunk/plagger/lib/Plagger/Plugin/Aggregator/Simple.pm
r1741 r1769 174 174 } 175 175 176 # TODO: move MediaRSS, Hatena, iTunes and those specific parser to be subclassed177 $self->handle_media_rss($entry, $e);178 $self->handle_hatena_image($entry, $e);179 $self->handle_apple_photocast($entry, $e);180 181 176 my $args = { 182 177 entry => $entry, … … 192 187 $context->log(info => "Aggregate $url success: " . $feed->count . " entries."); 193 188 $context->update->add($feed); 194 }195 196 sub handle_media_rss {197 my($self, $entry, $e) = @_;198 199 my $media_ns = "http://search.yahoo.com/mrss";200 my $media = $e->{entry}->{$media_ns}->{group} || $e->{entry};201 my $content = $media->{$media_ns}->{content} || [];202 $content = [ $content ] unless ref $content && ref $content eq 'ARRAY';203 204 for my $media_content (@{$content}) {205 my $enclosure = Plagger::Enclosure->new;206 $enclosure->url( URI->new($media_content->{url}) );207 $enclosure->auto_set_type($media_content->{type});208 $entry->add_enclosure($enclosure);209 }210 211 if (my $thumbnail = $media->{$media_ns}->{thumbnail}) {212 $entry->icon({213 url => $thumbnail->{url},214 width => $thumbnail->{width},215 height => $thumbnail->{height},216 });217 }218 }219 220 sub handle_hatena_image {221 my($self, $entry, $e) = @_;222 223 # Hatena Image extensions224 my $hatena = $e->{entry}->{"http://www.hatena.ne.jp/info/xmlns#"} || {};225 if ($hatena->{imageurl}) {226 my $enclosure = Plagger::Enclosure->new;227 $enclosure->url($hatena->{imageurl});228 $enclosure->auto_set_type;229 $entry->add_enclosure($enclosure);230 }231 232 if ($hatena->{imageurlsmall}) {233 $entry->icon({ url => $hatena->{imageurlsmall} });234 }235 }236 237 sub handle_apple_photocast {238 my($self, $entry, $e) = @_;239 240 my $apple = $e->{entry}->{"http://www.apple.com/ilife/wallpapers"} || {};241 if ($apple->{image}) {242 my $enclosure = Plagger::Enclosure->new;243 $enclosure->url( URI->new($apple->{image}) );244 $enclosure->auto_set_type;245 $entry->add_enclosure($enclosure);246 }247 if ($apple->{thumbnail}) {248 $entry->icon({ url => $apple->{thumbnail} });249 }250 189 } 251 190
