<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>libqtpod: libqtpod - a C++ library providing access to the contents of an Apple iPod</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.0 --> <div class="tabs"> <ul> <li id="current"><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul></div> <h1>libqtpod - a C++ library providing access to the contents of an Apple iPod</h1> <p> <h3 align="center">0.4 </h3>This library provides access to various information stored on an Apple iPod. <br> 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. <h2><a class="anchor" name="Usage"> Usage</a></h2> The following chapter gives a short introduction on how to use the library to open the device and access <a class="el" href="index.html#itunesdb">tracks, playlist</a> and <a class="el" href="index.html#statistics">disc usage statistics</a>. <br> <h2><a class="anchor" name="ipod"> The IPod class</a></h2> To access the contents of the ipod an instance of the <a class="el" href="classIPod.html">IPod</a> class needs to be instantiated with the mountpoint/drive letter of the device and opened with a call to the <a class="el" href="classIPod.html#6d6612bc70103af89dbc27edd34edf64">IPod::open()</a> method. <br> For linux this would probably something like that <div class="fragment"><pre class="fragment"> <a class="code" href="classIPod.html">IPod</a> ipod( <span class="stringliteral">"/media/ipod"</span> ); </pre></div> and <div class="fragment"><pre class="fragment"> <a class="code" href="classIPod.html">IPod</a> ipod( <span class="stringliteral">"E:"</span> ); </pre></div> in a Windows environment. <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classIPodMountPoint.html#0d733691d30d0894b9a02db844d2885b">IPodMountPoint::mountedIPods()</a> returning a list of ipods connected to the system. The <a class="el" href="classIPodMountPoint.html#62bb38bd985f12f1a22315efc7a20172">IPodMountPoint::getMountPoint()</a> method returns the String to initialize the <a class="el" href="classIPod.html">IPod</a> class with.</dd></dl> Open the device with open() <div class="fragment"><pre class="fragment"> <span class="keywordflow">if</span>( !ipod.open() ) { <span class="comment">// failed</span> } </pre></div> After the <a class="el" href="classIPod.html">IPod</a> instance is opened the information stored on the device is accessible and can be retrieved. <br> <h2><a class="anchor" name="itunesdb"> Tracks and Playlists</a></h2> Information about the tracks and playlists on the iPod device is stored in a database called <a class="el" href="classITunesDB.html">ITunesDB</a> and libqtpod contains the class <a class="el" href="classITunesDB.html">ITunesDB</a> representing this database. <br> The now opened <a class="el" href="classIPod.html">IPod</a> instance holds an instance of this class which is accessible thru the <a class="el" href="classIPod.html#22bca31b67cf1a37547767006662e483">IPod::getITunesDB()</a> method: <div class="fragment"><pre class="fragment"> <span class="comment">// get the iTunesDB instance</span> <a class="code" href="classITunesDB.html">ITunesDB</a>& itunesdb = ipod.getITunesDB(); </pre></div> <br> Now we can iterate over the tracks stored on the device and print out artist, album, title and filename like this <div class="fragment"><pre class="fragment"> <span class="comment">// get an Iterator over all tracks found on the device </span> <a class="code" href="structITunesDB_1_1FilteredTrackConstIterator.html">ITunesDB::TrackConstIterator</a> iter = itunesdb.<a class="code" href="classITunesDB.html#1f1f64946024cce1daf6276dbf79feaf">getAllTracks</a>(); <span class="keywordflow">while</span>( iter.<a class="code" href="classitunesdb_1_1utils_1_1SortablePtrVector_1_1ContainerVersionAwareIterator.html#aa284de7fc6f564e65c8e7ed5a0fd16e">hasNext</a>() ) { <span class="comment">// get the next track</span> <a class="code" href="classITunesDBTrack.html">ITunesDBTrack</a> * track = iter.<a class="code" href="classitunesdb_1_1utils_1_1RangeIterator.html#4ec45e4263c7e0a476d89f5ee19f3f2b">next</a>(); <span class="comment">// print track meta data</span> printf( <span class="stringliteral">"%s\t%s\t%s\t%s\n"</span>, track->getArtist().ascii(), track->getAlbum().ascii(), track->getTitle().ascii(), itunesdb.getFileForPathInfo( track->getPathInfo() ).ascii() ); } </pre></div> <dl class="see" compact><dt><b>See also:</b></dt><dd>ListTracksTest::run() in <a class="el" href="listtrackstest_8cpp-example.html">listtrackstest.cpp</a> in the "tests" directory for another example on how to list the tracks sorted by artist</dd></dl> Changes made to the database can be easily written back to the device by calling the <a class="el" href="classIPod.html#7c087e156b40e2bb2faee7460f29673e">IPod::synchronize()</a> method: <div class="fragment"><pre class="fragment"> <span class="comment">// synchronize with the device</span> ipod.synchronize(); </pre></div> <br> finally close your <a class="el" href="classIPod.html">IPod</a> instance when done <div class="fragment"><pre class="fragment"> ipod.close(); </pre></div> <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="listtests_8cpp-example.html">listtests.cpp</a> showing listing of tracks, playlist and creating smart playlists <p> Other Testcases in the classes implementing <a class="el" href="classTest.html">Test</a> in the "tests/" directory <br> </dd></dl> <h2><a class="anchor" name="statistics"> Device Statistics</a></h2> Access to the device statistics is implemented by the class <a class="el" href="classIPodSysInfo.html">IPodSysInfo</a> accessible by calling getSysInfo() on your opened <a class="el" href="classIPod.html">IPod</a> instance: <div class="fragment"><pre class="fragment"> <a class="code" href="classIPodSysInfo.html">IPodSysInfo</a>& sysinfo = ipod.getSysInfo(); </pre></div> <hr size="1"><address style="align: right;"><small>Generated on Wed Dec 19 00:15:19 2007 for libqtpod by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.0 </small></address> </body> </html>