line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MP3::Album::Layout; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2283
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
870
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
0
|
|
|
0
|
1
|
|
my $s = shift; |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
|
|
|
my $b = { |
11
|
|
|
|
|
|
|
title => 'unknown', |
12
|
|
|
|
|
|
|
artist => 'unknown', |
13
|
|
|
|
|
|
|
genre => 'unknown', |
14
|
|
|
|
|
|
|
year => '', |
15
|
|
|
|
|
|
|
comment => '', |
16
|
|
|
|
|
|
|
location => '', |
17
|
|
|
|
|
|
|
tracks => [] |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
return bless $b, $s; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub edit_track { |
24
|
0
|
|
|
0
|
1
|
|
my $s = shift; |
25
|
0
|
|
|
|
|
|
my %a = @_; |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
unless ($a{position}) { |
28
|
0
|
|
|
|
|
|
$@ = "missing param position"; |
29
|
0
|
|
|
|
|
|
return undef; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
0
|
|
|
|
unless ($a{artist} || $a{title}) { |
33
|
0
|
|
|
|
|
|
$@ = "missing param title or artist"; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
$s->{tracks}->[$a{position}+1]->{artist} = $a{artist} if $a{artist}; |
37
|
0
|
0
|
|
|
|
|
$s->{tracks}->[$a{position}+1]->{artist} = $a{title} if $a{title}; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return 1; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub info { |
43
|
0
|
|
|
0
|
0
|
|
my $s = shift; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
return $s; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub add_track { |
49
|
0
|
|
|
0
|
1
|
|
my $s = shift; |
50
|
0
|
|
|
|
|
|
my %a = @_; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
push @{$s->{tracks}}, { 'artist' => $a{artist}, |
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
'title' => $a{title}, |
54
|
|
|
|
|
|
|
'lenght' => $a{lenght} |
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return 1; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub artist { |
61
|
0
|
|
|
0
|
1
|
|
my $s = shift; |
62
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
$s->{artist} = $_[0] if @_; |
64
|
0
|
|
|
|
|
|
return $s->{artist}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub genre { |
68
|
0
|
|
|
0
|
1
|
|
my $s = shift; |
69
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
$s->{genre} = $_[0] if @_; |
71
|
0
|
|
|
|
|
|
return $s->{genre}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub comment { |
75
|
0
|
|
|
0
|
1
|
|
my $s = shift; |
76
|
|
|
|
|
|
|
|
77
|
0
|
0
|
|
|
|
|
$s->{comment} = $_[0] if @_; |
78
|
0
|
|
|
|
|
|
return $s->{comment}; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub title { |
82
|
0
|
|
|
0
|
1
|
|
my $s = shift; |
83
|
0
|
0
|
|
|
|
|
$s->{title} = $_[0] if @_; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
return $s->{title}; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
1; |