| May 2007 Archives | |||||||||||
|
May 11, 2007
iTunes stores information about your music library into an XML file. Its format is the so-called plist, a rather unusual XML format. Its biggest flaw is that name value pairs are consecutive XML elements, rather than being associated. For example, this is an excerpt from the description of a song: <key>585</key> <dict> <key>Track ID</key><integer>585</integer> <key>Name</key><string>Hells Bells</string> <key>Artist</key><string>AC/DC</string> ... </dict> The problem of is that you have to rely on the position of elements to figure out what they mean. An alternative would have been to represent the value as an attribute of the
<key name="585">
<dict>
<key name="Track ID" integer="585"/>
<key name="Name" string="Hells Bells"/>
<key name="Artist" string="AC/DC"/>
...
</dict>
</key>
In any case, the format is what it is, so I had to deal with it. I wrote a small XSLT program to extract the playlist information and generate the m3u playlists. It is called iTunes-to-m3u.xsl, and you can run it like this to generate the m3u playlists: java -jar saxon8.jar ~/Music/iTunes/iTunes\ Music\ Library.xml iTunes-to-m3u.xsl The XSLT engine used above is Saxon 8, an excellent XSLT
2.0 implementation. You might be able to use other engines too,
including 1.0 ones. However if you do that you need to change the
Depending on your setup, you might need to translate
(cd /tmp mkdir -p playlists cd playlists rm -f *.m3u *.new ~/bin/saxon ~/Music/iTunes/iTunes\ Music\ Library.xml ~/src/iTunes-to-m3u.xsl; for f in *.m3u; do sed -e 's/%20/ /g' -e 's%/Volumes/BigDisk/Users%/home%g' <"$f" >"$f.new"; mv "$f.new" "$f" done scp *.m3u music:~/Music/Playlists ) Posted by ovidiu at 09:30 PM
| Comments (0)
May 04, 2007
Posted by ovidiu at 01:05 AM
| Comments (0)
|
Stuff
Search
Archives
November 2007
July 2007 June 2007 May 2007 April 2007 October 2006 August 2006 June 2006 April 2006 March 2006 February 2006 January 2006 December 2005 November 2005 October 2005 September 2005 July 2005 June 2005 April 2005 March 2005 February 2005 October 2004 September 2004 August 2004 June 2004 May 2004 April 2004 March 2004 February 2004 January 2004 December 2003 November 2003 October 2003 September 2003 August 2003 July 2003 June 2003 May 2003 April 2003 March 2003 February 2003 January 2003 December 2002 November 2002 October 2002 September 2002 August 2002 July 2002 June 2002
Topics
Anteater (2)
Apple (43) Cars (3) Cocoon (26) Cool gadgets (11) Emacs (24) Google (16) Hardware (4) Java (31) JavaScript (2) Linux (11) Open Source (16) People (1) Photo (20) Random (42) Travel (4) Web services (3) Weblogs (30) XSLT (12)
News
People
Amit Patel Catalin Popescu ![]() Mihai Budiu ![]() Bertrand Delacrétaz ![]() Bill Bumgarner ![]() Cocoon and more - Carsten Ziegeler ![]() Costin Manolache ![]() Christine Davis' Continuations ![]() Fazal Majid ![]() Jason Shellen ![]() Steve Jenson - saladwithsteve.com Marcus Crafter ![]() Matt Cutts: Gadgets, Google and SEO ![]() Matthew Langham ![]() Pankaj Kumar ![]() Piaw's Blog ![]() Sylvain Wallez ![]() Outer Web Thought Log - Steven Noels ![]()
Admin
|
||||||||||