Mac::iTunes::Library - Perl extension for representing an iTunes library
use Mac::iTunes::Library; my $library = Mac::iTunes::Library->new(); my $item = Mac::iTunes::Library::Item->new( 'Track ID' => 1, 'Name' => 'The Fooiest Song', 'Artist' => 'The Bar Band', ); $library->add($item); print "This library has only " . $library->num() . "item.\n";
A data structure for representing an iTunes library.
The library keeps track of the number of tracks by each artist (a hash of Artist => num_tracks) and the number of songs in each genre (Genre => num_tracks). Additionally, the total playcounts for each artist (Artist => playcount_of_all_songs) and genre (Genre => playcount_of_all_songs) are tallied. Finally, all of the items in the library are available, sorted by artist.
None by default.
Creates a new Mac::iTunes::Library object that can store Mac::iTunes::Library::Item objects.
Get/set the plist version number.
Get/set the Major Version number
Get/set the Minor Version number
Get/set the Application Version number
Get/set the Features attribute
Get/set the Show Content Ratings attribute
Get/set the Music Folder attribute
Get/set the Library Persistent ID
Get the number of tracks in the library
Get the total size of the library
Get the total time of the library
Get the hash of the number of tracks for each artist.
Get the hash of the number of plays (playcount) for each artist.
Get the hash of the number of tracks for each albumArtist.
Get the hash of the number of plays (playcount) for each albumArtist.
Get the hash of the number of tracks in each genre.
Get the hash of the number of plays (playcount) for each genre.
Get the hash of item types in the library
Get the hash of Items (Artist->Name->[item, item]) contained in the library; artist names are the top level keys; accessing one gives you a hash-ref with keys of song names and array-refs as values. Those array-refs contain Mac::iTunes::Library::Item objects.
# Assuming a previously created library %items = $library->items(); while (($artist, $artistSongs) = each %items) { while (($songName, artistSongItems) = each %$artistSongs) { foreach my $item (@$artistSongItems) { # Do something here to every item in the library print $song->name() . "\n"; } } }
Add an item to the library
Mac::iTunes::Library::XML, Mac::iTunes::Library::Item, Mac::iTunes::Library::Playlist
Drew Stephens <drew@dinomite.net>, http://dinomite.net
Mark Grimes <mgrimes@cpan.org>, (http://www.peculiarities.com)
Scott Lawrence (http://linkedin.com/in/scottdlawrence)
Garrett Scott <garrett@gothik.org>, (http://www.gothik.org)
Mark Allen <mrallen1@yahoo.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.