root/trunk/plagger/lib/Plagger/Plugin/Namespace/ApplePhotocast.pm

Revision 1769 (checked in by miyagawa, 2 years ago)
  • Moved Photocast/MediaRSS/Hatena specific parsing methods to Namespace::* plugins. w00t!
  • Added Bundle::Defaults plugin that loads bunch of "default" plugins
Line 
1 package Plagger::Plugin::Namespace::ApplePhotocast;
2 use strict;
3 use base qw( Plagger::Plugin );
4
5 sub register {
6     my($self, $context) = @_;
7     $context->register_hook(
8         $self,
9         'aggregator.entry.fixup' => \&handle,
10     );
11 }
12
13 sub handle {
14     my($self, $context, $args) = @_;
15
16     my $apple = $args->{orig_entry}->{entry}->{"http://www.apple.com/ilife/wallpapers"} || {};
17     if ($apple->{image}) {
18         my $enclosure = Plagger::Enclosure->new;
19         $enclosure->url( URI->new($apple->{image}) );
20         $enclosure->auto_set_type;
21         $args->{entry}->add_enclosure($enclosure);
22     }
23     if ($apple->{thumbnail}) {
24         $args->{entry}->icon({ url => $apple->{thumbnail} });
25     }
26 }
27
28
29 1;
30 __END__
31
32 =head1 NAME
33
34 Plagger::Plugin::Namespace::ApplePhotocast - Apple Photocast module
35
36 =head1 SYNOPSIS
37
38   - module: Namespace::ApplePhotocast
39
40 =head1 DESCRIPTION
41
42 This plugin parses Apple photocast RSS feed extensions and store photo
43 images to entry enclosures. This plugin is loaded by default.
44
45 =head1 AUTHOR
46
47 Tatsuhiko Miyagawa
48
49 =head1 SEE ALSO
50
51 L<Plagger>
52
53 =cut
Note: See TracBrowser for help on using the browser.