itunesdb::Track Class Reference

Represents a track in the database. More...

#include <track.h>

Inheritance diagram for itunesdb::Track:

itunesdb::ListItem ITunesDBTrack List of all members.

Public Types

enum  MediaType {
  Audio_Video = 0x00, Audio = 0x01, Video = 0x02, Podcast = 0x04,
  Video_Podcast = 0x06, Audiobook = 0x08, Music_Video = 0x20, TV_Show = 0x40,
  TV_Show_w_Audio = 0x60
}

Public Member Functions

 Track (Q_UINT32 trackID=0)
Q_UINT32 getID () const
const QString & getAlbum () const
const QString & getAlbumForSort () const
const QString & getArtist () const
QString getPlainArtistName () const __attribute__((deprecated))
const QString & getCategory () const
const QString & getComment () const
const QString & getTvShow () const
void setTvShow (const QString &show)
const QString & getTitle () const
const QString & getTitleForSort () const
const QString & getGenre () const
const QString & getPathInfo () const
const QString & getComposer () const
const QString & getEqualizerSetting () const
const QString & getDescription () const
const QString & getGrouping () const
const QString & getAlbumArtist () const
const QString & getAlbumArtistForSort () const
const QString & getArtistNameForSort () const
const QString & getKeywords () const
const QString & getFileFormatDesc () const
Q_UINT64 getDBID () const
unsigned char getRating () const
Q_UINT32 getLastModified () const
Q_UINT32 getFileSize () const
Q_UINT32 getTrackLength () const
Q_UINT32 getTrackNumber () const
Q_UINT32 getTrackCount () const
Q_UINT32 getYear () const
Q_UINT32 getBitrate () const
Q_UINT32 getSamplerate () const
Q_UINT32 getVolumeAdjust () const
Q_UINT32 getPlayCount () const
Q_UINT32 getLastPlayed () const
Q_UINT32 getCdNumber () const
Q_UINT32 getCdCount () const
Q_UINT32 getDateAdded () const
Q_UINT32 getStartTime () const
Q_UINT32 getStopTime () const
Q_UINT32 getSoundCheck () const
unsigned char getVbrFlag () const
Q_UINT32 getFileFormatCode () const
Q_UINT32 getReleaseDate () const
unsigned char getCompilationFlag () const
unsigned char isChecked () const
bool isVideo () const
Q_UINT16 getBPM () const
virtual void setDBID (Q_UINT64 id)
virtual void setAlbum (const QString &album)
virtual void setAlbumForSort (const QString &album)
virtual void setArtist (const QString &artist)
virtual void setArtistNameForSort (const QString &artist)
virtual void setCategory (const QString &category)
virtual void setPathInfo (const QString &encodedpath)
virtual void setComment (const QString &comment)
virtual void setCompilationFlag (unsigned char isCompilation)
virtual void setDescription (const QString &description_txt)
virtual void setGrouping (const QString &grouping)
virtual void setGenre (const QString &genre)
virtual void setTitle (const QString &title)
virtual void setTitleForSort (const QString &title)
virtual void setFileFormatDesc (const QString &fdesc)
virtual void setComposer (const QString &composer)
virtual void setEqualizerSetting (const QString &eqSetting)
virtual void setAlbumArtist (const QString &albumartist)
virtual void setAlbumArtistForSort (const QString &albumartist)
virtual void setKeywords (const QString &keywords)
virtual void setTrackNumber (Q_UINT32 tracknumber)
virtual void setTrackCount (Q_UINT32 numtracks)
virtual void setVolumeAdjust (Q_UINT32 newVolumeAdjust)
virtual void setYear (Q_UINT32 newYear)
virtual void setStartTime (Q_UINT32 startTime)
virtual void setStopTime (Q_UINT32 stopTime)
virtual void setSoundCheck (Q_UINT32 soundCheck)
void setRating (unsigned char rating)
void setLastPlayed (Q_UINT32 lastplayed)
void setPlayCount (Q_UINT32 newPlaycount)
void setBPM (Q_UINT32 bpm)
QString getFileExtension () const
virtual void setFileExtension (const QString &fileextension)
void setSkipCount (Q_UINT32 numberOfSkips)
Q_UINT32 getSkipCount () const
void setLastSkippedTime (Q_UINT32 lastSkippedDateTime)
Q_UINT32 getLastSkippedTime () const
void skipWhenShuffle (bool enable)
bool skippedWhenShuffle () const
void setHasLyrics (bool hasLyrics)
bool hasLyrics () const
void setMediaType (Track::MediaType type)
Track::MediaType getMediaType () const
void setGaplessPBackData (Q_UINT32 pregapSamples, Q_UINT64 songSamples, Q_UINT32 postgapSamples, Q_UINT32 gaplessData)
Q_UINT32 getNumPregapSamples () const
Q_UINT64 getNumSongSamples () const
Q_UINT32 getNumPostgapSamples () const
Q_UINT32 getGaplessDataSize () const
void setSeasonNumber (Q_UINT32 season)
Q_UINT32 getSeasonNumber () const
void setEpisodeNumber (Q_UINT32 episode)
Q_UINT32 getEpisodeNumber () const
template<class TrackMetaSource>
void readFrom (TrackMetaSource &provider)
void setRecentlyPlayed (bool playedRecently=true)
bool recentlyPlayed () const
QString toQString () const
int getType () const
void setItemProperty (const QString &data, ItemProperty field)
bool containsItemProperty (ItemProperty field) const
const QString & getItemProperty (ItemProperty field) const
uint getNumComponents () const
uint getNumStringComponents () const
virtual bool isDirty () const

