Changeset 122

Show
Ignore:
Timestamp:
02/23/06 20:37:04
Author:
miyagawa
Message:
  • remove filename config option from Spotlight. Just use entry_id.webbookmark
  • Fix $entry->id so it doesn't use HTTP permalink (in that case use MD5)
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/config.yaml.sample

    r119 r122  
    9090    config: 
    9191      dir: /Users/youpy/Library/Caches/Metadata/Plagger/ 
    92       filename: %i.webbookmark 
  • trunk/plagger/lib/Plagger/Entry.pm

    r80 r122  
    33 
    44use base qw( Class::Accessor::Fast ); 
    5 __PACKAGE__->mk_accessors(qw( title author tags date link id summary body rate  meta)); 
     5__PACKAGE__->mk_accessors(qw( title author tags date link summary body rate  meta)); 
    66 
     7use Digest::MD5; 
    78use DateTime::Format::Mail; 
    89use Storable; 
     
    6465} 
    6566 
     67sub id { 
     68    my $self = shift; 
     69    $self->{id} = shift if @_; 
     70    $self->{id} || Digest::MD5::md5_hex($self->permalink); 
     71} 
     72 
    66731; 
    6774 
  • trunk/plagger/lib/Plagger/Plugin/Aggregator/Simple.pm

    r67 r122  
    5858            if eval { $e->issued }; 
    5959        $entry->link($e->link); 
    60         $entry->id($e->id)
     60        $entry->id( $e->id ) if $e->id !~ m!^http://!
    6161        $entry->body($e->content->body); 
    6262 
  • trunk/plagger/lib/Plagger/Plugin/Publish/Spotlight.pm

    r120 r122  
    2222 
    2323    for my $entry ($args->{feed}->entries) { 
    24         my $file = $self->gen_filename($entry)
     24        my $file = $entry->id . '.webbookmark'
    2525        my $path = File::Spec->catfile($dir, $file); 
    2626        $context->log(info => "writing output to $path"); 
     
    3232        close $out; 
    3333    } 
    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; 
    6034} 
    6135 
     
    8256    config: 
    8357      dir: /Users/youpy/Library/Caches/Metadata/Plagger/ 
    84       filename: %i.webbookmark 
    8558 
    8659=head1 DESCRIPTION 
  • trunk/plagger/lib/Plagger/Plugin/Subscription/Bloglines.pm

    r83 r122  
    101101            $entry->date( Plagger::Date->parse('Mail', $item->{pubDate}) ); 
    102102            $entry->link($item->{link}); 
    103             $entry->id($item->{guid}); 
     103            $entry->id($item->{guid}) 
     104                if $item->{guid} && $item->{guid} !~ m!^http://!; 
    104105            $entry->body($item->{description}); 
    105106