#include <itunesdb.h>
Inheritance diagram for ITunesDB:
Public Member Functions | |
ITunesDB (IPodSysInfo &ipodSysInfo) | |
bool | open () |
bool | isOpen () |
bool | writeDatabase (const QString &filename=QString()) |
bool | dbFileChanged () const |
QString | getFilename () const |
ITunesDBPlaylist * | createNewPlaylist (const QString &title) |
ITunesDBTrack * | createEmptyTrack (Q_UINT32 trackid) |
ITunesDBTrack * | createNewTrack (const QString &fileExtension=QString::null) |
bool | addTrack (ITunesDBTrack *track) |
ITunesDBTrack * | getTrackByID (const Q_UINT32 id) const |
ITunesDBTrack * | findTrackByDBID (const Q_UINT64 dbid) const |
int | getMHITTrackPosFor (Q_UINT32 id) const |
ITunesDBTrack * | getTrackAt (uint mhitTrackPos) const |
ITunesDBTrack * | findFirstTrackBy (itunesdb::TrackPredicate &predicate) const |
TrackIterator | getTracksBy (itunesdb::TrackPredicate *predicate) const |
itunesdb::TrackPtrList * | getTracksBy (itunesdb::TrackPredicate &predicate, itunesdb::TrackPtrList &buffer) const |
ITunesDBTrack * | findTrack (const QString &artistname, const QString &albumname, const QString &title, Q_UINT32 trackNum=0) const |
QStringList * | getArtists (QStringList &buffer) const |
QStringList * | getAllAlbums (QStringList &buffer) const |
QStringList * | getAlbumsByArtist (const QString &artistname, QStringList &buffer) const |
bool | containsArtist (const QString &artistname) const |
bool | containsAlbum (const QString &artistname, const QString &albumname) const |
itunesdb::TrackPtrList * | getAllTracks (itunesdb::TrackPtrList &buffer) const |
TrackIterator | getAllTracks () const |
itunesdb::TrackPtrList * | getAlbum (const QString &artistname, const QString &albumname, itunesdb::TrackPtrList &buffer) const |
itunesdb::TrackPtrList * | getTracksByArtist (const QString &artistname, itunesdb::TrackPtrList &buffer) const |
itunesdb::TrackPtrList * | getTracksContaining (const QString &someString, itunesdb::TrackPtrList &buffer, bool caseSensitive=true) const |
QStringList * | getPlaylistTitles (QStringList &buffer) const |
ITunesDBPlaylist * | getPlaylistByTitle (const QString &playlisttitle) const |
ITunesDBPlaylist * | getPlaylistByID (Q_UINT64 playlistID) const |
bool | removeArtist (const QString &artistname) |
bool | renameAlbum (const QString &artist, const QString &title, const QString &newartist, const QString &newtitle) |
bool | addPlaylist (ITunesDBPlaylist *playlist) |
bool | removePlaylist (const QString &title, bool delete_instance) |
void | updateSmartPlaylists () |
Q_UINT32 | removeTrack (Q_UINT32 trackid, bool delete_instance=true) |
void | clear () |
bool | isDirty () const |
Q_UINT32 | getNumTracks () const |
Q_UINT32 | getNumPlaylists () const |
void | lock (bool write_lock) |
void | unlock () |
bool | isLocked () const |
uint | lastModified () |
void | setTitle (const QString &title) |
const QString & | getTitle () const |
bool | hasPodcasts () const |
Q_UINT32 | getNextFreeTrackID () const |
Q_UINT64 | getNextFreeDBID () const |
QString | getFileForPathInfo (QString pathinfo) const |
const QString & | getIPodBase () const |
Public Attributes | |
QString | error |
Protected Member Functions | |
void | setDirty (bool dirtyFlag=true) |
ITunesDBTrack * | insertTrackToDataBase (ITunesDBTrack *track) |
Protected Attributes | |
TrackIDMap | m_TrackIdMap |
TrackList | m_TrackList |
QString | m_Title |
ITunesDB::PlaylistContainer * | playlists |
bool | m_dirty |
Q_UINT32 | maxtrackid |
Q_UINT64 | mMaxDBID |
Friends | |
class | ITunesDBPlaylist |
class | ITunesDBSPLRuleSet |
class | ITunesDBTrack |
Classes | |
class | ItunesDBReaderAdapter |
class | ItunesDBWriterAdapter |
class | PlaylistContainer |
class | TrackIterator |
bool ITunesDB::open | ( | ) |
Opens the itunesdb file at the given ipod mountpoint
bool ITunesDB::isOpen | ( | ) |
Returns true if open() has already been successfully called.
bool ITunesDB::writeDatabase | ( | const QString & | filename = QString() |
) |
Writes the (changed) database back to the ipod
filename | the name of the file to be written. If no filename is given the database will be written to the file read whith open() |
bool ITunesDB::dbFileChanged | ( | ) | const |
Returns true if the itunesdb file has been changed thus needs to be reloaded or does not exist anymore
QString ITunesDB::getFilename | ( | ) | const [inline] |
Returns the name of the filename given with the open() call
ITunesDBPlaylist * ITunesDB::createNewPlaylist | ( | const QString & | title | ) |
Creates a new empty playlist
ITunesDBTrack * ITunesDB::createEmptyTrack | ( | Q_UINT32 | trackid | ) |
Creates a new empty track
ITunesDBTrack * ITunesDB::createNewTrack | ( | const QString & | fileExtension = QString::null |
) |
Returns a new itunesdb::Track instance for adding a new track to the database. The new instance gets initialized with an unused trackid and trackpath. Subsequent calls will get itunesdb::Track with the same trackid until the returned track is as added via addTrack() thus a call to addTrack() has to be done afterwards.
fileExtension | file extension of the file representing the track. If you don't know the file extension yet leave empty and set it with Track::setFileExtension() later |
bool ITunesDB::addTrack | ( | ITunesDBTrack * | track | ) |
Adds a new track to the collection. This only adds the control information to the database, the track itself (the file) has to by copied by the user.
track | the track to add to the database |
ITunesDBTrack * ITunesDB::getTrackByID | ( | const Q_UINT32 | id | ) | const |
returns the Track corresponding to the given ID
id | ID of the track |
ITunesDBTrack * ITunesDB::findTrackByDBID | ( | const Q_UINT64 | dbid | ) | const |
Returns the first track found with the given dbid
int ITunesDB::getMHITTrackPosFor | ( | Q_UINT32 | id | ) | const |
Returns the MHIT position of the track with the given ID or -1 if there's no such track.
id | ID of the track |
ITunesDBTrack * ITunesDB::getTrackAt | ( | uint | mhitTrackPos | ) | const |
returns the Track at the specified position in the itunesdb
mhitTrackPos | the position of the desired track |
ITunesDBTrack * ITunesDB::findFirstTrackBy | ( | itunesdb::TrackPredicate & | predicate | ) | const |
Returns the first Track where the given predicate returned true The given trackpredicate needs to contain a method that gets a track, and returns a bool if it's the desired track
ITunesDB::TrackIterator ITunesDB::getTracksBy | ( | itunesdb::TrackPredicate * | predicate | ) | const |
Returns all the Tracks where the given itunesdb::TrackPredicate
returned true Be aware that the returned TrackIterator depends on the given predicate, so do not delete it as long as you need access to the Iterator
itunesdb::TrackPredicates
for a list of predefined predicates TrackPtrList * ITunesDB::getTracksBy | ( | itunesdb::TrackPredicate & | predicate, | |
itunesdb::TrackPtrList & | buffer | |||
) | const |
Returns all the Tracks where the given itunesdb::TrackPredicate
returned true
itunesdb::TrackPredicates
for a list of predefined predicates ITunesDBTrack * ITunesDB::findTrack | ( | const QString & | artistname, | |
const QString & | albumname, | |||
const QString & | title, | |||
Q_UINT32 | trackNum = 0 | |||
) | const |
returns the Track found by the given information or NULL if no such Track could be found
artistname | the name of the artist | |
albumname | the name of the album | |
title | the title of the track | |
trackNum | the position of the track in its album |
QStringList * ITunesDB::getArtists | ( | QStringList & | buffer | ) | const |
Fills the given QStringList with the names of all artists in the database
QStringList * ITunesDB::getAllAlbums | ( | QStringList & | buffer | ) | const |
Fills the given QStringList with the names of all albums in the database
QStringList * ITunesDB::getAlbumsByArtist | ( | const QString & | artistname, | |
QStringList & | buffer | |||
) | const |
Fills the given QStringList with the names of the albums by the given artist
artistname | the name of the artist to look for | |
buffer | the list to put the names of the albums found |
bool ITunesDB::containsArtist | ( | const QString & | artistname | ) | const |
Returns true if the given artist exists.
artistname | the artists name to check for. |
bool ITunesDB::containsAlbum | ( | const QString & | artistname, | |
const QString & | albumname | |||
) | const |
Returns true if the given album exists.
artistname | the artists name to check for | |
albumname | the name of the album |
TrackPtrList * ITunesDB::getAllTracks | ( | itunesdb::TrackPtrList & | buffer | ) | const |
Returns a list with all the tracks in the database.
buffer | the list to put the tracks into. |
ITunesDB::TrackIterator ITunesDB::getAllTracks | ( | ) | const |
Returns a list with all the tracks in the database
TrackPtrList * ITunesDB::getAlbum | ( | const QString & | artistname, | |
const QString & | albumname, | |||
itunesdb::TrackPtrList & | buffer | |||
) | const |
Returns an album by the given artistname and title.
artistname | name of the artist of the album in question | |
albumname | name of the album | |
buffer | the list the tracks of the album will be put to |
buffer
or NULL if no such album could by found TrackPtrList * ITunesDB::getTracksByArtist | ( | const QString & | artistname, | |
itunesdb::TrackPtrList & | buffer | |||
) | const |
Returns all the Tracks by the given artist.
artistname | the name of the artist to look for. | |
buffer | the list to put the found tracks into. |
TrackPtrList * ITunesDB::getTracksContaining | ( | const QString & | someString, | |
itunesdb::TrackPtrList & | buffer, | |||
bool | caseSensitive = true | |||
) | const |
Returns all tracks with the given string in its metadata (artist, album, title or composer)
someString | the string to look for | |
buffer | the list to put the found tracks into | |
caseSensitive | set to false if uppercase/lowercase should be ignored |
QStringList * ITunesDB::getPlaylistTitles | ( | QStringList & | buffer | ) | const |
Returns a list with all playlist names
buffer | the list to put the playlisttitles into |
ITunesDBPlaylist * ITunesDB::getPlaylistByTitle | ( | const QString & | playlisttitle | ) | const |
Returns a playlist by the given playlist title.
playlisttitle | title of the playlist in question |
ITunesDBPlaylist * ITunesDB::getPlaylistByID | ( | Q_UINT64 | playlistID | ) | const |
Returns the playlist by the given playlistID.
playlistID | the DB ID of the desired playlist |
bool ITunesDB::removeArtist | ( | const QString & | artistname | ) |
Removes all the tracks of the given artist (an thus the artist itself) from the database.
artistname | the name of the artist |
bool ITunesDB::renameAlbum | ( | const QString & | artist, | |
const QString & | title, | |||
const QString & | newartist, | |||
const QString & | newtitle | |||
) |
Renames an album with the given title and artist to newtitle, newartist by changing the artist and album properties of all the tracks found by the given artist/album combination to newartist/newalbum.
artist | the artist to look for | |
title | the album to look for | |
newartist | the new artist name to set. Give an empty or QString::null string if the artist property should remain unchanged. | |
newtitle | the new album title to set. Give an empty or QString::null string if the album property should remain unchanged. |
bool ITunesDB::addPlaylist | ( | ITunesDBPlaylist * | playlist | ) |
adds a new playlist to the database
bool ITunesDB::removePlaylist | ( | const QString & | title, | |
bool | delete_instance | |||
) |
Removes the playlist with the given title
title | the title of the playlist to be removed | |
delete_instance | if set to true the element gets deleted during removal |
void ITunesDB::updateSmartPlaylists | ( | ) |
Updates all Smart Playlists in this itunesdb instance.
Q_UINT32 ITunesDB::removeTrack | ( | Q_UINT32 | trackid, | |
bool | delete_instance = true | |||
) |
Removes the Track with the given trackid from the database. This also removes all playlist references to this track
trackid | ID of the track to be deleted | |
delete_instance | if set to true (default) the Track gets deleted during removal |
void ITunesDB::clear | ( | ) |
Wipes all data from the container.
bool ITunesDB::isDirty | ( | ) | const |
returns true if something in the container's control has been changed. a change to a Playlist or a Track for example will not set the change flag yet.
Q_UINT32 ITunesDB::getNumTracks | ( | ) | const |
Returns the number of tracks
Q_UINT32 ITunesDB::getNumPlaylists | ( | ) | const |
returns the number of playlists
void ITunesDB::lock | ( | bool | write_lock | ) |
Lock control functions to prevent concurrent access to the Database from different slaves
void ITunesDB::setTitle | ( | const QString & | title | ) |
sets the title of the mainlist
const QString& ITunesDB::getTitle | ( | ) | const [inline] |
Returns the title of the mainlist
Q_UINT32 ITunesDB::getNextFreeTrackID | ( | ) | const |
Returns the next free trackID for a new track
Q_UINT64 ITunesDB::getNextFreeDBID | ( | ) | const |
Returns the next available DBID.
QString ITunesDB::getFileForPathInfo | ( | QString | pathinfo | ) | const |
translates the pathinfo stored on the ipod to a real path info and adds the ipodBase path so we can access the real file. The caller needs to check if the file actually exists.
const QString& ITunesDB::getIPodBase | ( | ) | const [inline] |
Returns the ipods base directory.
ITunesDB::PlaylistContainer * ITunesDB::playlists [protected] |
The container that holds all the playlist for this iTunesDB instance.