Protected Types

typedef std::map< Q_UINT32,
QString > 
PropertyMap
typedef std::vector< MHODPair > DumpedMHODs

Protected Member Functions

virtual QDataStream & writeToStream (QDataStream &outstream)
virtual QDataStream & readFromStream (QDataStream &instream, bool *ok=NULL)
void writeData (QByteArray &data) const
virtual void doneAddingData ()
const QByteArray * getDumpedMHOD (Q_UINT32 type) const
virtual void readMHOD (QDataStream &stream, Q_UINT32 type, Q_UINT32 blocklen)
Q_UINT32 writeMHODsToStream (QDataStream &outstream) const
virtual void readNonStringMHOD (QDataStream &stream, Q_UINT32 type, Q_UINT32 blocklen)
virtual uint writeNonStringMHODs (QDataStream &outstream) const
virtual void setDirty (bool dirtyFlag=true)

Protected Attributes

Q_UINT32 id
Q_UINT32 lastmodified
Q_UINT32 file_size
Q_UINT32 tracklen
Q_UINT32 tracknum
Q_UINT32 numtracks
Q_UINT32 year
Q_UINT32 bitrate
Q_UINT32 samplerate
Q_UINT32 volumeadjust
Q_UINT32 playcount
Q_UINT32 last_played_at
Q_UINT32 cdnum
Q_UINT32 numcds
Q_UINT32 file_format_code
Q_UINT32 date_added
Q_UINT32 date_released
Q_UINT32 mStartTime
Q_UINT32 mStopTime
Q_UINT32 mSoundCheck
unsigned char rating
unsigned char vbr
unsigned char type
unsigned char compilation
Q_UINT64 dbid
Q_UINT8 checked
Q_UINT8 app_rating
Q_UINT16 beatsPerMinute
Q_UINT16 mArtworkCount
Q_UINT16 unk9
Q_UINT32 mArtworkSize
Q_UINT32 unk11
Q_UINT32 mAppleDRM
Q_UINT32 mSkipCount
Q_UINT32 mLastSkippedDate
Q_UINT8 mHasArtwork
Q_UINT8 mSkipWhenShuffe
Q_UINT8 mRememberPbackPos
Q_UINT8 flag4
Q_UINT8 mHasLyricsFlag
Q_UINT8 mIsMovie
Q_UINT8 mPodcastPlayedFlag
Q_UINT8 unk37_2
Q_UINT32 unk21
Q_UINT32 mPregapSamples
Q_UINT64 mNumSamples
Q_UINT32 unk25
Q_UINT32 mPostgapSamples
Q_UINT32 unk27
Q_UINT32 mMediaType
Q_UINT32 mSeasonNumber
Q_UINT32 mEpisodeNumber
Q_UINT32 unk31
Q_UINT32 unk32
Q_UINT32 unk33
Q_UINT32 unk34
Q_UINT32 unk35
Q_UINT32 unk36
Q_UINT32 unk37
Q_UINT32 mGaplessData
Q_UINT32 unk38
Q_UINT16 mGapLessFlag
Q_UINT16 mGaplessAlbum
PropertyMap m_properties
DumpedMHODs m_dumpedMHODs
int m_itemType

