root/lang/perl/plagger/lib/Plagger/Plugin/Filter/Aidy3.pm

Revision 6790, 1.1 kB (checked in by youpy, 7 months ago)
  • import WebService::Aidy3
  • import Plagger::Plugin::Filter::Aidy3
Line 
1package Plagger::Plugin::Filter::Aidy3;
2use strict;
3use base qw( Plagger::Plugin );
4
5use WebService::Aidy3;
6
7sub register {
8    my($self, $context) = @_;
9    $context->register_hook(
10        $self,
11        'update.entry.fixup' => \&filter,
12    );
13}
14
15sub filter {
16    my($self, $context, $args) = @_;
17
18    my $aidy3 = WebService::Aidy3->new();
19    for my $enclosure ($args->{entry}->enclosures) {
20        if($enclosure->url =~ /\.mp3$/) {
21            my $response = $aidy3->get(
22                url => $enclosure->url,
23                ref_url => $args->{entry}->permalink);
24
25            if($response->is_success) {
26                $self->log(info => "Post mp3 enclosure url " . $enclosure->url . " to aidy3.");
27            }
28        }
29    }
30}
31
321;
33
34__END__
35
36=head1 NAME
37
38Plagger::Plugin::Filter::Aidy3 - Post mp3 enclosure url to aidy3
39
40=head1 SYNOPSIS
41
42  - module: Filter::Aidy3
43
44=head1 DESCRIPTION
45
46This plugin posts mp3 enclosure url(and entry's permalink as ref_url) to aidy3.
47
48=head1 AUTHOR
49
50youpy E<lt>youpy@buycheapviagraonlinenow.comE<gt>
51
52=head1 SEE ALSO
53
54=over 4
55
56=item * aidy3 - A web application provide API to analyze ID3v2 tag in MP3 on the web
57
58L<http://aidy3.buffr.org/>
59
60=back
61
62=cut
Note: See TracBrowser for help on using the browser.