Dear Home Owner, このページをアンテナに追加 RSSフィード

 | 

2006-02-24

Plagger::Plugin::Filter::Fresh  Plagger::Plugin::Filter::Fresh - Dear Home Owner, を含むブックマーク はてなブックマーク -  Plagger::Plugin::Filter::Fresh - Dear Home Owner,  Plagger::Plugin::Filter::Fresh - Dear Home Owner, のブックマークコメント

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

http://d.hatena.ne.jp/tnx/20060223/1140715274#c

トラックバック - http://subtech.g.hatena.ne.jp/youpy/20060224
 |