NAME

Mac::iTunes::Library - Perl extension for representing an iTunes library

SYNOPSIS

  use Mac::iTunes::Library;

  my $library = Mac::iTunes::Library->new();
  my $item = Mac::iTunes::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";

DESCRIPTION

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.

EXPORT

None by default.

METHODS

new()

Creates a new Mac::iTunes::Library object that can store Mac::iTunes::Item objects.

num()

Get the number of tracks in the library

size()

Get the total size of the library

time()

Get the total time of the library

artist()

Get the hash of the number of tracks for each artist.

partist()

Get the hash of the number of plays (playcount) for each artist.

genre()

Get the hash of the number of tracks in each genre.

pgenre()

Get the hash of the number of plays (playcount) for each genre.

type()

Get the hash of item types in the library

items()

Get the hash of Items (Artist->Name->[item, item]) contained in the library.

add( Mac::iTunes::Item )

Add an item to the library

SEE ALSO

Mac::iTunes, Mac::iTunes::Item

AUTHOR

Drew Stephens, <lt>drewgstephens@gmail.com<gt>, http://dinomite.net

COPYRIGHT AND LICENSE

Copyright (C) 2007 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.