]>
iEval git - music-tag-coveralia.git/blob - lib/Music/Tag/Coveralia.pm
1 package Music
::Tag
::Coveralia
;
6 use parent qw
/Music::Tag::Generic/;
8 our $VERSION = '0.000_001';
13 sub required_values
{ qw
/album/ }
14 sub set_values
{ qw
/picture/ }
16 my $ht = HTTP
::Tiny
->new(agent
=> "Music-Tag-Coveralia/$VERSION");
21 my $album = $self->info->album;
22 my $ws = WWW
::Search
->new('Coveralia::Albums');
23 $self->status(1, "Searching coveralia for the album $album");
24 $ws->native_query(WWW
::Search
::escape_query
($album));
25 while (my $res = $ws->next_result) {
26 $self->status(1, 'Found album ' . $res->title . ' by ' . $res->artist);
27 next if $self->info->has_data('artist') && $self->info->artist ne $res->artist;
28 $self->status(0, 'Selected album ' . $res->title . ' by ' . $res->artist);
29 if ($res->cover('frontal')) {
30 my $resp = $ht->get($res->cover('frontal'));
31 last unless $resp->{success
};
32 $self->info->picture({_Data
=> $resp->{content
}});
33 $self->tagchange('picture');
48 Music::Tag::Coveralia - Get cover art from coveralia.com
53 my $mt = Music::Tag->new($filename);
54 $mt->add_plugin('Coveralia');
59 This plugin gets cover art from L<http://coveralia.com>, based on album and (optionally) artist.
61 =head1 REQUIRED DATA VALUES
67 Used as the search term.
71 =head1 USED DATA VALUES
77 If present, the first album found from this artist is chosen. Otherwise the first album found is chosen.
81 =head1 SET DATA VALUES
91 L<Music::Tag>, L<WWW::Search::Coveralia>, L<http://coveralia.com>
95 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
97 =head1 COPYRIGHT AND LICENSE
99 Copyright (C) 2014 by Marius Gavrilescu
101 This library is free software; you can redistribute it and/or modify
102 it under the same terms as Perl itself, either Perl version 5.20.1 or,
103 at your option, any later version of Perl 5 you may have available.
This page took 0.052334 seconds and 4 git commands to generate.