|
|
||
lib/Plagger/Plugin/Filter/Fresh.pm
package Plagger::Plugin::Filter::Fresh; use strict; use base qw( Plagger::Plugin ); sub register { my($self, $context) = @_; $context->register_hook( $self, 'update.fixup' => \&filter, ); } sub filter { my($self, $context, $args) = @_; for my $feed ($context->update->feeds) { for my $entry ($feed->entries) { if($entry->date > Plagger::Date->now(%{$context->conf})->subtract(minutes => $self->conf->{duration})) { $context->log(warn => "fresh entry found. Add tag 'fresh'"); $entry->add_tag('fresh'); } } } } 1;
config.yaml
- module: Filter::Fresh config: duration: 120 - module: SmartFeed config: id: fresh-stuff rule: module: EntryTag tag: fresh