line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MP3::Album::Layout::Fetcher::Tag; |
2
|
1
|
|
|
1
|
|
1992
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
3
|
1
|
|
|
1
|
|
6
|
use MP3::Album::Layout; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
739
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub fetch { |
6
|
0
|
|
|
0
|
0
|
|
my $c = shift; |
7
|
0
|
|
|
|
|
|
my %a = @_; |
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
|
|
|
my @tracks = $a{album}->tracks; |
10
|
0
|
|
|
|
|
|
my %artists = (); |
11
|
0
|
|
|
|
|
|
my %album_name = (); |
12
|
0
|
|
|
|
|
|
my %genres = (); |
13
|
0
|
|
|
|
|
|
my $artist = 'Various Artists'; |
14
|
0
|
|
|
|
|
|
my $album = 'Unknown'; |
15
|
0
|
|
|
|
|
|
my $genre = 'Unknown'; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $layout = MP3::Album::Layout->new(); |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
foreach my $t (@tracks) { |
20
|
0
|
0
|
|
|
|
|
$artists{lc($t->{info}->{ARTIST})}++ if $t->{info}->{ARTIST}; |
21
|
0
|
0
|
|
|
|
|
$album_name{lc($t->{info}->{ALBUM})}++ if $t->{info}->{ALBUM}; |
22
|
0
|
0
|
|
|
|
|
$genres{lc($t->{info}->{GENRE})}++ if $t->{info}->{GENRE}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
$artist = $tracks[0]->{info}->{ARTIST} if (scalar(keys(%artists)) == 1); |
26
|
0
|
0
|
|
|
|
|
$album = $tracks[0]->{info}->{ALBUM} if (scalar(keys(%album_name)) == 1); |
27
|
0
|
0
|
|
|
|
|
$genre = $tracks[0]->{info}->{GENRE} if (scalar(keys(%genres)) == 1); |
28
|
0
|
|
|
|
|
|
$layout->artist($artist); |
29
|
0
|
|
|
|
|
|
$layout->title($album); |
30
|
0
|
|
|
|
|
|
$layout->genre($genre); |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
foreach my $t (@tracks) { |
33
|
0
|
|
|
|
|
|
my $t_artist = $artist; |
34
|
0
|
0
|
|
|
|
|
$t_artist = $t->{info}->{ARTIST} if $artist eq 'Various Artists'; |
35
|
0
|
|
|
|
|
|
$layout->add_track( artist => $t_artist, title => $t->{info}->{TITLE} ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
return wantarray ? ( $layout ) : [ $layout ]; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|