line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mac::iTunes::Library::Item; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
75808
|
use 5.006; |
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
162
|
|
4
|
4
|
|
|
4
|
|
24
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
108
|
|
5
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
27
|
|
|
4
|
|
|
|
|
145
|
|
6
|
4
|
|
|
4
|
|
20
|
use Carp; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
16980
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); |
11
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
12
|
|
|
|
|
|
|
our @EXPORT = qw( ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '1.0'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Mac::iTunes::Library::Item - Perl extension for representing an item |
19
|
|
|
|
|
|
|
(song, URL, video) within an iTunes library. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use Mac::iTunes::Library::Item; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $item = Mac::iTunes::Library::Item->new( |
26
|
|
|
|
|
|
|
'Track ID' => 1, |
27
|
|
|
|
|
|
|
'Name' => 'The Fooiest Song', |
28
|
|
|
|
|
|
|
'Artist' => 'The Bar Band', |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
$item->genre('Ska'); |
31
|
|
|
|
|
|
|
print "We are the " . $item->artist() . " and we play " . |
32
|
|
|
|
|
|
|
$item->genre() . " music\n"; |
33
|
|
|
|
|
|
|
print "Enjoy our hit song " . $item->name() . "\n"; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
A data structure for representing an item (song, URL, video) within an iTunes |
38
|
|
|
|
|
|
|
library. Use this along with Mac::iTunes::Library to create an iTunes library |
39
|
|
|
|
|
|
|
from which other information can be gleaned. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 EXPORT |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
None by default. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 METHODS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 new() |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Creates a new Mac::iTunes::Library::Item object that can store all of the data |
50
|
|
|
|
|
|
|
of an iTunes library item. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $rec = Mac::iTunes::Library::Item->new(); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
The constructor can also be called initializing any number of the attributes of |
55
|
|
|
|
|
|
|
an item |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $rec = Mac::iTunes::Library::Item->new( |
58
|
|
|
|
|
|
|
'Track ID' => '73', |
59
|
|
|
|
|
|
|
'Name' => 'Josie', |
60
|
|
|
|
|
|
|
'Artist' => 'blink-182', |
61
|
|
|
|
|
|
|
'Album Artist' => 'blink-182', |
62
|
|
|
|
|
|
|
'Composer' => 'blink-182', |
63
|
|
|
|
|
|
|
'Album' => 'Dude Ranch', |
64
|
|
|
|
|
|
|
'Grouping' => 'Alternative Rock, 00s Rock' |
65
|
|
|
|
|
|
|
'Genre' => 'Pop Punk', |
66
|
|
|
|
|
|
|
'Kind' => 'MPEG audio file', |
67
|
|
|
|
|
|
|
'Size' => 31337, |
68
|
|
|
|
|
|
|
'Total Time' => 31337, |
69
|
|
|
|
|
|
|
'Year' => '2007', |
70
|
|
|
|
|
|
|
'Date Modified' => '2007-01-01T01:01:01Z', |
71
|
|
|
|
|
|
|
'Date Added' => '2007-01-01T01:01:01Z', |
72
|
|
|
|
|
|
|
'Bit Rate' => 256, |
73
|
|
|
|
|
|
|
'Sample Rate' => 44100, |
74
|
|
|
|
|
|
|
'Play Count' => 1, |
75
|
|
|
|
|
|
|
'Play Date' => -1167613261, |
76
|
|
|
|
|
|
|
'Play Date UTC' => '2007-01-01T01:01:01Z', |
77
|
|
|
|
|
|
|
'Skip Count' => 1, |
78
|
|
|
|
|
|
|
'Skip Count UTC' => '2007-01-01T01:01:01Z', |
79
|
|
|
|
|
|
|
'Rating' => 50, |
80
|
|
|
|
|
|
|
'Album Rating' => 50, |
81
|
|
|
|
|
|
|
'Album Rating Computed' => 1, |
82
|
|
|
|
|
|
|
'Compilation' => 1, |
83
|
|
|
|
|
|
|
'Persistent ID' => 'DAC2FC501CCA2031', |
84
|
|
|
|
|
|
|
'Track Type' => 'File', |
85
|
|
|
|
|
|
|
'Location' => 'file://localhost/Users/dinomite/Music/blink-182/Dude%20Ranch/Josie.mp3', |
86
|
|
|
|
|
|
|
'File Folder Count' => 4, |
87
|
|
|
|
|
|
|
'Library Folder Count' => 1 |
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub new { |
93
|
5
|
|
|
5
|
1
|
74
|
my $class = shift; |
94
|
5
|
|
|
|
|
28
|
my %params = @_; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# Initialize |
97
|
5
|
|
|
|
|
147
|
my $self = { |
98
|
|
|
|
|
|
|
'Track ID' => undef, |
99
|
|
|
|
|
|
|
'Name' => undef, |
100
|
|
|
|
|
|
|
'Artist' => undef, |
101
|
|
|
|
|
|
|
'Album Artist' => undef, |
102
|
|
|
|
|
|
|
'Composer' => undef, |
103
|
|
|
|
|
|
|
'Album' => undef, |
104
|
|
|
|
|
|
|
'Grouping' => undef, |
105
|
|
|
|
|
|
|
'Genre' => undef, |
106
|
|
|
|
|
|
|
'Kind' => undef, |
107
|
|
|
|
|
|
|
'Size' => undef, |
108
|
|
|
|
|
|
|
'Total Time' => undef, |
109
|
|
|
|
|
|
|
'Year' => undef, |
110
|
|
|
|
|
|
|
'Date Modified' => undef, |
111
|
|
|
|
|
|
|
'Date Added' => undef, |
112
|
|
|
|
|
|
|
'Bit Rate' => undef, |
113
|
|
|
|
|
|
|
'Comments' => undef, |
114
|
|
|
|
|
|
|
'Sample Rate' => undef, |
115
|
|
|
|
|
|
|
'Play Count' => undef, |
116
|
|
|
|
|
|
|
'Play Date' => undef, |
117
|
|
|
|
|
|
|
'Play Date UTC' => undef, |
118
|
|
|
|
|
|
|
'Release Date' => undef, |
119
|
|
|
|
|
|
|
'Skip Count' => undef, |
120
|
|
|
|
|
|
|
'Skip Count UTC' => undef, |
121
|
|
|
|
|
|
|
'Rating' => undef, |
122
|
|
|
|
|
|
|
'Album Rating' => undef, |
123
|
|
|
|
|
|
|
'Album Rating Computed' => undef, |
124
|
|
|
|
|
|
|
'Compilation' => undef, |
125
|
|
|
|
|
|
|
'Persistent ID' => undef, |
126
|
|
|
|
|
|
|
'Track Type' => undef, |
127
|
|
|
|
|
|
|
'iTunesU' => undef, |
128
|
|
|
|
|
|
|
'Location' => undef, |
129
|
|
|
|
|
|
|
'File Folder Count' => undef, |
130
|
|
|
|
|
|
|
'Library Folder Count' => undef, |
131
|
|
|
|
|
|
|
'Track Count' => undef, |
132
|
|
|
|
|
|
|
'Track Number' => undef, |
133
|
|
|
|
|
|
|
}; |
134
|
|
|
|
|
|
|
|
135
|
5
|
|
|
|
|
18
|
bless $self, $class; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
# Deal with parameters |
138
|
5
|
|
|
|
|
20
|
foreach my $param (keys %params) { |
139
|
39
|
50
|
|
|
|
78
|
next unless (defined $param); |
140
|
|
|
|
|
|
|
|
141
|
39
|
100
|
|
|
|
418
|
if ($param eq 'Track ID') { trackID($self, $params{'Track ID'}) } |
|
5
|
100
|
|
|
|
18
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
142
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Name') { name($self, $params{'Name'}) } |
143
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Artist') { artist($self, $params{'Artist'}) } |
144
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Album Artist') { albumArtist($self, $params{'Album Artist'}) } |
145
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Composer') { composer($self, $params{'Composer'}) } |
146
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Album') { album($self, $params{'Album'}) } |
147
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Grouping') { grouping($self, $params{'Grouping'}) } |
148
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Genre') { genre($self, $params{'Genre'}) } |
149
|
1
|
|
|
|
|
9
|
elsif ($param eq 'Kind') { kind($self, $params{'Kind'}) } |
150
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Size') { size($self, $params{'Size'}) } |
151
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Total Time') { totalTime($self, $params{'Total Time'}) } |
152
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Year') { year($self, $params{'Year'}) } |
153
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Date Modified') { dateModified($self, $params{'Date Modified'}) } |
154
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Date Added') { dateAdded($self, $params{'Date Added'}) } |
155
|
1
|
|
|
|
|
7
|
elsif ($param eq 'Bit Rate') { bitRate($self, $params{'Bit Rate'}) } |
156
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Comments') { comments($self, $params{'Comments'}) } |
157
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Sample Rate') { sampleRate($self, $params{'Sample Rate'}) } |
158
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Play Count') { playCount($self, $params{'Play Count'}) } |
159
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Play Date') { playDate($self, $params{'Play Date'}) } |
160
|
1
|
|
|
|
|
3
|
elsif ($param eq 'Play Date UTC') { playDateUTC($self, $params{'Play Date UTC'}) } |
161
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Release Date') { releaseDate($self, $params{'Release Date'}) } |
162
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Skip Count') { skipCount($self, $params{'Skip Count'}) } |
163
|
1
|
|
|
|
|
3
|
elsif ($param eq 'Skip Date') { skipDate($self, $params{'Skip Date'}) } |
164
|
1
|
|
|
|
|
7
|
elsif ($param eq 'Rating') { rating($self, $params{'Rating'}) } |
165
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Album Rating') { albumRating($self, $params{'Album Rating'}) } |
166
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Album Rating Computed') { albumRatingComputed($self, $params{'Album Rating Computed'}) } |
167
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Compilation') { compilation($self, $params{'Compilation'}) } |
168
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Persistent ID') { persistentID($self, $params{'Persistent ID'}) } |
169
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Track Type') { trackType($self, $params{'Track Type'}) } |
170
|
1
|
|
|
|
|
4
|
elsif ($param eq 'iTunesU') { iTunesU($self, $params{'iTunesU'}) } |
171
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Location') { location($self, $params{'Location'}) } |
172
|
1
|
|
|
|
|
10
|
elsif ($param eq 'File Folder Count') { fileFolderCount($self, $params{'File Folder Count'}) } |
173
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Library Folder Count') { libraryFolderCount($self, $params{'Library Folder Count'}) } |
174
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Track Count') { trackCount($self, $params{'Track Count'}) } |
175
|
1
|
|
|
|
|
4
|
elsif ($param eq 'Track Number') { trackNumber($self, $params{'Track Number'}) } |
176
|
0
|
|
|
|
|
0
|
else { print "Param that I can't handle: $param\n" } |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
5
|
|
|
|
|
32
|
return $self; |
180
|
|
|
|
|
|
|
} #new |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# Clean up |
183
|
0
|
|
|
0
|
|
0
|
sub DESTROY { |
184
|
|
|
|
|
|
|
# Nothing to do. |
185
|
|
|
|
|
|
|
} #DESTROY |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 trackID( $id ) |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Get/set the Track ID attribute for this item. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub trackID { |
194
|
10
|
|
|
10
|
1
|
1276
|
my $self = shift; |
195
|
|
|
|
|
|
|
|
196
|
10
|
100
|
|
|
|
32
|
if (@_) { |
197
|
5
|
|
|
|
|
7
|
my $id = shift; |
198
|
5
|
50
|
|
|
|
20
|
return carp "$id isn't a valid Track ID" unless _checkNum($id); |
199
|
5
|
|
|
|
|
20
|
$self->{'Track ID'} = $id; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
10
|
|
|
|
|
37
|
return $self->{'Track ID'}; |
203
|
|
|
|
|
|
|
} #trackID |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
# Get/set the Name for this item |
206
|
|
|
|
|
|
|
sub name { |
207
|
2
|
|
|
2
|
0
|
9
|
my $self = shift; |
208
|
|
|
|
|
|
|
|
209
|
2
|
100
|
|
|
|
7
|
if (@_) { |
210
|
1
|
|
|
|
|
2
|
my $name = shift; |
211
|
1
|
50
|
|
|
|
4
|
return carp "$name isn't a valid Name" unless ($name =~ /.*/); |
212
|
1
|
|
|
|
|
3
|
$self->{'Name'} = $name; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
2
|
|
|
|
|
13
|
return $self->{'Name'}; |
216
|
|
|
|
|
|
|
} #name |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head2 artist( $artist ) |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Get/set the Artist attribute for this item. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=cut |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
sub artist { |
225
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
226
|
|
|
|
|
|
|
|
227
|
2
|
100
|
|
|
|
7
|
if (@_) { |
228
|
1
|
|
|
|
|
2
|
my $artist = shift; |
229
|
1
|
50
|
|
|
|
5
|
return carp "$artist isn't a valid Artist" unless ($artist =~ /.*/); |
230
|
1
|
|
|
|
|
2
|
$self->{'Artist'} = $artist; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
2
|
|
|
|
|
8
|
return $self->{'Artist'}; |
234
|
|
|
|
|
|
|
} #artist |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head2 albumArtist( $albumArtist ) |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
Get/set the Album Artist attribute for this item. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=cut |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
sub albumArtist { |
243
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
244
|
|
|
|
|
|
|
|
245
|
2
|
100
|
|
|
|
7
|
if (@_) { |
246
|
1
|
|
|
|
|
2
|
my $albumArtist = shift; |
247
|
1
|
50
|
|
|
|
4
|
return carp "$albumArtist isn't a valid Album Artist" |
248
|
|
|
|
|
|
|
unless ($albumArtist =~ /.*/); |
249
|
1
|
|
|
|
|
30
|
$self->{'Album Artist'} = $albumArtist; |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
|
252
|
2
|
|
|
|
|
9
|
return $self->{'Album Artist'}; |
253
|
|
|
|
|
|
|
} #albumArtist |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=head2 composer( $composer ) |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
Get/set the Composer attribute for this item. |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=cut |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
sub composer { |
262
|
2
|
|
|
2
|
1
|
6
|
my $self = shift; |
263
|
|
|
|
|
|
|
|
264
|
2
|
100
|
|
|
|
6
|
if (@_) { |
265
|
1
|
|
|
|
|
2
|
my $composer = shift; |
266
|
1
|
50
|
|
|
|
4
|
return carp "$composer isn't a valid Composer" |
267
|
|
|
|
|
|
|
unless ($composer =~ /.*/); |
268
|
1
|
|
|
|
|
12
|
$self->{'Composer'} = $composer; |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
|
271
|
2
|
|
|
|
|
9
|
return $self->{'Composer'}; |
272
|
|
|
|
|
|
|
} #composer |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=head2 album( $album ) |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
Get/set the Album attribute for this item. |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=cut |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
sub album { |
281
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
282
|
|
|
|
|
|
|
|
283
|
2
|
100
|
|
|
|
7
|
if (@_) { |
284
|
1
|
|
|
|
|
2
|
my $album = shift; |
285
|
1
|
50
|
|
|
|
5
|
return carp "$album isn't a valid Album" unless ($album =~ /.*/); |
286
|
1
|
|
|
|
|
2
|
$self->{'Album'} = $album; |
287
|
|
|
|
|
|
|
} |
288
|
|
|
|
|
|
|
|
289
|
2
|
|
|
|
|
9
|
return $self->{'Album'}; |
290
|
|
|
|
|
|
|
} #album |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=head2 grouping( $grouping ) |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
Get/set the Grouping attribute for this item. |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
Note: Grouping is intended to be used as a collection of music items below |
297
|
|
|
|
|
|
|
the level of an album (such as on a classical music release) where items |
298
|
|
|
|
|
|
|
are individual movements of a larger work. They are more commonly |
299
|
|
|
|
|
|
|
used as a comma delimited list of tags to build smart playlists. |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=cut |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
sub grouping { |
304
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
305
|
|
|
|
|
|
|
|
306
|
2
|
100
|
|
|
|
7
|
if (@_) { |
307
|
1
|
|
|
|
|
2
|
my $grouping = shift; |
308
|
1
|
50
|
|
|
|
11
|
return carp "$grouping isn't a valid Grouping" unless ($grouping =~ /.*/); |
309
|
1
|
|
|
|
|
3
|
$self->{'Grouping'} = $grouping; |
310
|
|
|
|
|
|
|
} |
311
|
|
|
|
|
|
|
|
312
|
2
|
|
|
|
|
38
|
return $self->{'Grouping'}; |
313
|
|
|
|
|
|
|
} #grouping |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=head2 genre( $genre ) |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
Get/set the Genre attribute for this item. |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=cut |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
sub genre { |
322
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
323
|
|
|
|
|
|
|
|
324
|
2
|
100
|
|
|
|
7
|
if (@_) { |
325
|
1
|
|
|
|
|
1
|
my $genre = shift; |
326
|
1
|
50
|
|
|
|
5
|
return carp "$genre isn't a valid Genre" unless ($genre =~ /.*/); |
327
|
1
|
|
|
|
|
2
|
$self->{'Genre'} = $genre; |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
2
|
|
|
|
|
8
|
return $self->{'Genre'}; |
331
|
|
|
|
|
|
|
} #genre |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=head2 kind( $kind ) |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
Get/set the Kind ("MPEG audio file", etc.) attribute for this item. |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=cut |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
sub kind { |
340
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
341
|
|
|
|
|
|
|
|
342
|
2
|
100
|
|
|
|
7
|
if (@_) { |
343
|
1
|
|
|
|
|
2
|
my $kind = shift; |
344
|
1
|
50
|
|
|
|
9
|
return carp "$kind isn't a valid Kind" |
345
|
|
|
|
|
|
|
unless ($kind =~ /(MPEG|AAC|MPEG-4|Audible) ?(audio|video)? (file|stream)/); |
346
|
1
|
|
|
|
|
3
|
$self->{'Kind'} = $kind; |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
|
349
|
2
|
|
|
|
|
8
|
return $self->{'Kind'}; |
350
|
|
|
|
|
|
|
} #kind |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
=head2 size( $size ) |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
Get/set the Size attribute for this item. |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=cut |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
sub size { |
359
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
360
|
|
|
|
|
|
|
|
361
|
2
|
100
|
|
|
|
9
|
if (@_) { |
362
|
1
|
|
|
|
|
1
|
my $size = shift; |
363
|
1
|
50
|
|
|
|
3
|
return carp "$size isn't a valid Size" unless _checkNum($size); |
364
|
1
|
|
|
|
|
4
|
$self->{'Size'} = $size; |
365
|
|
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
|
367
|
2
|
|
|
|
|
8
|
return $self->{'Size'}; |
368
|
|
|
|
|
|
|
} #size |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
=head2 totalTime( $totalTime ) |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
Get/set the Total Time attribute for this item. |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
=cut |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
sub totalTime { |
377
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
378
|
|
|
|
|
|
|
|
379
|
2
|
100
|
|
|
|
6
|
if (@_) { |
380
|
1
|
|
|
|
|
1
|
my $totalTime = shift; |
381
|
1
|
50
|
|
|
|
3
|
return carp "$totalTime isn't a valid Total Time" |
382
|
|
|
|
|
|
|
unless _checkNum($totalTime); |
383
|
1
|
|
|
|
|
3
|
$self->{'Total Time'} = $totalTime; |
384
|
|
|
|
|
|
|
} |
385
|
|
|
|
|
|
|
|
386
|
2
|
|
|
|
|
7
|
return $self->{'Total Time'}; |
387
|
|
|
|
|
|
|
} #totalTime |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
=head2 year( $year ) |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
Get/set the Year attribute for this item. |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=cut |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
sub year { |
396
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
397
|
|
|
|
|
|
|
|
398
|
2
|
100
|
|
|
|
7
|
if (@_) { |
399
|
1
|
|
|
|
|
6
|
my $year = shift; |
400
|
1
|
50
|
|
|
|
4
|
return carp "$year isn't a valid Year" unless ($year =~ /\d{4}/); |
401
|
1
|
|
|
|
|
2
|
$self->{'Year'} = $year; |
402
|
|
|
|
|
|
|
} |
403
|
|
|
|
|
|
|
|
404
|
2
|
|
|
|
|
9
|
return $self->{'Year'}; |
405
|
|
|
|
|
|
|
} #year |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
=head2 dateModified( $dateModified ) |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
Get/set the Date Modified attribute for this item. |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
=cut |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
sub dateModified { |
414
|
2
|
|
|
2
|
1
|
11
|
my $self = shift; |
415
|
|
|
|
|
|
|
|
416
|
2
|
100
|
|
|
|
14
|
if (@_) { |
417
|
1
|
|
|
|
|
2
|
my $dateModified = shift; |
418
|
1
|
50
|
|
|
|
2
|
return carp "$dateModified isn't a valid Date Modified" |
419
|
|
|
|
|
|
|
unless _checkDate($dateModified); |
420
|
1
|
|
|
|
|
2
|
$self->{'Date Modified'} = $dateModified; |
421
|
|
|
|
|
|
|
} |
422
|
|
|
|
|
|
|
|
423
|
2
|
|
|
|
|
9
|
return $self->{'Date Modified'}; |
424
|
|
|
|
|
|
|
} #dateModified |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
=head2 dateAdded( $dateAdded ) |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
Get/set the Date Added attribute for this item. |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
=cut |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
sub dateAdded { |
433
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
434
|
|
|
|
|
|
|
|
435
|
2
|
100
|
|
|
|
8
|
if (@_) { |
436
|
1
|
|
|
|
|
1
|
my $dateAdded = shift; |
437
|
1
|
50
|
|
|
|
3
|
return carp "$dateAdded isn't a valid Date Added" |
438
|
|
|
|
|
|
|
unless _checkDate($dateAdded); |
439
|
1
|
|
|
|
|
3
|
$self->{'Date Added'} = $dateAdded; |
440
|
|
|
|
|
|
|
} |
441
|
|
|
|
|
|
|
|
442
|
2
|
|
|
|
|
8
|
return $self->{'Date Added'}; |
443
|
|
|
|
|
|
|
} #dateAdded |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=head2 bitRate( $bitRate ) |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
Get/set the Date Added attribute for this item. |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=cut |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
sub bitRate { |
452
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
453
|
|
|
|
|
|
|
|
454
|
2
|
100
|
|
|
|
15
|
if (@_) { |
455
|
1
|
|
|
|
|
2
|
my $bitRate = shift; |
456
|
1
|
50
|
|
|
|
5
|
return carp "$bitRate isn't a valid Bit Rate" |
457
|
|
|
|
|
|
|
unless ($bitRate =~ /\d{2,3}/); |
458
|
1
|
|
|
|
|
3
|
$self->{'Bit Rate'} = $bitRate; |
459
|
|
|
|
|
|
|
} |
460
|
|
|
|
|
|
|
|
461
|
2
|
|
|
|
|
9
|
return $self->{'Bit Rate'}; |
462
|
|
|
|
|
|
|
} #bitRate |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
=head2 comments( $comments ) |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
Get/set the Comments attribute for this item. |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
=cut |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
sub comments { |
471
|
2
|
|
|
2
|
1
|
6
|
my $self = shift; |
472
|
|
|
|
|
|
|
|
473
|
2
|
100
|
|
|
|
7
|
if (@_) { |
474
|
1
|
|
|
|
|
2
|
my $comments = shift; |
475
|
1
|
50
|
|
|
|
17
|
return carp "$comments isn't a valid Comments" unless ($comments =~ /.*/); |
476
|
1
|
|
|
|
|
3
|
$self->{'Comments'} = $comments; |
477
|
|
|
|
|
|
|
} |
478
|
|
|
|
|
|
|
|
479
|
2
|
|
|
|
|
29
|
return $self->{'Comments'}; |
480
|
|
|
|
|
|
|
} #comment |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
=head2 sampleRate( $sampleRate ) |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
Get/set the Sample Rate attribute for this item. |
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
=cut |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
sub sampleRate { |
489
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
490
|
|
|
|
|
|
|
|
491
|
2
|
100
|
|
|
|
6
|
if (@_) { |
492
|
1
|
|
|
|
|
2
|
my $sampleRate = shift; |
493
|
1
|
50
|
|
|
|
4
|
return carp "$sampleRate isn't a valid Sample Rate" |
494
|
|
|
|
|
|
|
unless ($sampleRate =~ /\d{5}/); |
495
|
1
|
|
|
|
|
3
|
$self->{'Sample Rate'} = $sampleRate; |
496
|
|
|
|
|
|
|
} |
497
|
|
|
|
|
|
|
|
498
|
2
|
|
|
|
|
8
|
return $self->{'Sample Rate'}; |
499
|
|
|
|
|
|
|
} #sampleRate |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
=head2 playCount( $playCount ) |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
Get/set the Play Count attribute for this item. |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=cut |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
sub playCount { |
508
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
509
|
|
|
|
|
|
|
|
510
|
2
|
100
|
|
|
|
7
|
if (@_) { |
511
|
1
|
|
|
|
|
1
|
my $playCount = shift; |
512
|
1
|
50
|
|
|
|
5
|
return carp "$playCount isn't a valid Play Count" |
513
|
|
|
|
|
|
|
unless ($playCount =~ /\d{1,2}/); |
514
|
1
|
|
|
|
|
2
|
$self->{'Play Count'} = $playCount; |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
|
517
|
2
|
|
|
|
|
9
|
return $self->{'Play Count'}; |
518
|
|
|
|
|
|
|
} #playCount |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
=head2 playDate( $playDate ) |
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
Get/set the Play Date attribute for this item. |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
=cut |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
sub playDate { |
527
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
528
|
|
|
|
|
|
|
|
529
|
2
|
100
|
|
|
|
8
|
if (@_) { |
530
|
1
|
|
|
|
|
1
|
my $playDate = shift; |
531
|
1
|
50
|
|
|
|
5
|
return carp "$playDate isn't a valid Play Date" |
532
|
|
|
|
|
|
|
unless ($playDate =~ /-\d{10}/); |
533
|
1
|
|
|
|
|
3
|
$self->{'Play Date'} = $playDate; |
534
|
|
|
|
|
|
|
} |
535
|
|
|
|
|
|
|
|
536
|
2
|
|
|
|
|
7
|
return $self->{'Play Date'}; |
537
|
|
|
|
|
|
|
} #playDate |
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
=head2 playDateUTC( $playDateUTC ) |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
Get/set the Play Date UTC attribute for this item. |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
=cut |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
sub playDateUTC { |
546
|
2
|
|
|
2
|
1
|
6
|
my $self = shift; |
547
|
|
|
|
|
|
|
|
548
|
2
|
100
|
|
|
|
7
|
if (@_) { |
549
|
1
|
|
|
|
|
2
|
my $playDateUTC = shift; |
550
|
1
|
50
|
|
|
|
4
|
return carp "$playDateUTC isn't a valid Play Date UTC" |
551
|
|
|
|
|
|
|
unless _checkDate($playDateUTC); |
552
|
1
|
|
|
|
|
3
|
$self->{'Play Date UTC'} = $playDateUTC; |
553
|
|
|
|
|
|
|
} |
554
|
|
|
|
|
|
|
|
555
|
2
|
|
|
|
|
8
|
return $self->{'Play Date UTC'}; |
556
|
|
|
|
|
|
|
} #playDateUTC |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
=head2 releaseDate( $releaseDate ) |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
Get/set the Release Date attribute for this item. |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
=cut |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
sub releaseDate { |
565
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
566
|
|
|
|
|
|
|
|
567
|
2
|
100
|
|
|
|
7
|
if (@_) { |
568
|
1
|
|
|
|
|
2
|
my $releaseDate = shift; |
569
|
1
|
50
|
|
|
|
3
|
return carp "$releaseDate isn't a valid Release Date" |
570
|
|
|
|
|
|
|
unless _checkDate($releaseDate); |
571
|
1
|
|
|
|
|
3
|
$self->{'Release Date'} = $releaseDate; |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
|
574
|
2
|
|
|
|
|
9
|
return $self->{'Release Date'}; |
575
|
|
|
|
|
|
|
} #releaseDate |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
=head2 skipCount( $skipCount ) |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
Get/set the Skip Count attribute for this item. |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
=cut |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
sub skipCount { |
584
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
585
|
|
|
|
|
|
|
|
586
|
2
|
100
|
|
|
|
7
|
if (@_) { |
587
|
1
|
|
|
|
|
2
|
my $skipCount = shift; |
588
|
1
|
50
|
|
|
|
6
|
return carp "$skipCount isn't a valid Skip Count" |
589
|
|
|
|
|
|
|
unless ($skipCount =~ /\d{1,2}/); |
590
|
1
|
|
|
|
|
2
|
$self->{'Skip Count'} = $skipCount; |
591
|
|
|
|
|
|
|
} |
592
|
|
|
|
|
|
|
|
593
|
2
|
|
|
|
|
8
|
return $self->{'Skip Count'}; |
594
|
|
|
|
|
|
|
} #skipCount |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
=head2 skipDate( $skipDate ) |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
Get/set the Skip Date attribute for this item. |
599
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
=cut |
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
sub skipDate { |
603
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
604
|
|
|
|
|
|
|
|
605
|
2
|
100
|
|
|
|
6
|
if (@_) { |
606
|
1
|
|
|
|
|
2
|
my $skipDate = shift; |
607
|
1
|
50
|
|
|
|
9
|
return carp "$skipDate isn't a valid Skip Date" |
608
|
|
|
|
|
|
|
unless _checkDate($skipDate); |
609
|
1
|
|
|
|
|
3
|
$self->{'Skip Date'} = $skipDate; |
610
|
|
|
|
|
|
|
} |
611
|
|
|
|
|
|
|
|
612
|
2
|
|
|
|
|
7
|
return $self->{'Skip Date'}; |
613
|
|
|
|
|
|
|
} #skipDate |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
=head2 rating( $rating ) |
616
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
Get/set the Rating attribute for this item. |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
=cut |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
sub rating { |
622
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
623
|
|
|
|
|
|
|
|
624
|
2
|
100
|
|
|
|
7
|
if (@_) { |
625
|
1
|
|
|
|
|
1
|
my $rating = shift; |
626
|
1
|
50
|
|
|
|
6
|
return carp "$rating isn't a valid Rating" |
627
|
|
|
|
|
|
|
unless ($rating =~ /\d{1,3}/); |
628
|
1
|
|
|
|
|
2
|
$self->{'Rating'} = $rating; |
629
|
|
|
|
|
|
|
} |
630
|
|
|
|
|
|
|
|
631
|
2
|
|
|
|
|
9
|
return $self->{'Rating'}; |
632
|
|
|
|
|
|
|
} #rating |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
=head2 albumRating( $albumRating ) |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
Get/set the Album Rating attribute for this item. |
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
=cut |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
sub albumRating { |
641
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
642
|
|
|
|
|
|
|
|
643
|
2
|
100
|
|
|
|
7
|
if (@_) { |
644
|
1
|
|
|
|
|
2
|
my $albumRating = shift; |
645
|
1
|
50
|
|
|
|
5
|
return carp "$albumRating isn't a valid Album Rating" |
646
|
|
|
|
|
|
|
unless ($albumRating =~ /\d{1,3}/); |
647
|
1
|
|
|
|
|
2
|
$self->{'Album Rating'} = $albumRating; |
648
|
|
|
|
|
|
|
} |
649
|
|
|
|
|
|
|
|
650
|
2
|
|
|
|
|
8
|
return $self->{'Album Rating'}; |
651
|
|
|
|
|
|
|
} #albumRating |
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
=head2 albumRatingComputed( $albumRatingComputed ) |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
Get/set the Album Rating Computed attribute for this item. |
656
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
=cut |
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
sub albumRatingComputed { |
660
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
661
|
|
|
|
|
|
|
|
662
|
2
|
100
|
|
|
|
10
|
if (@_) { |
663
|
1
|
|
|
|
|
2
|
my $albumRatingComputed = shift; |
664
|
1
|
|
|
|
|
3
|
$self->{'Album Rating Computed'} = $albumRatingComputed; |
665
|
|
|
|
|
|
|
} |
666
|
|
|
|
|
|
|
|
667
|
2
|
|
|
|
|
8
|
return $self->{'Album Rating Computed'}; |
668
|
|
|
|
|
|
|
} #albumRatingComputed |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
=head2 compilation( $albumRatingComputed ) |
671
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
Get/set the Compilation attribute for this item. |
673
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
=cut |
675
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
sub compilation { |
677
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
678
|
|
|
|
|
|
|
|
679
|
2
|
100
|
|
|
|
7
|
if (@_) { |
680
|
1
|
|
|
|
|
2
|
my $compilation = shift; |
681
|
1
|
|
|
|
|
2
|
$self->{'Compilation'} = $compilation; |
682
|
|
|
|
|
|
|
} |
683
|
|
|
|
|
|
|
|
684
|
2
|
|
|
|
|
8
|
return $self->{'Compilation'}; |
685
|
|
|
|
|
|
|
} #compilation |
686
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
=head2 persistentID( $persistentID ) |
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
Get/set the Persistent ID attribute for this item. |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
=cut |
692
|
|
|
|
|
|
|
|
693
|
|
|
|
|
|
|
sub persistentID { |
694
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
695
|
|
|
|
|
|
|
|
696
|
2
|
100
|
|
|
|
6
|
if (@_) { |
697
|
1
|
|
|
|
|
2
|
my $persistentID = shift; |
698
|
1
|
50
|
|
|
|
4
|
return carp "$persistentID isn't a valid Persistent ID" |
699
|
|
|
|
|
|
|
unless ($persistentID =~ /\w{16}/); |
700
|
1
|
|
|
|
|
8
|
$self->{'Persistent ID'} = $persistentID; |
701
|
|
|
|
|
|
|
} |
702
|
|
|
|
|
|
|
|
703
|
2
|
|
|
|
|
8
|
return $self->{'Persistent ID'}; |
704
|
|
|
|
|
|
|
} #persistentID |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
=head2 trackType( $trackType ) |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
Get/set the Track Type attribute for this item. |
709
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
=cut |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
sub trackType { |
713
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
714
|
|
|
|
|
|
|
|
715
|
2
|
100
|
|
|
|
13
|
if (@_) { |
716
|
1
|
|
|
|
|
2
|
my $trackType = shift; |
717
|
1
|
50
|
|
|
|
8
|
return carp "$trackType isn't a valid Track Type" |
718
|
|
|
|
|
|
|
unless ($trackType =~ /(File|URL)/); |
719
|
1
|
|
|
|
|
2
|
$self->{'Track Type'} = $trackType; |
720
|
|
|
|
|
|
|
} |
721
|
|
|
|
|
|
|
|
722
|
2
|
|
|
|
|
8
|
return $self->{'Track Type'}; |
723
|
|
|
|
|
|
|
} #trackType |
724
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
=head2 iTunesU( $trackType ) |
726
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
Get/set the iTunesU attribute for this item. |
728
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
=cut |
730
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
sub iTunesU { |
732
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
733
|
|
|
|
|
|
|
|
734
|
2
|
100
|
|
|
|
8
|
if (@_) { |
735
|
1
|
|
|
|
|
2
|
my $iTunesU = shift; |
736
|
1
|
50
|
|
|
|
11
|
return carp "$iTunesU isn't a valid iTunesU" |
737
|
|
|
|
|
|
|
unless ($iTunesU =~ /(Y|N)/); |
738
|
1
|
|
|
|
|
10
|
$self->{'iTunesU'} = $iTunesU; |
739
|
|
|
|
|
|
|
} |
740
|
|
|
|
|
|
|
|
741
|
2
|
|
|
|
|
8
|
return $self->{'iTunesU'}; |
742
|
|
|
|
|
|
|
} #iTunesU |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
=head2 location( $location ) |
746
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
Get/set the Location attribute for this item. |
748
|
|
|
|
|
|
|
|
749
|
|
|
|
|
|
|
=cut |
750
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
sub location { |
752
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
753
|
|
|
|
|
|
|
|
754
|
2
|
100
|
|
|
|
18
|
if (@_) { |
755
|
1
|
|
|
|
|
2
|
my $location = shift; |
756
|
1
|
50
|
|
|
|
5
|
return carp "$location isn't a valid Location" |
757
|
|
|
|
|
|
|
unless ($location =~ /.*/); |
758
|
1
|
|
|
|
|
2
|
$self->{'Location'} = $location; |
759
|
|
|
|
|
|
|
} |
760
|
|
|
|
|
|
|
|
761
|
2
|
|
|
|
|
8
|
return $self->{'Location'}; |
762
|
|
|
|
|
|
|
} #location |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
=head2 fileFolderCount( $fileFolderCount ) |
765
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
Get/set the File Folder Count attribute for this item. |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
=cut |
769
|
|
|
|
|
|
|
# Get/set the File Folder Count for this item |
770
|
|
|
|
|
|
|
sub fileFolderCount { |
771
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
772
|
|
|
|
|
|
|
|
773
|
2
|
100
|
|
|
|
8
|
if (@_) { |
774
|
1
|
|
|
|
|
2
|
my $fileFolderCount = shift; |
775
|
1
|
50
|
|
|
|
5
|
return carp "$fileFolderCount isn't a valid File Folder Count" |
776
|
|
|
|
|
|
|
unless _checkNum($fileFolderCount); |
777
|
1
|
|
|
|
|
3
|
$self->{'File Folder Count'} = $fileFolderCount; |
778
|
|
|
|
|
|
|
} |
779
|
|
|
|
|
|
|
|
780
|
2
|
|
|
|
|
7
|
return $self->{'File Folder Count'}; |
781
|
|
|
|
|
|
|
} #fileFolderCount |
782
|
|
|
|
|
|
|
|
783
|
|
|
|
|
|
|
=head2 libraryFolderCount( $libraryFolderCount ) |
784
|
|
|
|
|
|
|
|
785
|
|
|
|
|
|
|
Get/set the Library Folder Count attribute for this item. |
786
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
=cut |
788
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
sub libraryFolderCount { |
790
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
791
|
|
|
|
|
|
|
|
792
|
2
|
100
|
|
|
|
13
|
if (@_) { |
793
|
1
|
|
|
|
|
2
|
my $libraryFolderCount = shift; |
794
|
1
|
50
|
|
|
|
3
|
return carp "$libraryFolderCount isn't a valid Library Folder Count" |
795
|
|
|
|
|
|
|
unless _checkNum($libraryFolderCount); |
796
|
1
|
|
|
|
|
2
|
$self->{'Library Folder Count'} = $libraryFolderCount; |
797
|
|
|
|
|
|
|
} |
798
|
|
|
|
|
|
|
|
799
|
2
|
|
|
|
|
8
|
return $self->{'Library Folder Count'}; |
800
|
|
|
|
|
|
|
} #libraryFolderCount |
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
=head2 trackCount( $trackCount ) |
804
|
|
|
|
|
|
|
|
805
|
|
|
|
|
|
|
Get/set the Track Count attribute for this item. |
806
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
=cut |
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
sub trackCount { |
810
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
811
|
|
|
|
|
|
|
|
812
|
2
|
100
|
|
|
|
7
|
if (@_) { |
813
|
1
|
|
|
|
|
1
|
my $trackCount = shift; |
814
|
1
|
50
|
|
|
|
3
|
return carp "$trackCount isn't a valid Track Count" |
815
|
|
|
|
|
|
|
unless _checkNum($trackCount); |
816
|
1
|
|
|
|
|
2
|
$self->{'Track Count'} = $trackCount; |
817
|
|
|
|
|
|
|
} |
818
|
|
|
|
|
|
|
|
819
|
2
|
|
|
|
|
25
|
return $self->{'Track Count'}; |
820
|
|
|
|
|
|
|
} #trackCount |
821
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
=head2 trackNumber( $trackNumber ) |
824
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
Get/set the Track Number attribute for this item. |
826
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
=cut |
828
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
sub trackNumber { |
830
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
831
|
|
|
|
|
|
|
|
832
|
2
|
100
|
|
|
|
8
|
if (@_) { |
833
|
1
|
|
|
|
|
2
|
my $trackNumber = shift; |
834
|
1
|
50
|
|
|
|
3
|
return carp "$trackNumber isn't a valid Track Number" |
835
|
|
|
|
|
|
|
unless _checkNum($trackNumber); |
836
|
1
|
|
|
|
|
3
|
$self->{'Track Number'} = $trackNumber; |
837
|
|
|
|
|
|
|
} |
838
|
|
|
|
|
|
|
|
839
|
2
|
|
|
|
|
8
|
return $self->{'Track Number'}; |
840
|
|
|
|
|
|
|
} #trackNumber |
841
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
##### Support methods ##### |
844
|
|
|
|
|
|
|
# Is it a number? |
845
|
|
|
|
|
|
|
sub _checkNum { |
846
|
11
|
|
|
11
|
|
17
|
my $digit = shift; |
847
|
|
|
|
|
|
|
|
848
|
11
|
|
|
|
|
68
|
return $digit =~ /\d*/; |
849
|
|
|
|
|
|
|
} #_checkNum |
850
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
# Is it a date? |
852
|
|
|
|
|
|
|
sub _checkDate { |
853
|
5
|
|
|
5
|
|
7
|
my $date = shift; |
854
|
|
|
|
|
|
|
|
855
|
5
|
|
|
|
|
64
|
return $date =~ /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z/; |
856
|
|
|
|
|
|
|
} #_checkDate |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
|
859
|
|
|
|
|
|
|
1; |
860
|
|
|
|
|
|
|
|
861
|
|
|
|
|
|
|
=head1 SEE ALSO |
862
|
|
|
|
|
|
|
|
863
|
|
|
|
|
|
|
L, L, |
864
|
|
|
|
|
|
|
L |
865
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
=head1 AUTHOR |
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
Drew Stephens , http://dinomite.net |
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
=over 4 |
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
=item * |
875
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
Mark Allen |
877
|
|
|
|
|
|
|
|
878
|
|
|
|
|
|
|
=item * |
879
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
Michael G Schwern |
881
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
=item * |
883
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
David Rostcheck |
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
=back |
887
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
=head1 SOURCE REPOSITORY |
889
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
http://mac-itunes.googlecode.com |
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
=head1 SVN INFO |
893
|
|
|
|
|
|
|
|
894
|
|
|
|
|
|
|
$Revision: 90 $ |
895
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
897
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
Copyright (C) 2007-2008 by Drew Stephens |
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
901
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
902
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
=cut |
905
|
|
|
|
|
|
|
__END__ |