libipod is licensed under the Lesser GNU Public License (LGPL), which basically means that this the code may be used in either Open or Closed source programs, as long as the source of libipod is made available on request. For more information on the license, please read the the file "COPYING", which is included with the source distribution, or view the text of the LGPL at http://www.gnu.org/copyleft/lesser.html
This project is hosted by Sourceforge, at http://libipod.sourceforge.net.
Project files can be downloaded from http://sourceforge.net/projects/libipod.
We encourage code contributions and assistance from the community on this project. In particular, we are interested in language bindings in order to make iPod support easy for developers to include in their projects.
#include "ipod/ipod_cpp.h" #include "ipod/ipod_constants.h" #include <iostream> using namespace std; int main(int argc,char **argv) { string *ipod_paths; int ipod_count = IPod::Discover(&ipod_paths); for (int ipod_index=0;ipod_index<ipod_count;ipod_index++) { string path = ipod_paths[ipod_index]; IPod ipod(path); cout << "iPod at " << path << " (" << ipod.TrackCount() << " tracks, " << ipod.PlaylistCount() << " playlists)" << endl; for (unsigned long i=0;i<ipod.TrackCount();i++) { IPodTrack track = ipod.TrackByIndex(i); string title = track.GetText(IPOD_TITLE); string artist = track.GetText(IPOD_ARTIST); uint32_t trackID = track.GetAttribute(IPOD_TRACK_ID); cout << " Index " << i << " TrackID " << trackID << ": '" << title << "' " << artist << endl; } for (unsigned long i=0;i<ipod.PlaylistCount();i++) { IPodPlaylist playlist = ipod.PlaylistByIndex(i); string name = playlist.GetText(IPOD_TITLE); cout << endl << "Playlist " << i << ": '" << name << "' (" << playlist.TrackItemCount() << " tracks)" << endl; for (unsigned long j=0;j<playlist.TrackItemCount();j++) { IPodTrackItem item = playlist.TrackItemByIndex(j); uint32_t trackID = item.GetAttribute(IPOD_TRACK_ITEM_TRACK_ID); IPodTrack track = ipod.TrackByTrackID(trackID); string title = track.GetText(IPOD_TITLE); cout << " Index " << j << " TrackID " << trackID << ": '" << title << "'" << endl; } } } }
user@host:~$ python -c "import ipod; help(ipod)"
from ipod import * paths = IPod.paths() if len(paths): ipod = IPod(paths[0]) total,free = ipod.diskUsage() print "iPod at %s (total %dK, free %dK)" % (paths[0],total,free) for track in ipod.tracks: print " TrackID %d: %s - %s/%s (%s)" % (track.id,track.title,track.artist,track.album,track.fileType) for playlist in ipod.playlists: print "Playlist: %s" % playlist.name for trackItem in playlist.trackItems: print " TrackID %d: %s" % (trackItem.id,ipod.trackForID(trackItem.id).title) for preset in ipod.eqPresets: print "Preset: %s preamp %d" % (preset.name,preset.preamp), print [preset.bandA[i] for i in xrange(10)], print [preset.bandB[i] for i in xrange(5)] else: print "no iPods found!"
"Apple", "iPod", and "iTunes" are registered trademarks of Apple Computer, Inc. "Shuffle" is a trademark of Apple Computer, Inc. "iTunes Music Store" is a service mark of Apple Computer, Inc.
"Linspire" is a trademark of Linspire, Inc.
This project is neither sponsored nor endorsed by Apple Computer, Inc