Changeset 28

Show
Ignore:
Timestamp:
02/05/06 18:25:02
Author:
miyagawa
Message:

Added fetch_items to avoid mixi access restriction
replace linefeed to <br/> tag in the body. Fixes #5

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/CustomFeed/Mixi.pm

    r24 r28  
    4444 
    4545    my @msgs = $self->{mixi}->get_new_friend_diary; 
    46     $context->log(info => scalar(@msgs). " messages from new_friend_diary.pl")
     46    my $items = $self->conf->{fetch_items} || 20
    4747 
     48    my $i = 0; 
    4849    for my $msg (@msgs) { 
    4950        next unless $msg->{image}; # external blog 
     51        last if $i++ >= $items; 
    5052 
    5153        my $entry = Plagger::Entry->new; 
     
    5759        if ($self->conf->{fetch_body}) { 
    5860            $context->log(info => "Fetch body from $msg->{link}"); 
    59             Time::HiRes::sleep( $self->conf->{fetch_body_interval} || 1.0 ); 
     61            Time::HiRes::sleep( $self->conf->{fetch_body_interval} || 1.5 ); 
    6062            my($item) = $self->{mixi}->get_view_diary($msg->{link}); 
    6163            if ($item) { 
    6264                my $body = decode('euc-jp', $item->{description}); 
     65                   $body =~ s!\n!<br />!g; 
    6366                for my $image (@{ $item->{images} }) { 
    6467                    # xxx this should be $entry->enclosures