Plagger::Plugin::Namespace::ApplePhotocast - Apple Photocast module


Plagger documentation Contained in the Plagger distribution.

Index


Code Index:

NAME

Top

Plagger::Plugin::Namespace::ApplePhotocast - Apple Photocast module

SYNOPSIS

Top

  - module: Namespace::ApplePhotocast

DESCRIPTION

Top

This plugin parses Apple photocast RSS feed extensions and store photo images to entry enclosures. This plugin is loaded by default.

AUTHOR

Top

Tatsuhiko Miyagawa

SEE ALSO

Top

Plagger


Plagger documentation Contained in the Plagger distribution.

package Plagger::Plugin::Namespace::ApplePhotocast;
use strict;
use base qw( Plagger::Plugin );

sub register {
    my($self, $context) = @_;
    $context->register_hook(
        $self,
        'aggregator.entry.fixup' => \&handle,
    );
}

sub handle {
    my($self, $context, $args) = @_;

    my $apple = $args->{orig_entry}->{entry}->{"http://www.apple.com/ilife/wallpapers"} || {};
    if ($apple->{image}) {
        my $enclosure = Plagger::Enclosure->new;
        $enclosure->url( URI->new($apple->{image}) );
        $enclosure->auto_set_type;
        $args->{entry}->add_enclosure($enclosure);
    }
    if ($apple->{thumbnail}) {
        $args->{entry}->icon({ url => $apple->{thumbnail} });
    }
}


1;
__END__