Friends

class ItunesDBParser
class ItunesDBWriter

Detailed Description

Represents a track in the database.

This class mainly acts as a data access object for reading and writing track entries to/from the database file.

Author:
Michael Schulze
Examples:

listtests.cpp, and listtrackstest.cpp.


Member Function Documentation

Q_UINT32 itunesdb::Track::getID (  )  const

Returns the key for the track in the ITunesDB database

Returns:
the key for the track in the ITunesDB database

const QString & itunesdb::Track::getAlbum (  )  const

Returns the album the track is released for

Returns:
the albumname

const QString & itunesdb::Track::getAlbumForSort (  )  const

Returns the album the track is released for

Returns:
the albumname for sorting

const QString & itunesdb::Track::getArtist (  )  const

Returns the artist

Returns:
the artists name

QString itunesdb::Track::getPlainArtistName (  )  const

Deprecated:
use Track::getArtistNameForSort() instead
See also:
Track::getArtistNameForSort()

const QString & itunesdb::Track::getCategory (  )  const

Returns the category

Returns:
the category

const QString & itunesdb::Track::getComment (  )  const

Returns the comment set for the track

Returns:
the comment

const QString & itunesdb::Track::getTvShow (  )  const

Returns the name of the (TV) show

void itunesdb::Track::setTvShow ( const QString &  show  ) 

Sets the name of the (TV) show

const QString & itunesdb::Track::getTitle (  )  const

Returns the title of the track

Returns:
the title

const QString & itunesdb::Track::getTitleForSort (  )  const

Returns the title of the track

Returns:
the title of the track used for sorting

const QString & itunesdb::Track::getGenre (  )  const

Returns the genre of the track

Returns:
the genre

const QString & itunesdb::Track::getPathInfo (  )  const

Returns the pathname of the track as stored in the itunesdb. Be aware that the path is relative to the ipod base directory and the path separator is ":".

Returns:
pathname of the track

const QString & itunesdb::Track::getComposer (  )  const

Returns the composer

Returns:
the composer

const QString & itunesdb::Track::getEqualizerSetting (  )  const

Retunrs the EQ Setting

const QString & itunesdb::Track::getDescription (  )  const

Returns some descriptional text for this piece of audio data.

const QString & itunesdb::Track::getGrouping (  )  const

Returns the grouping info for this song.

const QString & itunesdb::Track::getAlbumArtist (  )  const

Returns the name of the artist for the whole album. This may be different if it's a soundtrack for example.

const QString & itunesdb::Track::getAlbumArtistForSort (  )  const

In case the band/artist name starts with a "The" this returns the name with the The at the end (like "Prodigy, The" for "The Prodigy"). Otherwise the normal artist name is returned.

const QString & itunesdb::Track::getArtistNameForSort (  )  const

In case the band/artist name starts with a "The" this returns the name with the The at the end (like "Prodigy, The" for "The Prodigy"). Otherwise the normal artist name is returned.

