Mac::iTunes::Library::Playlist - Perl extension for representing a playlist (list of items by Track ID) within an iTunes library.
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);
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.
None by default.
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, );
Get/set the name attribute for this playlist.
Get/set the Playlist ID attribute for this playlist.
Get/set the Playlist Persistent ID attribute for this playlist.
Get/set the All Items attribute for this playlist.
Get/set the Smart Info attribute for this playlist.
Get/set the Smart Criteria attribute for this playlist.
Get the number of elements in this playlist.
Add an item to this playlist; duplicates are allowed
Add an array of items to this playlist; duplicates are allowed
Get an array of the items in the playlist.
Get an item by it's trackID
Mac::iTunes::Library, Mac::iTunes::Library::Item
Drew Stephens <drew@dinomite.net>, http://dinomite.net
Mark Grimes <mgrimes@cpan.org>, http://www.peculiarities.com
http://mac-itunes.googlecode.com
$Revision: 90 $
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.
To install Mac::iTunes::Library, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mac::iTunes::Library
CPAN shell
perl -MCPAN -e shell install Mac::iTunes::Library
For more information on module installation, please visit the detailed CPAN module installation guide.