Changeset 122
- Timestamp:
- 02/23/06 20:37:04
- Files:
-
- trunk/plagger/config.yaml.sample (modified) (1 diff)
- trunk/plagger/lib/Plagger/Entry.pm (modified) (2 diffs)
- trunk/plagger/lib/Plagger/Plugin/Aggregator/Simple.pm (modified) (1 diff)
- trunk/plagger/lib/Plagger/Plugin/Publish/Spotlight.pm (modified) (3 diffs)
- trunk/plagger/lib/Plagger/Plugin/Subscription/Bloglines.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/config.yaml.sample
r119 r122 90 90 config: 91 91 dir: /Users/youpy/Library/Caches/Metadata/Plagger/ 92 filename: %i.webbookmarktrunk/plagger/lib/Plagger/Entry.pm
r80 r122 3 3 4 4 use base qw( Class::Accessor::Fast ); 5 __PACKAGE__->mk_accessors(qw( title author tags date link idsummary body rate meta));5 __PACKAGE__->mk_accessors(qw( title author tags date link summary body rate meta)); 6 6 7 use Digest::MD5; 7 8 use DateTime::Format::Mail; 8 9 use Storable; … … 64 65 } 65 66 67 sub id { 68 my $self = shift; 69 $self->{id} = shift if @_; 70 $self->{id} || Digest::MD5::md5_hex($self->permalink); 71 } 72 66 73 1; 67 74 trunk/plagger/lib/Plagger/Plugin/Aggregator/Simple.pm
r67 r122 58 58 if eval { $e->issued }; 59 59 $entry->link($e->link); 60 $entry->id( $e->id);60 $entry->id( $e->id ) if $e->id !~ m!^http://!; 61 61 $entry->body($e->content->body); 62 62 trunk/plagger/lib/Plagger/Plugin/Publish/Spotlight.pm
r120 r122 22 22 23 23 for my $entry ($args->{feed}->entries) { 24 my $file = $ self->gen_filename($entry);24 my $file = $entry->id . '.webbookmark'; 25 25 my $path = File::Spec->catfile($dir, $file); 26 26 $context->log(info => "writing output to $path"); … … 32 32 close $out; 33 33 } 34 }35 36 my %formats = (37 'l' => sub { my $s = $_[0]->link; $s =~ s!^https?://!!; $s },38 't' => sub { $_[0]->title },39 'i' => sub { $_[0]->id },40 );41 42 my $format_re = qr/%(l|t|i)/;43 44 sub gen_filename {45 my($self, $entry) = @_;46 47 my $file = $self->conf->{filename};48 $file =~ s{$format_re}{49 $self->safe_filename($formats{$1}->($entry))50 }egx;51 52 $file;53 }54 55 sub safe_filename {56 my($self, $path) = @_;57 $path =~ s![^\w\s]+!_!g;58 $path =~ s!\s+!_!g;59 $path;60 34 } 61 35 … … 82 56 config: 83 57 dir: /Users/youpy/Library/Caches/Metadata/Plagger/ 84 filename: %i.webbookmark85 58 86 59 =head1 DESCRIPTION trunk/plagger/lib/Plagger/Plugin/Subscription/Bloglines.pm
r83 r122 101 101 $entry->date( Plagger::Date->parse('Mail', $item->{pubDate}) ); 102 102 $entry->link($item->{link}); 103 $entry->id($item->{guid}); 103 $entry->id($item->{guid}) 104 if $item->{guid} && $item->{guid} !~ m!^http://!; 104 105 $entry->body($item->{description}); 105 106
