--- /dev/null
+Revision history for Perl extension Music::Tag::Coveralia.
+
+0.000_001 2014-10-30T01:02+02:00
+ - Initial release
--- /dev/null
+Changes
+Makefile.PL
+MANIFEST
+README
+t/Music-Tag-Coveralia.t
+t/empty.flac
+t/perlcritic.t
+t/perlcriticrc
+lib/Music/Tag/Coveralia.pm
--- /dev/null
+use 5.014000;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Music::Tag::Coveralia',
+ VERSION_FROM => 'lib/Music/Tag/Coveralia.pm',
+ ABSTRACT_FROM => 'lib/Music/Tag/Coveralia.pm',
+ AUTHOR => 'Marius Gavrilescu <marius@ieval.ro>',
+ MIN_PERL_VERSION => '5.14.0',
+ LICENSE => 'perl',
+ BUILD_REQUIRES => {
+ qw/Test::RequiresInternet 0/,
+ },
+ SIGN => 1,
+ PREREQ_PM => {
+ qw/Music::Tag 0
+ Music::Tag::Generic 0
+ LWP::Simple 0
+ WWW::Search 0
+ WWW::Search::Coveralia 0/,
+ },
+ META_ADD => {
+ dynamic_config => 0,
+ resources => {
+ repository => 'http://git.ieval.ro/?p=music-tag-coveralia.git',
+ },
+ }
+);
--- /dev/null
+Music-Tag-Coveralia version 0.000_001
+=====================================
+
+INSTALLATION
+
+To install this module type the following:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+* Music::Tag
+* WWW::Search
+* WWW::Search::Coveralia
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2014 by Marius Gavrilescu
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.20.1 or,
+at your option, any later version of Perl 5 you may have available.
+
+
--- /dev/null
+package Music::Tag::Coveralia;
+
+use 5.014000;
+use strict;
+use warnings;
+use parent qw/Music::Tag::Generic/;
+
+our $VERSION = '0.000_001';
+
+use LWP::Simple qw/get/;
+use WWW::Search;
+
+sub required_values { qw/album/ }
+sub set_values { qw/picture/ }
+
+sub get_tag {
+ my ($self) = @_;
+
+ my $album = $self->info->get_data('album');
+ my $ws = WWW::Search->new('Coveralia::Albums');
+ $self->status(1, "Searching coveralia for the album $album");
+ $ws->native_query(WWW::Search::escape_query($album));
+ while (my $res = $ws->next_result) {
+ $self->status(1, 'Found album ' . $res->title . ' by ' . $res->artist);
+ next if $self->info->has_data('artist') && $self->info->get_data('artist') ne $res->artist;
+ $self->status(0, 'Selected album ' . $res->title . ' by ' . $res->artist);
+ if ($res->cover('frontal')) {
+ $self->info->set_data(picture => {_Data => get $res->cover('frontal')});
+ $self->tagchange('picture');
+ }
+ last
+ }
+
+ return $self->info
+}
+
+1;
+__END__
+
+=encoding utf-8
+
+=head1 NAME
+
+Music::Tag::Coveralia - Get cover art from coveralia.com
+
+=head1 SYNOPSIS
+
+ use Music::Tag;
+ my $mt = Music::Tag->new($filename);
+ $mt->add_plugin('Coveralia');
+ $mt->get_tag;
+
+=head1 DESCRIPTION
+
+This plugin gets cover art from L<http://coveralia.com>, based on album and (optionally) artist.
+
+=head1 REQUIRED DATA VALUES
+
+=over
+
+=item album
+
+Used as the search term.
+
+=back
+
+=head1 USED DATA VALUES
+
+=over
+
+=item artist
+
+If present, the first album found from this artist is chosen. Otherwise the first album found is chosen.
+
+=back
+
+=head1 SET DATA VALUES
+
+=over
+
+=item picture
+
+=back
+
+=head1 SEE ALSO
+
+L<Music::Tag>, L<WWW::Search::Coveralia>, L<http://coveralia.com>
+
+=head1 AUTHOR
+
+Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2014 by Marius Gavrilescu
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.20.1 or,
+at your option, any later version of Perl 5 you may have available.
+
+
+=cut
--- /dev/null
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use Test::RequiresInternet qw/www.coveralia.com 80/;
+use Test::More tests => 3;
+use Music::Tag traditional => 1;
+BEGIN { use_ok('Music::Tag::Coveralia') };
+
+sub test {
+ my ($artist, $album, $expect) = @_;
+ my $mt = Music::Tag->new('t/empty.flac', {$ENV{TEST_VERBOSE} ? (verbose => 1) : (quiet => 1)});
+ $mt->artist($artist);
+ $mt->album($album);
+ $mt->add_plugin('Coveralia');
+ $mt->get_tag;
+ my $exists = $expect ? 'exists' : 'does not exist';
+ is $mt->has_data('picture'), $expect, "$artist - $album $exists"
+}
+
+test 'Metallica', 'Ride The Lightning', 1;
+test 'Metal', 'Ride The Lightning', 0;
--- /dev/null
+#!/usr/bin/perl
+use v5.14;
+use warnings;
+
+use Test::More;
+
+BEGIN { plan skip_all => '$ENV{RELEASE_TESTING} is false' unless $ENV{RELEASE_TESTING} }
+use Test::Perl::Critic -profile => 't/perlcriticrc';
+
+all_critic_ok
--- /dev/null
+severity = 1
+
+[-CodeLayout::RequireTidyCode]
+[-ControlStructures::ProhibitPostfixControls]
+[-ControlStructures::ProhibitUnlessBlocks]
+[-Documentation::PodSpelling]
+[-Documentation::RequirePodLinksIncludeText]
+[-InputOutput::RequireBracedFileHandleWithPrint]
+[-RegularExpressions::ProhibitEnumeratedClasses]
+[-RegularExpressions::RequireLineBoundaryMatching]
+[-Subroutines::RequireFinalReturn]
+[-ValuesAndExpressions::ProhibitConstantPragma]
+[-ValuesAndExpressions::ProhibitEmptyQuotes]
+[-ValuesAndExpressions::ProhibitMagicNumbers]
+[-ValuesAndExpressions::ProhibitNoisyQuotes]
+[-Variables::ProhibitLocalVars]
+[-Variables::ProhibitPackageVars]
+[-Variables::ProhibitPunctuationVars]
+
+[RegularExpressions::RequireExtendedFormatting]
+minimum_regex_length_to_complain_about = 20
+
+[Documentation::RequirePodSections]
+lib_sections = NAME | SYNOPSIS | DESCRIPTION | AUTHOR | COPYRIGHT AND LICENSE
+script_sections = NAME | SYNOPSIS | DESCRIPTION | AUTHOR | COPYRIGHT AND LICENSE
+
+[Subroutines::RequireArgUnpacking]
+short_subroutine_statements = 5
+allow_subscripts = 1