const QString & itunesdb::Track::getKeywords (  )  const

Returns the list of keywords pertaining the track

Q_UINT64 itunesdb::Track::getDBID (  )  const

Returns the DBID which refers to additional media associated to this track (like cover art)

Returns:
the DBID

unsigned char itunesdb::Track::getRating (  )  const

Returns the rating for this track as read from the itunesdb.

Returns:
the rating for this track as read from the itunesdb.

Q_UINT32 itunesdb::Track::getLastModified (  )  const

Returns the last modified date for this track.

Returns:
the last modified date for this track.

Q_UINT32 itunesdb::Track::getFileSize (  )  const

Returns the size of the file associated with this track

Returns:
the filesize

Q_UINT32 itunesdb::Track::getTrackLength (  )  const

Returns the length of the track in milliseconds

Returns:
the length of the track in milliseconds

Q_UINT32 itunesdb::Track::getTrackNumber (  )  const

Returns the number of the track

Returns:
the number of the track

Q_UINT32 itunesdb::Track::getTrackCount (  )  const

Returns the number of tracks in the album

Returns:
the number of tracks in the album

Q_UINT32 itunesdb::Track::getYear (  )  const

Returns the year the song was created

Returns:
the year the song was created

Q_UINT32 itunesdb::Track::getBitrate (  )  const

Returns the bitrate

Returns:
the bitrate

Q_UINT32 itunesdb::Track::getSamplerate (  )  const

Returns the sample rate

Returns:
the sample rate

Q_UINT32 itunesdb::Track::getVolumeAdjust (  )  const

Returns the volume adjust for the track

Returns:
the volume adjust

Q_UINT32 itunesdb::Track::getPlayCount (  )  const

Returns the number of times the track was played so far

Returns:
the play count

Q_UINT32 itunesdb::Track::getLastPlayed (  )  const

Returns the date the track was last played.

Q_UINT32 itunesdb::Track::getCdNumber (  )  const

Returns the cd number the track is on for albums with more than one CD.

Returns:
the cd number the track is on for albums with more than one CD.

Q_UINT32 itunesdb::Track::getCdCount (  )  const

Returns the number of CDs for the album of the track.

Returns:
the number of CDs for the album of the track.

Q_UINT32 itunesdb::Track::getDateAdded (  )  const [inline]

Returns the date the track was added to the database/device.

Returns:
the date the track was added to the database/device.

void itunesdb::Track::setAlbum ( const QString &  album  )  [virtual]

Sets the album for this track.

Parameters:
album the album to set.

void itunesdb::Track::setAlbumForSort ( const QString &  album  )  [virtual]

Sets the album for this track.

Parameters:
album the album to set for sort.

void itunesdb::Track::setArtist ( const QString &  artist  )  [virtual]

Sets the artist for this track.

Parameters:
artist the artist name to set.

void itunesdb::Track::setArtistNameForSort ( const QString &  artist  )  [virtual]

Sets the artist for this track used for sorting.

Parameters:
artist the artist name to set for sort.

void itunesdb::Track::setCategory ( const QString &  category  )  [virtual]

Sets the category for this track.

Parameters:
category the category to set.

void itunesdb::Track::setPathInfo ( const QString &  encodedpath  )  [virtual]

Sets the path information for this track. The path is relative to the ipod's base directory. The path separator is ":"

Parameters:
encodedpath the path information to set.

void itunesdb::Track::setComment ( const QString &  comment  )  [virtual]

Sets the comment for this track.

Parameters:
comment the comment to set.

void itunesdb::Track::setDescription ( const QString &  description_txt  )  [virtual]

Sets the description for this track.

Parameters:
description_txt the description to set.

void itunesdb::Track::setGrouping ( const QString &  grouping  )  [virtual]

Sets the grouping for this track.

Parameters:
grouping the grouping to set.

void itunesdb::Track::setGenre ( const QString &  genre  )  [virtual]

