| Line | |
|---|
| 1 |
package Plagger::Plugin::Filter::DeliciousFeedTags; |
|---|
| 2 |
use strict; |
|---|
| 3 |
use base qw( Plagger::Plugin ); |
|---|
| 4 |
|
|---|
| 5 |
use Plagger::Tag; |
|---|
| 6 |
|
|---|
| 7 |
sub register { |
|---|
| 8 |
my($self, $context) = @_; |
|---|
| 9 |
$context->register_hook( |
|---|
| 10 |
$self, |
|---|
| 11 |
'update.entry.fixup' => \&filter, |
|---|
| 12 |
); |
|---|
| 13 |
} |
|---|
| 14 |
|
|---|
| 15 |
sub filter { |
|---|
| 16 |
my($self, $context, $args) = @_; |
|---|
| 17 |
|
|---|
| 18 |
return unless $args->{feed}->url =~ |
|---|
| 19 |
m!^http://(?:del\.icio\.us|feeds\.delicious\.com)/rss/!; |
|---|
| 20 |
|
|---|
| 21 |
$context->log(debug => "Fixing del.icio.us tags " . $args->{entry}->tags->[0]); |
|---|
| 22 |
|
|---|
| 23 |
my @tags = Plagger::Tag->parse($args->{entry}->tags->[0]); |
|---|
| 24 |
$args->{entry}->tags(\@tags); |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
1; |
|---|
| 28 |
|
|---|
| 29 |
__END__ |
|---|
| 30 |
|
|---|
| 31 |
=head1 NAME |
|---|
| 32 |
|
|---|
| 33 |
Plagger::Plugin::Filter::DeliciousFeedTags - Fix del.icio.us tags |
|---|
| 34 |
|
|---|
| 35 |
=head1 SYNOPSIS |
|---|
| 36 |
|
|---|
| 37 |
- module: Filter::DeliciousFeedTags |
|---|
| 38 |
|
|---|
| 39 |
=head1 DESCRIPTION |
|---|
| 40 |
|
|---|
| 41 |
del.icio.us RSS feeds contain information to "tags", but they're |
|---|
| 42 |
encoded in a single I<dc:subject> element as whitespace-separated, |
|---|
| 43 |
like C<foo bar baz>. |
|---|
| 44 |
|
|---|
| 45 |
This plugin walks through feeds matching with |
|---|
| 46 |
I<http://del.icio.us/rss/*> and fixes the tags information by |
|---|
| 47 |
splitting them out. |
|---|
| 48 |
|
|---|
| 49 |
=head1 AUTHOR |
|---|
| 50 |
|
|---|
| 51 |
Tatsuhiko Miyagawa |
|---|
| 52 |
|
|---|
| 53 |
=head1 SEE ALSO |
|---|
| 54 |
|
|---|
| 55 |
L<Plagger>, L<http://del.icio.us/> |
|---|
| 56 |
|
|---|
| 57 |
=cut |
|---|