Changeset 177
- Timestamp:
- 02/27/06 01:43:19
- Files:
-
- trunk/plagger/lib/Plagger/Feed.pm (modified) (2 diffs)
- trunk/plagger/lib/Plagger/Plugin/Aggregator/Simple.pm (modified) (1 diff)
- trunk/plagger/lib/Plagger/Plugin/Filter/tDiaryComment.pm (modified) (3 diffs)
- trunk/plagger/lib/Plagger/Plugin/Subscription/Bloglines.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Feed.pm
r171 r177 3 3 4 4 use base qw( Class::Accessor::Fast ); 5 __PACKAGE__->mk_accessors(qw( link url image description language author updated tags meta type ));5 __PACKAGE__->mk_accessors(qw( link url image description language author updated tags meta type source_xml )); 6 6 7 7 use Digest::MD5 qw(md5_hex); … … 21 21 my($self, $entry) = @_; 22 22 push @{ $self->{entries} }, $entry; 23 } 24 25 sub delete_entry { 26 my($self, $entry) = @_; 27 my @entries = grep { $_ ne $entry } $self->entries; 28 $self->{entries} = \@entries; 23 29 } 24 30 trunk/plagger/lib/Plagger/Plugin/Aggregator/Simple.pm
r169 r177 54 54 $feed->author($remote->author); 55 55 $feed->updated($remote->modified); 56 $feed->source_xml($$xml_ref); 56 57 57 58 if ($remote->format eq 'Atom') { trunk/plagger/lib/Plagger/Plugin/Filter/tDiaryComment.pm
r174 r177 9 9 $context->register_hook( 10 10 $self, 11 'update.f ixup' => \&filter,11 'update.feed.fixup' => \&filter, 12 12 ); 13 13 } … … 16 16 my($self, $context, $args) = @_; 17 17 18 for my $feed ($context->update->feeds) { 19 for my $entry ($feed->entries) { 20 $entry->add_rate($self->conf->{rate} || -1) if $entry->link =~ /#c\d+$/; 18 return unless $self->tdiary_magic($args->{feed}); 19 20 $context->log(debug => "Found tDiary feed " . $args->{feed}->url); 21 22 for my $entry ($args->{feed}->entries) { 23 if ($entry->link =~ /\.html#c\d+$/) { 24 # TODO: make it work with Plagger::Action framework 25 $context->log(info => "Strip comment " . $entry->link); 26 $args->{feed}->delete_entry($entry); 21 27 } 22 28 } 29 } 30 31 # http://cvs.sourceforge.net/viewcvs.py/tdiary/plugin/makerss.rb?rev=1.37 32 our $FeedMagic = <<'MAGIC'; 33 ^<\?xml version="1.0" encoding=".*?"\?> 34 <\?xml-stylesheet href="rss\.css" type="text/css"\?> 35 <rdf:RDF xmlns="http://purl\.org/rss/1\.0/" xmlns:rdf="http://www\.w3\.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl\.org/dc/elements/1\.1/" xmlns:content="http://purl\.org/rss/1\.0/modules/content/" xml:lang=".*?"> 36 MAGIC 37 38 sub tdiary_magic { 39 my($self, $feed) = @_; 40 41 my $xml = $feed->source_xml or return; 42 $xml =~ /$FeedMagic/o; 23 43 } 24 44 … … 29 49 =head1 NAME 30 50 31 Plagger::Plugin::Filter:: StripRSSAd - Rating comment of tDiary.51 Plagger::Plugin::Filter::tDiaryComment - Rate tDiary comment 32 52 33 53 =head1 SYNOPSIS 34 54 35 55 - module: Filter::tDiaryComment 36 config:37 rate: -10038 56 39 57 =head1 DESCRIPTION 40 58 41 This plugin rating comment of tDiary. 59 tDiary (L<http://www.tdiary.org/>) RSS feed by default contains 60 comments to the blog as well. They're useful to keep track of the 61 discussion, but sometimes are annoying to read. 62 63 This plugin strips the comment entries from tDiary RSS feeds. 42 64 43 65 =head1 AUTHOR 44 66 45 67 MATSUNO Tokuhiro E<lt>tokuhiro at mobilefactory.jpE<gt> 68 69 Tatsuhiko Miyagawa 46 70 47 71 =head1 SEE ALSO trunk/plagger/lib/Plagger/Plugin/Subscription/Bloglines.pm
r167 r177 91 91 $feed->author($source->{webmaster}); 92 92 $feed->meta->{bloglines_id} = $source->{bloglines}->{siteid}; 93 $feed->source_xml($update->{_xml}); 93 94 94 95 for my $item ( $update->items ) {
