libqtpod - a C++ library providing access to the contents of an Apple iPod

0.4

This library provides access to various information stored on an Apple iPod.
At the moment this still depends on Trolltechs Qt library and I'll need help changing that for future versions since as a library we should only depend on the standard C++ libraries.

Usage

The following chapter gives a short introduction on how to use the library to open the device and access tracks, playlist and disc usage statistics.

The IPod class

To access the contents of the ipod an instance of the IPod class needs to be instantiated with the mountpoint/drive letter of the device and opened with a call to the IPod::open() method.
For linux this would probably something like that
 IPod ipod( "/media/ipod" );
and
 IPod ipod( "E:" );
in a Windows environment.
See also:
IPodMountPoint::mountedIPods() returning a list of ipods connected to the system. The IPodMountPoint::getMountPoint() method returns the String to initialize the IPod class with.
Open the device with open()
 if( !ipod.open() ) {
     // failed
 }
After the IPod instance is opened the information stored on the device is accessible and can be retrieved.

Tracks and Playlists

Information about the tracks and playlists on the iPod device is stored in a database called ITunesDB and libqtpod contains the class ITunesDB representing this database.
The now opened IPod instance holds an instance of this class which is accessible thru the IPod::getITunesDB() method:
 // get the iTunesDB instance
 ITunesDB& itunesdb = ipod.getITunesDB();

Now we can iterate over the tracks stored on the device and print out artist, album, title and filename like this
 // get an Iterator over all tracks found on the device 
 ITunesDB::TrackConstIterator iter = itunesdb.getAllTracks();
 while( iter.hasNext() ) {
     // get the next track
     ITunesDBTrack * track = iter.next();
     // print track meta data
     printf( "%s\t%s\t%s\t%s\n",
         track->getArtist().ascii(),
         track->getAlbum().ascii(),
         track->getTitle().ascii(),
         itunesdb.getFileForPathInfo( track->getPathInfo() ).ascii() );
 }
See also:
ListTracksTest::run() in listtrackstest.cpp in the "tests" directory for another example on how to list the tracks sorted by artist
Changes made to the database can be easily written back to the device by calling the IPod::synchronize() method:
 // synchronize with the device
 ipod.synchronize();

finally close your IPod instance when done
 ipod.close();
See also:
listtests.cpp showing listing of tracks, playlist and creating smart playlists

Other Testcases in the classes implementing Test in the "tests/" directory

Device Statistics

Access to the device statistics is implemented by the class IPodSysInfo accessible by calling getSysInfo() on your opened IPod instance:
 IPodSysInfo& sysinfo = ipod.getSysInfo();

Generated on Wed Nov 28 03:04:37 2007 for libqtpod by  doxygen 1.5.0