Changeset 1367

Show
Ignore:
Timestamp:
08/17/06 22:18:32
Author:
miyagawa
Message:

Filter::Thumbnail: support entry icon

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Filter/Thumbnail.pm

    r411 r1367  
    88        $self, 
    99        'update.feed.fixup'  => \&feed, 
     10        'update.entry.fixup' => \&entry, 
    1011    ); 
    1112} 
     
    1819 
    1920    $context->log(info => "Add thumbnail as image to " . $args->{feed}->link); 
    20     $args->{feed}->image( $self->build_image($args->{feed}) ); 
     21    $args->{feed}->image( $self->build_image($args->{feed}->title, $args->{feed}->link) ); 
     22
     23 
     24sub entry { 
     25    my($self, $context, $args) = @_; 
     26 
     27    # do nothing if there's already entry icon 
     28    return if $args->{entry}->icon; 
     29 
     30    $context->log(info => "Add thumbnail as image to " . $args->{entry}->permalink); 
     31    $args->{feed}->image( $self->build_image($args->{entry}->title, $args->{entry}->permalink) ); 
    2132} 
    2233 
    2334sub build_image { 
    24     my($self, $feed) = @_; 
     35    my($self, $title, $link) = @_; 
    2536 
    2637    # TODO: use other serivces here 
    2738    return { 
    28         url    => "http://img.simpleapi.net/small/" . $feed->link, 
    29         title  => $feed->title, 
    30         link   => $feed->link, 
     39        url    => "http://img.simpleapi.net/small/" . $link, 
     40        title  => $title, 
     41        link   => $link, 
    3142        width  => 128, 
    3243        height => 128,