Changeset 444

Show
Ignore:
Timestamp:
04/01/06 02:03:31
Author:
miyagawa
Message:

Add Filter::Rule module to strip entries and feeds using Fresh rule for easy deduping

Files:

Legend:

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

    r430 r444  
    257257            $self->run_hook('smartfeed.entry', { feed => $feed, entry => $entry }); 
    258258        } 
     259        $self->run_hook('smartfeed.feed', { feed => $feed }); 
    259260    } 
    260261    $self->run_hook('smartfeed.finalize'); 
  • trunk/plagger/lib/Plagger/Rule/Fresh.pm

    r326 r444  
    2222            $mtime or Plagger->context->error("$path: $!") 
    2323        } 
    24         $self->{timestamp} = $mtime || $now
     24        $self->{timestamp} = $mtime || 0
    2525    } else { 
    2626        $self->{duration} ||= 120; 
     
    8787      duration: 120 
    8888 
    89   # entries fresher than mtime of /tmp/foo.tmp 
    90   - module: Publish::Gmail 
     89  # remove entries older than mtime of /tmp/foo.tmp 
     90  - module: Filter::Rule 
    9191    rule: 
    9292      module: Fresh 
  • trunk/plagger/lib/Plagger/Update.pm

    r7 r444  
    1212    for my $tag ( @{$feed->tags} ) { 
    1313        push @{ $self->{by_tags}->{$tag} }, $feed; 
     14    } 
     15} 
     16 
     17sub delete_feed { 
     18    my($self, $feed) = @_; 
     19    my @feeds = grep { $_ ne $feed } $self->feeds; 
     20    $self->{feeds} = \@feeds; 
     21 
     22    for my $tag ( @{$feed->tags} ) { 
     23        my @feeds = grep { $_ ne $feed } @{ $self->{by_tags}->{$tag} }; 
     24        $self->{by_tags}->{$tag} = \@feeds; 
    1425    } 
    1526}