| 1 | package Music::Tag::Coveralia; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.014000; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use parent qw/Music::Tag::Generic/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use HTTP::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use WWW::Search; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub required_values { qw/album/ } | ||||||||||||||||||||||||||
|
Subroutine
required_values: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub set_values { qw/picture/ } | ||||||||||||||||||||||||||
|
Subroutine
set_values: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | my $ht = HTTP::Tiny->new(agent => "Music-Tag-Coveralia/$VERSION"); | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 2 | ▶ | sub get_tag { | ||||||||||||||||||||||||||
|
Subroutine
get_tag: called CC=6 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||
| 19 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 2 | my $album = $self->info->album; | |||||||||||||||||||||||||||
| 22 | 2 | my $ws = WWW::Search->new('Coveralia::Albums'); | |||||||||||||||||||||||||||
| 23 | 2 | $self->status(1, "Searching coveralia for the album $album"); | |||||||||||||||||||||||||||
| 24 | 2 | $ws->native_query(WWW::Search::escape_query($album)); | |||||||||||||||||||||||||||
| 25 | 2 | ▶ | while (my $res = $ws->next_result) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 1000 | $self->status(1, 'Found album ' . $res->title . ' by ' . $res->artist); | |||||||||||||||||||||||||||
| 27 | 1000 | ▶ | next if $self->info->has_data('artist') && $self->info->artist ne $res->artist; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->info->has_data("artist") and $self->info->artist ne $res->artist
MC/DC0%0/2
$self->info->has_data("artist") and $self->info->artist ne $res->artist
$self->info->has_data("artist")
$self->info->artist ne $res->artist
Truth table33%1/3
A and B
A= $self->info->has_data("artist")B= $self->info->artist ne $res->artist
| |||||||||||||||||||||||||||||
| 28 | 0 | $self->status(0, 'Selected album ' . $res->title . ' by ' . $res->artist); | |||||||||||||||||||||||||||
| 29 | 0 | ▶ | if ($res->cover('frontal')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 0 | my $resp = $ht->get($res->cover('frontal')); | |||||||||||||||||||||||||||
| 31 | 0 | ▶ | last unless $resp->{success}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | 0 | $self->info->picture({_Data => $resp->{content}}); | |||||||||||||||||||||||||||
| 33 | 0 | $self->tagchange('picture'); | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | last | ||||||||||||||||||||||||||||
| 36 | 0 | } | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 2 | return $self->info | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 1 | 1; | |||||||||||||||||||||||||||
| 42 | __END__ | ||||||||||||||||||||||||||||