[AMG]: itunesdb is a Tcl library for reading iTunesDB files. If you have an iPod, this library may be of use to you. An iPod uses an iTunesDB file to store all information about its music and playlists. Most importantly, the iTunesDB file associates song titles with files in the iPod's filesystem. Get the source code at http://ioioio.net/devel/itunesdb/ . itunesdb uses [Snit]. I wrote itunesdb for [tclpod]. Right now tclpod's just a collection of GUI ideas cribbed from competing programs. Earlier versions cross-referenced itunesdb's output to allow for filtering by artist, album, etc. But I think I might switch to [sqlite] or [TclDOM] to do this work. At any rate, I don't plan to do any work on tclpod until I'm happy with itunesdb's API. I relied heavily on the source code for gtkpod [http://gtkpod.sourceforge.net/] and GNUpod [http://www.gnu.org/software/gnupod/] to help me figure out the iTunesDB file format. Unlike itunesdb, both of these programs are capable of writing iTunesDB files. I might add iTunesDB writing capability if someone needs it. But since tclpod is only intended to list and extract songs, it wasn't in the original design. While itunesdb isn't as fast as these other programs, I think its source code is easier to read. And it has the advantage of being a Tcl program. In the particular case of tclpod this was crucial because I didn't want to force the target user (my brother, as it turns out) to figure out how to compile and install some library on his iBook, whereas he already has Tcl/Tk. Anyone care to help out? ---- '''Sample Usage''' % package require itunesdb % set db [itunesdb /mnt/ipod/iPod_Control/iTunes/iTunesDB] % $db seek track % while {[$db remaining]} { array set track [$db read] puts "$track(artist) - $track(title)" } % $db destroy [[[dict]]] should make this easier and faster. :^) If anyone wants to see more, the (incomplete) source code to tclpod is available upon request. [WJR] March 13, 2005: On my OS X laptop, the sample usage above outputs several lines of this: ��ÄÄʧÄÊ∏ÄʨĂÄĉòÄÊ∞ÄʺÄÁ§ÄÊêÄ - ��ÄÄʧÄÊúÄÁåÄ‚ÄÄʺÄÊ∏Ä‚ÄÄÁêÄʆÄÊîÄ‚ÄÄ��úÄʧÄÊ∏ÄÊúÄ‚∞Ä‚ÄÄ��ÄÄÁêÄ‚∏Ä‚ÄÄ„ÑÄ This is from an iTunesDB file generated from iTunes 4.7.1. Tcl version 8.4, snit version .94. [AMG]: Hrrm, try again with 0.02, updated just today. (I don't expect this to fix anything, but at least it'll be a hell of a lot faster!!) Also I'd appreciate it if you emailed me the iTunesDB file. I don't actually have iTunes or an iPod so I have a hard time testing this thing myself. :^) It might be a byte ordering issue. itunesdb.tcl uses [[encoding convertfrom unicode $data]] to get a string from a byte array read with [[binary scan $buffer a$length data]]. [AMG]: Okay, I (hopefully) fixed it in 0.03. stupid "unicode" encoding... ---- '''To Do''' * Revamp API for use in Real programs. * More testing, particularly of the error handling and resynchronization mechanism. Also test with iTunesDB files generated by various programs, including iTunes itself. ---- '''Wish List''' * Documentation. * More speedups. * Write support. * Smart Playlist support. ---- '''Changelog''' 11 August 2004 - version 0.01 (renamed from 0.1.0) * Initial release. 15 March 2005 - version 0.02 * Minor tweak to API. Not backward-compatible. * ''Major'' speedups. * Workaround for weird playlists made by iTunes. 17 March 2005 - version 0.03 * Support for group, samp_rate, volume, add_time, and bpm. * Fixed bad file format reporting. * Workaround for incorrect UTF-16 byte order on big-endian machines. * Support for iPod Shuffle ---- What: itunesdb Where: http://ioioio.net/devel/itunesdb/ Description: Tcl library for reading iTunesDB files. Version: 0.03 Updated: 17 March 2004 Contact: Andy Goth ---- [[ [Category Package] | [Category Multimedia] | [Category Database] | [Category Sound] ]]