NAME
Mac::iTunes::Library::Playlist - Perl extension for representing a playlist (list of items by Track ID) within an iTunes library.
SYNOPSIS
use Mac::iTunes::Library::Playlist;
# Let's create a few simple items
my @items = (
Mac::iTunes::Library::Item->new('Track ID' => 3),
Mac::iTunes::Library::Item->new('Track ID' => 4),
);
# Create a playlist
my $smartInfo =<< 'EOF';
AQEAAwAAAAIAAAAZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAA==
EOF
my $smartCriteria =<< 'EOF';
U0xzdAABAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkAAAABAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAAAB
AAAAAAAAAGQAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAA=
EOF
my $playlist = Mac::iTunes::Library::Playlist->new(
'Name' => '5 Stars',
'Playlist ID' => '10073',
'Playlist Persistent ID' => '2E2D1396AF1DED73',
'All Items' => 'true',
'Smart Info' => $smartInfo,
'Smart Criteria' => $smartCriteria,
'Playlist Items' => @items,
);
# Add another item to that playlist
my $item = Mac::iTunes::Library::Item->new( 'Track ID' => 7 );
$playlist->addItem( $item );
# Get all of the items in the playlist
my @items = $playlist->items();
# Get an item by it's ID
$item = $playlist->item(3);
DESCRIPTION
A data structure for representing a playlist within an iTunes library. Use this along with Mac::iTunes::Library to create an iTunes library from which other information can be gleaned.
EXPORT
None by default.
METHODS
- new()
-
Creates a new Mac::iTunes::Playlist object that can store all of the data of an iTunes library playlist.
my $playlist = Mac::iTunes::Playlist->new();
The constructor can also be called with any number of attributes defined in a hash:
my $smartInfo =<< 'EOF'; AQEAAwAAAAIAAAAZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAA== EOF my $smartCriteria =<< 'EOF'; U0xzdAABAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkAAAABAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAAAB AAAAAAAAAGQAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAA= EOF # A few simple items my @items = ( Mac::iTunes::Library::Item->new('Track ID' => 2), Mac::iTunes::Library::Item->new('Track ID' => 3), Mac::iTunes::Library::Item->new('Track ID' => 4), ); my $playlist = Mac::iTunes::Playlist->new( 'Name' => '5 Stars', 'Playlist ID' => '10073', 'Playlist Persistent ID' => '2E2D1396AF1DED73', 'All Items' => 'true', 'Smart Info' => $smartInfo, 'Smart Criteria' => $smartCriteria, 'Playlist Items' => @items, );
- name( name )
-
Get/set the name attribute for this playlist.
- playlistID( id )
-
Get/set the Playlist ID attribute for this playlist.
- playlistPersistenID( id )
-
Get/set the Playlist Persistent ID attribute for this playlist.
- allItems( 0|1 )
-
Get/set the All Items attribute for this playlist.
- smartInfo( smartInfo )
-
Get/set the Smart Info attribute for this playlist.
- smartCriteria( smartInfo )
-
Get/set the Smart Criteria attribute for this playlist.
- num()
-
Get the number of elements in this playlist.
- addItem( Mac::iTunes::Library::Item )
-
Add an item to this playlist; duplicates are allowed
- addItems( Mac::iTunes::Library::Item )
-
Add an array of items to this playlist; duplicates are allowed
- items()
-
Get an array of the items in the playlist.
- item( trackID )
-
Get an item by it's trackID
SEE ALSO
Mac::iTunes::Library, Mac::iTunes::Library::Item
AUTHOR
Drew Stephens <drew@dinomite.net>, http://dinomite.net
SVN INFO
$Revision: 59 $ $Date: 2009-01-04 22:59:26 -0800 (Sun, 04 Jan 2009) $ $Author: drewgstephens $
COPYRIGHT AND LICENSE
Copyright (C) 2007-2008 by Drew Stephens
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 342:
You forgot a '=back' before '=head1'