| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mac::iTunes::Library::Playlist; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
4590
|
use 5.006; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
114
|
|
|
4
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
|
3
|
|
|
|
|
11
|
|
|
|
3
|
|
|
|
|
76
|
|
|
5
|
3
|
|
|
3
|
|
14
|
use strict; |
|
|
3
|
|
|
|
|
20
|
|
|
|
3
|
|
|
|
|
91
|
|
|
6
|
3
|
|
|
3
|
|
12
|
use Carp; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
3242
|
|
|
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::Playlist - Perl extension for representing a playlist |
|
19
|
|
|
|
|
|
|
(list of items by Track ID) within an iTunes library. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use Mac::iTunes::Library::Playlist; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Let's create a few simple items |
|
26
|
|
|
|
|
|
|
my @items = ( |
|
27
|
|
|
|
|
|
|
Mac::iTunes::Library::Item->new('Track ID' => 3), |
|
28
|
|
|
|
|
|
|
Mac::iTunes::Library::Item->new('Track ID' => 4), |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
# Create a playlist |
|
31
|
|
|
|
|
|
|
my $smartInfo =<< 'EOF'; |
|
32
|
|
|
|
|
|
|
AQEAAwAAAAIAAAAZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
|
33
|
|
|
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
|
34
|
|
|
|
|
|
|
AAAAAA== |
|
35
|
|
|
|
|
|
|
EOF |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $smartCriteria =<< 'EOF'; |
|
38
|
|
|
|
|
|
|
U0xzdAABAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
|
39
|
|
|
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
|
40
|
|
|
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkAAAABAAAAAAAAAAAAAAAAAAAAAAAA |
|
41
|
|
|
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAAAB |
|
42
|
|
|
|
|
|
|
AAAAAAAAAGQAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAA= |
|
43
|
|
|
|
|
|
|
EOF |
|
44
|
|
|
|
|
|
|
my $playlist = Mac::iTunes::Library::Playlist->new( |
|
45
|
|
|
|
|
|
|
'Name' => '5 Stars', |
|
46
|
|
|
|
|
|
|
'Playlist ID' => '10073', |
|
47
|
|
|
|
|
|
|
'Playlist Persistent ID' => '2E2D1396AF1DED73', |
|
48
|
|
|
|
|
|
|
'All Items' => 'true', |
|
49
|
|
|
|
|
|
|
'Smart Info' => $smartInfo, |
|
50
|
|
|
|
|
|
|
'Smart Criteria' => $smartCriteria, |
|
51
|
|
|
|
|
|
|
'Playlist Items' => @items, |
|
52
|
|
|
|
|
|
|
); |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Add another item to that playlist |
|
55
|
|
|
|
|
|
|
my $item = Mac::iTunes::Library::Item->new( 'Track ID' => 7 ); |
|
56
|
|
|
|
|
|
|
$playlist->addItem( $item ); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Get all of the items in the playlist |
|
59
|
|
|
|
|
|
|
my @items = $playlist->items(); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Get an item by it's ID |
|
62
|
|
|
|
|
|
|
$item = $playlist->item(3); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
A data structure for representing a playlist within an iTunes |
|
67
|
|
|
|
|
|
|
library. Use this along with Mac::iTunes::Library to create an iTunes library |
|
68
|
|
|
|
|
|
|
from which other information can be gleaned. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 EXPORT |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
None by default. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 METHODS |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 new() |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Creates a new Mac::iTunes::Playlist object that can store all of the data of an |
|
79
|
|
|
|
|
|
|
iTunes library playlist. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my $playlist = Mac::iTunes::Playlist->new(); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
The constructor can also be called with any number of attributes defined in |
|
84
|
|
|
|
|
|
|
a hash: |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
my $smartInfo =<< 'EOF'; |
|
87
|
|
|
|
|
|
|
AQEAAwAAAAIAAAAZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
|
88
|
|
|
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
|
89
|
|
|
|
|
|
|
AAAAAA== |
|
90
|
|
|
|
|
|
|
EOF |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
my $smartCriteria =<< 'EOF'; |
|
93
|
|
|
|
|
|
|
U0xzdAABAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
|
94
|
|
|
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
|
95
|
|
|
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkAAAABAAAAAAAAAAAAAAAAAAAAAAAA |
|
96
|
|
|
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAAAB |
|
97
|
|
|
|
|
|
|
AAAAAAAAAGQAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAA= |
|
98
|
|
|
|
|
|
|
EOF |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# A few simple items |
|
101
|
|
|
|
|
|
|
my @items = ( |
|
102
|
|
|
|
|
|
|
Mac::iTunes::Library::Item->new('Track ID' => 2), |
|
103
|
|
|
|
|
|
|
Mac::iTunes::Library::Item->new('Track ID' => 3), |
|
104
|
|
|
|
|
|
|
Mac::iTunes::Library::Item->new('Track ID' => 4), |
|
105
|
|
|
|
|
|
|
); |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
my $playlist = Mac::iTunes::Playlist->new( |
|
108
|
|
|
|
|
|
|
'Name' => '5 Stars', |
|
109
|
|
|
|
|
|
|
'Playlist ID' => '10073', |
|
110
|
|
|
|
|
|
|
'Playlist Persistent ID' => '2E2D1396AF1DED73', |
|
111
|
|
|
|
|
|
|
'All Items' => 'true', |
|
112
|
|
|
|
|
|
|
'Smart Info' => $smartInfo, |
|
113
|
|
|
|
|
|
|
'Smart Criteria' => $smartCriteria, |
|
114
|
|
|
|
|
|
|
'Playlist Items' => @items, |
|
115
|
|
|
|
|
|
|
); |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub new { |
|
120
|
1
|
|
|
1
|
1
|
26
|
my $class = shift; |
|
121
|
1
|
|
|
|
|
29
|
my %params = @_; |
|
122
|
|
|
|
|
|
|
|
|
123
|
1
|
|
|
|
|
6
|
my $self = { |
|
124
|
|
|
|
|
|
|
'Name' => undef, |
|
125
|
|
|
|
|
|
|
'Playlist ID' => undef, |
|
126
|
|
|
|
|
|
|
'Playlist Persistent ID' => undef, |
|
127
|
|
|
|
|
|
|
'All Items' => undef, |
|
128
|
|
|
|
|
|
|
'Smart Info' => undef, |
|
129
|
|
|
|
|
|
|
'Smart Criteria' => undef, |
|
130
|
|
|
|
|
|
|
'Playlist Items' => [], |
|
131
|
|
|
|
|
|
|
}; |
|
132
|
|
|
|
|
|
|
|
|
133
|
1
|
|
|
|
|
4
|
bless $self, $class; |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
# Deal with parameters |
|
136
|
1
|
50
|
|
|
|
4
|
if ( exists( $params{'Name'} ) ) { |
|
137
|
1
|
|
|
|
|
4
|
name( $self, $params{'Name'} ); |
|
138
|
1
|
50
|
|
|
|
5
|
} if ( exists( $params{'Playlist ID'} ) ) { |
|
139
|
1
|
|
|
|
|
3
|
playlistID( $self, $params{'Playlist ID'} ); |
|
140
|
1
|
50
|
|
|
|
4
|
} if ( exists( $params{'Playlist Persistent ID'} ) ) { |
|
141
|
1
|
|
|
|
|
3
|
playlistPersistentID( $self, $params{'Playlist Persistent ID'} ); |
|
142
|
1
|
50
|
|
|
|
4
|
} if ( exists( $params{'All Items'} ) ) { |
|
143
|
1
|
|
|
|
|
5
|
allItems( $self, $params{'All Items'} ); |
|
144
|
1
|
50
|
|
|
|
4
|
} if ( exists( $params{'Smart Info'} ) ) { |
|
145
|
1
|
|
|
|
|
4
|
smartInfo( $self, $params{'Smart Info'} ); |
|
146
|
1
|
50
|
|
|
|
9
|
} if ( exists( $params{'Smart Criteria'} ) ) { |
|
147
|
1
|
|
|
|
|
4
|
smartCriteria( $self, $params{'Smart Criteria'} ); |
|
148
|
1
|
50
|
|
|
|
4
|
} if ( exists( $params{'Playlist Items'} ) ) { |
|
149
|
1
|
|
|
|
|
4
|
addItems( $self, $params{'Playlist Items'} ); |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
1
|
|
|
|
|
4
|
return $self; |
|
153
|
|
|
|
|
|
|
} #new |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
# Clean up |
|
156
|
0
|
|
|
0
|
|
0
|
sub DESTROY { |
|
157
|
|
|
|
|
|
|
# Nothing to do. |
|
158
|
|
|
|
|
|
|
} #DESTROY |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 name( name ) |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Get/set the name attribute for this playlist. |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub name { |
|
167
|
2
|
|
|
2
|
1
|
1324
|
my $self = shift; |
|
168
|
|
|
|
|
|
|
|
|
169
|
2
|
100
|
|
|
|
7
|
if (@_) { |
|
170
|
1
|
|
|
|
|
3
|
my $name = shift; |
|
171
|
1
|
|
|
|
|
7
|
$self->{'Name'} = $name; |
|
172
|
|
|
|
|
|
|
} |
|
173
|
|
|
|
|
|
|
|
|
174
|
2
|
|
|
|
|
10
|
return $self->{'Name'}; |
|
175
|
|
|
|
|
|
|
} #name |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head2 playlistID( id ) |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Get/set the Playlist ID attribute for this playlist. |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub playlistID { |
|
184
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
|
185
|
|
|
|
|
|
|
|
|
186
|
2
|
100
|
|
|
|
6
|
if (@_) { |
|
187
|
1
|
|
|
|
|
2
|
my $id = shift; |
|
188
|
1
|
|
|
|
|
13
|
$self->{'Playlist ID'} = $id; |
|
189
|
|
|
|
|
|
|
} |
|
190
|
|
|
|
|
|
|
|
|
191
|
2
|
|
|
|
|
7
|
return $self->{'Playlist ID'}; |
|
192
|
|
|
|
|
|
|
} #playlistID |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head2 playlistPersistenID( id ) |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Get/set the Playlist Persistent ID attribute for this playlist. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub playlistPersistentID { |
|
201
|
2
|
|
|
2
|
0
|
5
|
my $self = shift; |
|
202
|
|
|
|
|
|
|
|
|
203
|
2
|
100
|
|
|
|
6
|
if (@_) { |
|
204
|
1
|
|
|
|
|
2
|
my $id = shift; |
|
205
|
1
|
|
|
|
|
3
|
$self->{'Playlist Persistent ID'} = $id; |
|
206
|
|
|
|
|
|
|
} |
|
207
|
|
|
|
|
|
|
|
|
208
|
2
|
|
|
|
|
8
|
return $self->{'Playlist Persistent ID'}; |
|
209
|
|
|
|
|
|
|
} #playlistPersistentID |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head2 allItems( 0|1 ) |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Get/set the All Items attribute for this playlist. |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=cut |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
sub allItems { |
|
218
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
|
219
|
|
|
|
|
|
|
|
|
220
|
2
|
100
|
|
|
|
7
|
if (@_) { |
|
221
|
1
|
|
|
|
|
1
|
my $allItems = shift; |
|
222
|
1
|
50
|
|
|
|
6
|
return carp "All items must be 0 or 1." unless ($allItems =~ /^[01]$/); |
|
223
|
1
|
|
|
|
|
3
|
$self->{'All Items'} = $allItems; |
|
224
|
|
|
|
|
|
|
} |
|
225
|
|
|
|
|
|
|
|
|
226
|
2
|
|
|
|
|
6
|
return $self->{'All Items'}; |
|
227
|
|
|
|
|
|
|
} #allItems |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head2 smartInfo( smartInfo ) |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Get/set the Smart Info attribute for this playlist. |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=cut |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
sub smartInfo { |
|
236
|
2
|
|
|
2
|
1
|
3
|
my $self = shift; |
|
237
|
|
|
|
|
|
|
|
|
238
|
2
|
100
|
|
|
|
7
|
if (@_) { |
|
239
|
1
|
|
|
|
|
7
|
my $smartInfo = shift; |
|
240
|
1
|
|
|
|
|
4
|
$self->{'Smart Info'} = $smartInfo; |
|
241
|
|
|
|
|
|
|
} |
|
242
|
|
|
|
|
|
|
|
|
243
|
2
|
|
|
|
|
8
|
return $self->{'Smart Info'}; |
|
244
|
|
|
|
|
|
|
} #smartInfo |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=head2 smartCriteria( smartInfo ) |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
Get/set the Smart Criteria attribute for this playlist. |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=cut |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub smartCriteria { |
|
253
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
|
254
|
|
|
|
|
|
|
|
|
255
|
2
|
100
|
|
|
|
7
|
if (@_) { |
|
256
|
1
|
|
|
|
|
2
|
my $smartCriteria = shift; |
|
257
|
1
|
|
|
|
|
3
|
$self->{'Smart Criteria'} = $smartCriteria; |
|
258
|
|
|
|
|
|
|
} |
|
259
|
|
|
|
|
|
|
|
|
260
|
2
|
|
|
|
|
9
|
return $self->{'Smart Criteria'}; |
|
261
|
|
|
|
|
|
|
} #smartCriteria |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=head2 num() |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
Get the number of elements in this playlist. |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=cut |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub num { |
|
270
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
271
|
|
|
|
|
|
|
|
|
272
|
0
|
|
|
|
|
0
|
return scalar(@{$self->{'items'}}); |
|
|
0
|
|
|
|
|
0
|
|
|
273
|
|
|
|
|
|
|
} #num |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=head2 addItem( Mac::iTunes::Library::Item ) |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
Add an item to this playlist; duplicates are allowed |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=cut |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
sub addItem { |
|
282
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
|
283
|
1
|
|
|
|
|
2
|
my $item = shift; |
|
284
|
|
|
|
|
|
|
|
|
285
|
1
|
50
|
|
|
|
12
|
return carp "Need a Mac::iTunes::Library::Item object." |
|
286
|
|
|
|
|
|
|
unless ($item->isa('Mac::iTunes::Library::Item')); |
|
287
|
|
|
|
|
|
|
|
|
288
|
1
|
|
|
|
|
2
|
push @{$self->{'items'}}, $item; |
|
|
1
|
|
|
|
|
4
|
|
|
289
|
|
|
|
|
|
|
# TODO: shouldn't this be referencing a track already in the lib? |
|
290
|
|
|
|
|
|
|
} #addItem |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=head2 addItems( Mac::iTunes::Library::Item ) |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
Add an array of items to this playlist; duplicates are allowed |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=cut |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
sub addItems { |
|
299
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
300
|
1
|
|
|
|
|
1
|
my $items = shift; |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
# Complain if there are any non-item objects |
|
303
|
1
|
50
|
|
|
|
3
|
unless (grep {$_->isa('Mac::iTunes::Library::Item')} @{$items}) { |
|
|
3
|
|
|
|
|
19
|
|
|
|
1
|
|
|
|
|
2
|
|
|
304
|
0
|
|
|
|
|
0
|
return carp "Given an array containig items that are not all " . |
|
305
|
|
|
|
|
|
|
"Mac::iTunes::Library::Item objects."; |
|
306
|
|
|
|
|
|
|
} |
|
307
|
|
|
|
|
|
|
|
|
308
|
1
|
|
|
|
|
2
|
push @{$self->{'items'}}, @{$items}; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
4
|
|
|
309
|
|
|
|
|
|
|
} #addItems |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=head2 items() |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
Get an array of the items in the playlist. |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=cut |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
sub items { |
|
318
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
319
|
|
|
|
|
|
|
|
|
320
|
0
|
|
|
|
|
0
|
return @{$self->{'items'}}; |
|
|
0
|
|
|
|
|
0
|
|
|
321
|
|
|
|
|
|
|
} #items |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=head2 item( trackID ) |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
Get an item by it's trackID |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=cut |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
sub item { |
|
330
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
|
331
|
1
|
|
|
|
|
3
|
my $id = shift; |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
# There may be duplicates |
|
334
|
1
|
|
|
|
|
2
|
my @items = grep {$_->trackID() == $id} @{$self->{'items'}}; |
|
|
4
|
|
|
|
|
11
|
|
|
|
1
|
|
|
|
|
4
|
|
|
335
|
|
|
|
|
|
|
|
|
336
|
1
|
|
|
|
|
6
|
return $items[0]; |
|
337
|
|
|
|
|
|
|
} #item |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
1; |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
L, L |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=head1 AUTHOR |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
Drew Stephens , http://dinomite.net |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=over 4 |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=item * |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
Mark Grimes , L |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=back |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=head1 SOURCE REPOSITORY |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
http://mac-itunes.googlecode.com |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=head1 SVN INFO |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
$Revision: 90 $ |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
Copyright (C) 2007-2008 by Drew Stephens |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
372
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
|
373
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
=cut |
|
376
|
|
|
|
|
|
|
__END__ |