root/trunk/plagger/lib/Plagger/Plugin/Filter/AddTags.pm

Revision 1924 (checked in by franck, 13 years ago)

r2174@franck-mbp: franck | 2007-02-27 21:16:14 +0100
add default tags to an entry
r2175@franck-mbp: franck | 2007-02-27 21:17:25 +0100
publish-iphoto deps
r2176@franck-mbp: franck | 2007-02-27 21:18:43 +0100
add images from enclosures to iPhoto
r2177@franck-mbp: franck | 2007-02-27 21:52:16 +0100
AddTags? (test & correction in .pm)
r2178@franck-mbp: franck | 2007-02-27 21:54:49 +0100

import to iphoto if there is no Mac
Glue

Line 
1 package Plagger::Plugin::Filter::AddTags;
2 use strict;
3 use base qw( Plagger::Plugin );
4
5 sub register {
6     my ( $self, $context ) = @_;
7     $context->register_hook( $self, 'update.feed.fixup' => \&filter, );
8 }
9
10 sub filter {
11     my ( $self, $c, $args ) = @_;
12
13     foreach my $entry ( $args->{feed}->entries ) {
14         foreach my $tag ( @{ $self->conf->{tags} } ) {
15             $c->log( info => "add tag " . $tag );
16             $entry->add_tag($tag) unless $entry->has_tag($tag);
17         }
18     }
19 }
20
21 1;
22
23 __END__
24
25 =head1 NAME
26
27 Plagger::Plugin::Filter::AddTAg - add tags to entry
28
29 =head1 SYNOPSIS
30
31   - module: Filter::AddTags
32     config:
33                         tags:
34       - from_plagger
35                         - perl
36
37
38 =head1 AUTHOR
39
40 Franck Cuny
41
42 =head1 SEE ALSO
43
44 L<Plagger>
45
46 =cut
Note: See TracBrowser for help on using the browser.