From: Marius Gavrilescu Date: Sat, 9 May 2015 07:36:23 +0000 (+0300) Subject: Use HTTP::Tiny instead of LWP::Simple X-Git-Tag: 0.001~3 X-Git-Url: http://git.ieval.ro/?p=music-tag-coveralia.git;a=commitdiff_plain;h=4ef783996af76523173708b468afd4a093ee5c2e Use HTTP::Tiny instead of LWP::Simple --- diff --git a/Makefile.PL b/Makefile.PL index e26f950..577e716 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -15,7 +15,6 @@ WriteMakefile( PREREQ_PM => { qw/Music::Tag 0 Music::Tag::Generic 0 - LWP::Simple 0 WWW::Search 0 WWW::Search::Coveralia 0/, }, diff --git a/lib/Music/Tag/Coveralia.pm b/lib/Music/Tag/Coveralia.pm index 6a23335..fe2e9c6 100644 --- a/lib/Music/Tag/Coveralia.pm +++ b/lib/Music/Tag/Coveralia.pm @@ -7,12 +7,14 @@ use parent qw/Music::Tag::Generic/; our $VERSION = '0.000_001'; -use LWP::Simple qw/get/; +use HTTP::Tiny; use WWW::Search; sub required_values { qw/album/ } sub set_values { qw/picture/ } +my $ht = HTTP::Tiny->new(agent => "Music-Tag-Coveralia/$VERSION"); + sub get_tag { my ($self) = @_; @@ -25,7 +27,9 @@ sub get_tag { 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')}); + my $resp = $ht->get($res->cover('frontal')); + last unless $resp->{success}; + $self->info->set_data(picture => {_Data => $resp->{content}}); $self->tagchange('picture'); } last