Sets the genre for this track.

Parameters:
genre the genre to set.

void itunesdb::Track::setTitle ( const QString &  title  )  [virtual]

Sets the title for this track.

Parameters:
title the title to set.

void itunesdb::Track::setTitleForSort ( const QString &  title  )  [virtual]

Sets the title for this track used for sorting.

Parameters:
title the title to set.

void itunesdb::Track::setFileFormatDesc ( const QString &  fdesc  )  [virtual]

Sets the file format description for this track.

Parameters:
fdesc the file format description to set.

void itunesdb::Track::setComposer ( const QString &  composer  )  [virtual]

Sets the composer for this track.

Parameters:
composer the composer to set.

void itunesdb::Track::setEqualizerSetting ( const QString &  eqSetting  )  [virtual]

Sets the equalizer setting for this track.

Parameters:
eqSetting the equalizer preset to set. See the itunesb wiki for details

void itunesdb::Track::setAlbumArtist ( const QString &  albumartist  )  [virtual]

Sets the name of the artist for the whole album. This may be different if it's a soundtrack for example.

Parameters:
albumartist the name of the artist for the whole album

void itunesdb::Track::setAlbumArtistForSort ( const QString &  albumartist  )  [virtual]

Sets the name of the artist for the whole album. This may be different if it's a soundtrack for example.

Parameters:
albumartist the name of the artist for the whole album used for sorting

void itunesdb::Track::setKeywords ( const QString &  keywords  )  [virtual]

Sets the list of keywords pertaining the track

Parameters:
keywords a number of keywords

void itunesdb::Track::setTrackNumber ( Q_UINT32  tracknumber  )  [virtual]

Sets the track number for this track.

Parameters:
tracknumber the track number to set.

void itunesdb::Track::setTrackCount ( Q_UINT32  numtracks  )  [virtual]

Sets the the number of tracks in the album for this track.

Parameters:
numtracks the number of tracks to set.

void itunesdb::Track::setVolumeAdjust ( Q_UINT32  newVolumeAdjust  )  [virtual]

Sets the volume adjust for this track.

Parameters:
newVolumeAdjust the volume adjust to set.

void itunesdb::Track::setYear ( Q_UINT32  newYear  )  [virtual]

Sets the year of release for this track.

Parameters:
newYear the year to set.

void itunesdb::Track::setStartTime ( Q_UINT32  startTime  )  [virtual]

Sets the start time for this track.

Parameters:
startTime the start time to set.

void itunesdb::Track::setStopTime ( Q_UINT32  stopTime  )  [virtual]

Sets the stop time for this track.

Parameters:
stopTime the stop time to set.

void itunesdb::Track::setSoundCheck ( Q_UINT32  soundCheck  )  [virtual]

Sets the soundcheck for this track.

Parameters:
soundCheck the soundcheck to set.

void itunesdb::Track::setRating ( unsigned char  rating  ) 

Sets the rating for this track.

Parameters:
rating the rating to set.

void itunesdb::Track::setLastPlayed ( Q_UINT32  lastplayed  ) 

Sets the date the track was last played.

Parameters:
lastplayed the last played date to set.

void itunesdb::Track::setPlayCount ( Q_UINT32  newPlaycount  ) 

Sets the playcount for this track.

Parameters:
newPlaycount the playcount to set.

void itunesdb::Track::setBPM ( Q_UINT32  bpm  )  [inline]

Sets the beats per minute info for this track.

Parameters:
bpm the beats per minute information to set.

QString itunesdb::Track::getFileExtension (  )  const

Returns the file extension for this track.

Returns:
the file extension for this track.

void itunesdb::Track::setFileExtension ( const QString &  fileextension  )  [virtual]

Sets the file extension for this track.

Parameters:
fileextension the file extension to set.

void itunesdb::Track::setSkipCount ( Q_UINT32  numberOfSkips  ) 

