| May 2007 Archives | ||||||||||
|
May 11, 2007
Update (May 21st, 2008): Mike Hudson writes that the latest version of SqueezeCenter can now read iTunes XML, playlists included. However one still needs to change the location of the files within the XML file. 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 ) May 04, 2007
|
Ccol stuff
Search
More from me
Topics
Anteater (2)
Apple (43) Arduino (5) Cars (5) Cocoon (26) Cool gadgets (13) Emacs (24) Google (16) Hardware (9) Java (31) JavaScript (2) Linux (12) Music (4) Open Source (21) People (2) Photo (23) Politics (1) Random (39) Travel (4) Web services (3) Weblogs (30) XSLT (12)
Archives
June 2011
December 2010 September 2010 August 2010 June 2010 June 2009 May 2009 April 2009 February 2008 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
People
Admin
|
|||||||||