NAME

Mac::iTunes::Library::Item - Perl extension for representing an item (song, URL, video) within an iTunes library.

SYNOPSIS

use Mac::iTunes::Library::Item;

my $item = Mac::iTunes::Library::Item->new(
      'Track ID' => 1,
      'Name' => 'The Fooiest Song',
      'Artist' => 'The Bar Band',
      );
$item->genre('Ska');
print "We are the " . $item->artist() . " and we play " .
$item->genre() . " music\n";
print "Enjoy our hit song " . $item->name() . "\n";

DESCRIPTION

A data structure for representing an item (song, URL, video) 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::Library::Item object that can store all of the data of an iTunes library item.

my $rec = Mac::iTunes::Library::Item->new();

The constructor can also be called initializing any number of the attributes of an item

my $rec = Mac::iTunes::Library::Item->new(
    'Track ID' => '73',
    'Name' => 'Josie',
    'Artist' => 'blink-182',
    'Album Artist' => 'blink-182',
    'Composer' => 'blink-182',
    'Album' => 'Dude Ranch',
    'Grouping' => 'Alternative Rock, 00s Rock'
    'Genre' => 'Pop Punk',
    'Kind' => 'MPEG audio file',
    'Size' => 31337,
    'Total Time' => 31337,
    'Year' => '2007',
    'Date Modified' => '2007-01-01T01:01:01Z',
    'Date Added' => '2007-01-01T01:01:01Z',
    'Bit Rate' => 256,
    'Sample Rate' => 44100,
    'Play Count' => 1,
    'Play Date' => -1167613261,
    'Play Date UTC' => '2007-01-01T01:01:01Z',
    'Skip Count' => 1,
    'Skip Count UTC' => '2007-01-01T01:01:01Z',
    'Rating' => 50,
    'Album Rating' => 50,
    'Album Rating Computed' => 1,
    'Compilation' => 1,
    'Persistent ID' => 'DAC2FC501CCA2031',
    'Track Type' => 'File',
    'Location' => 'file://localhost/Users/dinomite/Music/blink-182/Dude%20Ranch/Josie.mp3',
    'File Folder Count' => 4,
    'Library Folder Count' => 1
);

trackID( $id )

Get/set the Track ID attribute for this item.

artist( $artist )

Get/set the Artist attribute for this item.

albumArtist( $albumArtist )

Get/set the Album Artist attribute for this item.

composer( $composer )

Get/set the Composer attribute for this item.

album( $album )

Get/set the Album attribute for this item.

grouping( $grouping )

Get/set the Grouping attribute for this item.

Note: Grouping is intended to be used as a collection of music items below the level of an album (such as on a classical music release) where items are individual movements of a larger work. They are more commonly used as a comma delimited list of tags to build smart playlists.

genre( $genre )

Get/set the Genre attribute for this item.

kind( $kind )

Get/set the Kind ("MPEG audio file", etc.) attribute for this item.

size( $size )

Get/set the Size attribute for this item.

totalTime( $totalTime )

Get/set the Total Time attribute for this item.

year( $year )

Get/set the Year attribute for this item.

dateModified( $dateModified )

Get/set the Date Modified attribute for this item.

dateAdded( $dateAdded )

Get/set the Date Added attribute for this item.

bitRate( $bitRate )

Get/set the Date Added attribute for this item.

comments( $comments )

Get/set the Comments attribute for this item.

sampleRate( $sampleRate )

Get/set the Sample Rate attribute for this item.

playCount( $playCount )

Get/set the Play Count attribute for this item.

playDate( $playDate )

Get/set the Play Date attribute for this item.

playDateUTC( $playDateUTC )

Get/set the Play Date UTC attribute for this item.

releaseDate( $releaseDate )

Get/set the Release Date attribute for this item.

skipCount( $skipCount )

Get/set the Skip Count attribute for this item.

skipDate( $skipDate )

Get/set the Skip Date attribute for this item.

rating( $rating )

Get/set the Rating attribute for this item.

albumRating( $albumRating )

Get/set the Album Rating attribute for this item.

albumRatingComputed( $albumRatingComputed )

Get/set the Album Rating Computed attribute for this item.

compilation( $albumRatingComputed )

Get/set the Compilation attribute for this item.

persistentID( $persistentID )

Get/set the Persistent ID attribute for this item.

trackType( $trackType )

Get/set the Track Type attribute for this item.

iTunesU( $trackType )

Get/set the iTunesU attribute for this item.

location( $location )

Get/set the Location attribute for this item.

fileFolderCount( $fileFolderCount )

Get/set the File Folder Count attribute for this item.

libraryFolderCount( $libraryFolderCount )

Get/set the Library Folder Count attribute for this item.

trackCount( $trackCount )

Get/set the Track Count attribute for this item.

trackNumber( $trackNumber )

Get/set the Track Number attribute for this item.

SEE ALSO

Mac::iTunes::Library, Mac::iTunes::Library::Playlist, Mac::iTunes::Library::XML

AUTHOR

Drew Stephens <drew@dinomite.net>, http://dinomite.net

CONTRIBUTORS

  • Mark Allen <mrallen1@yahoo.com>

  • Michael G Schwern <mschwern@cpan.org>

  • David Rostcheck <davidr@thisisdavidr.net>

SOURCE REPOSITORY

http://mac-itunes.googlecode.com

SVN INFO

$Revision: 90 $

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.