Changeset 226
- Timestamp:
- 03/01/06 23:00:56
- Files:
-
- trunk/plagger/lib/Plagger/Plugin/CustomFeed/Frepa.pm (modified) (5 diffs)
- trunk/plagger/lib/Plagger/Plugin/CustomFeed/Mixi.pm (modified) (2 diffs)
- trunk/plagger/lib/Plagger/Plugin/CustomFeed/Yahoo360JP.pm (modified) (2 diffs)
- trunk/plagger/lib/Plagger/Plugin/Subscription/Bloglines.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Plugin/CustomFeed/Frepa.pm
r189 r226 59 59 if ($self->conf->{fetch_body} && !$blocked) { 60 60 $context->log(info => "Fetch body from $msg->{link}"); 61 Time::HiRes::sleep( $self->conf->{fetch_body_interval} || 1.5 ); 62 my($item) = $self->{frepa}->get_view_diary($msg->{link}); 61 my $item = $self->cache->get_callback( 62 "item-$msg->{link}", 63 sub { 64 Time::HiRes::sleep( $self->conf->{fetch_body_interval} || 1.5 ); 65 $self->{frepa}->get_view_diary($msg->{link}); 66 }, 67 "1 hour", 68 ); 63 69 if ($item) { 64 70 my $body = decode('euc-jp', $item->{description}); … … 92 98 my($self, $url) = @_; 93 99 94 unless ($self->{__icon_cache}->{$url}) {95 Plagger->context->log(info => "Fetch icon from $url");96 $self->{__icon_cache}->{$url} = $self->{frepa}->get_top($url);97 }98 99 $self->{__icon_cache}->{$url};100 Plagger->context->log(info => "Fetch icon from $url"); 101 $self->cache->get_callback( 102 "icon-$url", 103 sub { $self->{frepa}->get_top($url) }, 104 '1 day', 105 ); 100 106 } 101 107 … … 126 132 my $res = $self->{mecha}->submit; 127 133 return 0 unless $self->{mecha}->success; 134 return 0 if $self->{mecha}->content =~ /loginside/; 128 135 129 136 return 1; … … 159 166 my $link = shift; 160 167 161 my $item ;168 my $item = {}; 162 169 my $res = $self->{mecha}->get($link); 163 170 return $item unless $self->{mecha}->success; … … 176 183 my $link = shift; 177 184 178 my $item ;185 my $item = {}; 179 186 my $res = $self->{mecha}->get($link); 180 187 return $item unless $self->{mecha}->success; trunk/plagger/lib/Plagger/Plugin/CustomFeed/Mixi.pm
r189 r226 60 60 61 61 if ($self->conf->{show_icon} && !$blocked) { 62 # TODO: cache owner_id -> URL63 62 my $owner_id = ($msg->{link} =~ /owner_id=(\d+)/)[0]; 64 63 my $link = "http://mixi.jp/show_friend.pl?id=$owner_id"; 65 64 $context->log(info => "Fetch icon from $link"); 66 65 67 my($item) = $self->{mixi}->get_show_friend_outline($link); 66 my $item = $self->cache->get_callback( 67 "outline-$owner_id", 68 sub { 69 Time::HiRes::sleep( $self->conf->{fetch_body_interval} || 1.5 ); 70 my($item) = $self->{mixi}->get_show_friend_outline($link); 71 $item; 72 }, 73 '12 hours', 74 ); 68 75 if ($item && $item->{image} !~ /no_photo/) { 69 76 # prefer smaller image … … 80 87 if ($self->conf->{fetch_body} && !$blocked) { 81 88 $context->log(info => "Fetch body from $msg->{link}"); 82 Time::HiRes::sleep( $self->conf->{fetch_body_interval} || 1.5 ); 83 my($item) = $self->{mixi}->get_view_diary($msg->{link}); 89 my $item = $self->cache->get_callback( 90 "item-$msg->{link}", 91 sub { 92 Time::HiRes::sleep( $self->conf->{fetch_body_interval} || 1.5 ); 93 my($item) = $self->{mixi}->get_view_diary($msg->{link}); 94 $item; 95 }, 96 '1 hour', 97 ); 84 98 if ($item) { 85 99 my $body = decode('euc-jp', $item->{description}); trunk/plagger/lib/Plagger/Plugin/CustomFeed/Yahoo360JP.pm
r214 r226 92 92 93 93 if ($self->conf->{fetch_body}) { 94 $args->{body} = $self->fetch_body($mech, $args->{link}); 94 my $item = $self->cache->get_callback( 95 "item-$args->{link}", 96 sub { $self->fetch_body($mech, $args->{link}) }, 97 "1 hour", 98 ); 99 $args->{body} = $item->{body} if $item->{body}; 95 100 } 96 101 $self->add_entry($feed, $args, $now, $format); … … 169 174 my $content = decode('utf-8', $mech->content); 170 175 if ($content =~ m!<div id="mgbp_body">\n(.*?)</div>!sg) { 171 return $1;176 return { body => $1 }; 172 177 } 173 178 return; trunk/plagger/lib/Plagger/Plugin/Subscription/Bloglines.pm
r210 r226 69 69 70 70 if ($self->conf->{fetch_meta}) { 71 # TODO: cache it! 72 $self->fetch_meta($context); 71 $self->{bloglines_meta} = $self->cache->get_callback( 72 'listsubs_meta', 73 sub { $self->fetch_meta($context) }, 74 '1 day', 75 ); 73 76 } 74 77 } … … 83 86 my $subscription = $self->{bloglines}->listsubs(); 84 87 88 my $meta; 85 89 for my $folder ($subscription->folders) { 86 90 my @feeds = $subscription->feeds_in_folder($folder->{BloglinesSubId}); 87 91 for my $feed (@feeds) { 88 92 # BloglinesSubId is different from bloglines:siteid. Don't use it 89 $ self->{bloglines_meta}->{$feed->{htmlUrl}} = {93 $meta->{$feed->{htmlUrl}} = { 90 94 folder => $folder->{title}, 91 95 xmlUrl => $feed->{xmlUrl}, … … 93 97 } 94 98 } 99 100 $meta; 95 101 } 96 102
