public class ITLibrary extends ReferenceCountedObject
getInstance(boolean)
and then start accessing
playlists or media items (aka tracks).
Important
You must code sign your app to retrieve information with this framework, and
iTunes library access is read-only. This framework is available to users with
iTunes 11 or later.
pointer
Constructor | Description |
---|---|
ITLibrary() |
Creates a new instance with version "1.0".
|
ITLibrary(String version) |
Creates a new instance with the given version.
|
Modifier and Type | Method | Description |
---|---|---|
ITLibArtwork |
artworkForMediaFile(URI uri) |
Retrieves the artwork from a media file that may or may not be in the iTunes library.
|
ITLibMediaItems |
getAllMediaItems() |
All the media items (tracks) in the iTunes library.
|
ITLibPlaylists |
getAllPlaylists() |
All the playlists in the iTunes library.
|
int |
getAPIMajorVersion() |
The major version number of the API the iTunesLibrary framework exposes.
|
int |
getAPIMinorVersion() |
The minor version number of the API the iTunesLibrary framework exposes.
|
String |
getApplicationVersion() |
The version of iTunes that created or modified the iTunes library you’re accessing.
|
static ITLibrary |
getInstance(boolean load) |
Initialize the ITLibrary.
|
Date |
getLastItemModification() |
Greatest last played, addition or modification date for any items in the library.
|
long |
getLastReloadTime() |
Time (in millis) when the data was last reloaded.
|
ITLibMediaItem |
getMediaItem(long id) |
Get a media item for the given persistent id.
|
long[] |
getMediaItemIds() |
Get all media items' persistent ids.
|
ITLibMediaItems |
getMediaItemsChangedSince(Date date) |
Media items that have changed since the given date.
|
URI |
getMusicFolderLocation() |
The location of the iTunes music folder.
|
int |
getPlaylistHash() |
Hash value that represents the current playlists.
|
boolean |
isShowContentRating() |
A Boolean value indicating whether to show content rating labels.
|
boolean |
reloadData() |
Reload data, if it hasn't been reloaded very recently (like in the last couple
of seconds).
|
boolean |
reloadData(boolean force) |
Reload data.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
release, retain
public ITLibrary() throws Exception
getInstance(boolean)
Exception
- should something go wrong.public ITLibrary(String version) throws Exception
getInstance(boolean)
version
- version string to pass to the native library.Exception
- should something go wrong.public static ITLibrary getInstance(boolean load) throws Exception
load
is true, this method blocks.
If load
is false, this method returns right away, but may return null
.load
- make sure the library is indeed loaded.Exception
- if something goes wrong.public URI getMusicFolderLocation() throws URISyntaxException
URISyntaxException
- if the location cannot be converted into
a valid URI
public boolean isShowContentRating()
public String getApplicationVersion()
public int getAPIMinorVersion()
public int getAPIMajorVersion()
public boolean reloadData()
public boolean reloadData(boolean force)
force
- if true, disregard that we may have just reloaded data.public long getLastReloadTime()
public ITLibArtwork artworkForMediaFile(URI uri)
uri
- uripublic ITLibMediaItems getAllMediaItems()
public ITLibPlaylists getAllPlaylists()
public ITLibMediaItems getMediaItemsChangedSince(Date date)
date
- datepublic ITLibMediaItem getMediaItem(long id)
id
- persistent idpublic long[] getMediaItemIds()
public Date getLastItemModification()
null
, if we cannot determine the date.public int getPlaylistHash()