Sets the number of skips for this track

Q_UINT32 itunesdb::Track::getSkipCount (  )  const

Returns the number of times this track was skipped

Returns:
the number of times this track was skipped

void itunesdb::Track::setLastSkippedTime ( Q_UINT32  lastSkippedDateTime  ) 

Sets the time the track was skipped

Q_UINT32 itunesdb::Track::getLastSkippedTime (  )  const

Returns the time the track was skipped

Returns:
the time the track was skipped

void itunesdb::Track::setGaplessPBackData ( Q_UINT32  pregapSamples,
Q_UINT64  songSamples,
Q_UINT32  postgapSamples,
Q_UINT32  gaplessData 
)

Sets the nessessary information for gapless playback. Set all the parameters to zero if gapless playback should be disabled for this song.

Parameters:
pregapSamples Number of samples of silence before the songs starts
songSamples Number of samples in the song
postgapSamples Number of samples of silence at the end of the song
gaplessData The size in bytes from first Synch Frame (which is usually the XING frame that includes the LAME tag) until the 8th before the last frame. The gapless playback does not work for MP3 files if this is set to zero. Maybe the iPod prepares the next track when rest 8 frames in the actual track. For AAC tracks, this may be zero.

Q_UINT32 itunesdb::Track::getGaplessDataSize (  )  const

Returns the size in bytes from first Synch Frame (which is usually the XING frame that includes the LAME tag) until the 8th before the last frame.

template<class TrackMetaSource>
void itunesdb::Track::readFrom ( TrackMetaSource &  provider  )  [inline]

Copies the metadata from the given source to this Track. The Track class itself is a possible TrackMetaSource, so you can copy metadata from a track to another.

QDataStream & itunesdb::Track::writeToStream ( QDataStream &  outstream  )  [protected, virtual]

Writes track information (mhit) to the given stream.

Parameters:
outstream the stream to write the mhit to
Returns:
the given stream

QDataStream & itunesdb::Track::readFromStream ( QDataStream &  instream,
bool *  ok = NULL 
) [protected, virtual]

Reads track information (mhit) from the given stream.

Parameters:
instream the stream to read the mhit from
ok a pointer to a bool to be set to true if the read succeeds
Returns:
the given stream

void itunesdb::Track::writeData ( QByteArray &  data  )  const [protected]

void itunesdb::Track::doneAddingData (  )  [protected, virtual]

override from ListItem::doneAddingData()

Reimplemented from itunesdb::ListItem.

int itunesdb::ListItem::getType (  )  const [inherited]

returns the type ofthis item possible values from the known implementors are ITEMTYPE_PLAYLIST, ITEMTYPE_PLAYLISTITEM and ITEMTYPE_TRACK

void itunesdb::ListItem::setItemProperty ( const QString &  data,
ItemProperty  field 
) [inherited]

sets a given itunesDB item property

Parameters:
data value for the property to be set
field propertyID of the property to be set

bool itunesdb::ListItem::containsItemProperty ( ItemProperty  field  )  const [inherited]

Returns true if the given field is set with a non empty value.

Parameters:
field PropertyID of the property to be checked.
Returns:
true if the given field is set with a non empty value.

const QString & itunesdb::ListItem::getItemProperty ( ItemProperty  field  )  const [inherited]

Returns the value for the given property.

Parameters:
field PropertyID of the property to be returned.
Returns:
the value for the given property.

uint itunesdb::ListItem::getNumComponents (  )  const [inherited]

Returns the number of properties.

uint itunesdb::ListItem::getNumStringComponents (  )  const [inherited]

Returns the number of String properties.

bool itunesdb::ListItem::isDirty (  )  const [virtual, inherited]

Returns true if this database item is out of sync with the database. This is true if/when the item got changed and did not get saved back to the database yet.


The documentation for this class was generated from the following files:
Generated on Wed Nov 28 03:04:38 2007 for libqtpod by  doxygen 1.5.0