Hace varios dias, una prima me habia pedido hacer una playlist, pensando en como podia presentarsela en linea, busque un formato para playlists que fuera diseñado para ser distribuido en linea, la respuesta fue XSPF (http://xspf.org/), el cual cumplía todos mis requerimientos, además de tener una gran cantidad de reproductores y aplicaciones disponibles.

Así que alegremente me dispuse a crear la lista de reproducción, en iTunes, obviando el hecho que no habia forma automatizada de convertir de un formato a otro, por esto me dedique unas horas a crear iTunesXSPF, un XSLT que convierte de el formato playlist XML de iTunes a XSPF.

Para usarlo simplemente exporta tu playlist de iTunes en formato XML, descarga el archivo en el mismo folder, luego abre la playlist con un editor de texto y sustituye para que quede:

 <?xml version="1.0" encoding="UTF-8"?>
 <?xml-stylesheet type="text/xsl" href="itunes.xsl"?>
 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

Tambien si tienes xsltproc puedes ejecutar

xsltproc playlist.xml itunes.xsl lista.xspf

Incluyo todo el codigo a continuación

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?xml version="1.0"?>
<!-- iTunesXSPF, by Sebastian Oliva (tian@sebastianoliva.com) [http://sebastianoliva.com]
Copyright (C) 2009,2010 Sebastian Oliva
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.
 
You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
	<xsl:template match="/">
		<playlist xmlns="http://xspf.org/ns/0/" version="1">
		  <!-- Add your Own Info Here -->
			<title>Playlist</title>
			<creator>Me</creator>
			<info>http://example.com/</info>
			<!-- Editing Further is unsafe -->
			<trackList>
				<xsl:for-each select="plist/dict/array/dict/array/dict">
					<xsl:variable name="Traki"><xsl:apply-templates select="key[. = 'Track ID']" mode="content"/></xsl:variable>
					<xsl:for-each select="/plist/dict/dict/dict">
						<xsl:if test="key[. = 'Track ID']/following-sibling::*/text() = $Traki">
							<track>
								<title><xsl:apply-templates select="key[. = 'Name']" mode="content"/></title>
								<creator><xsl:apply-templates select="key[. = 'Artist']" mode="content"/></creator>
								<album><xsl:apply-templates select="key[. = 'Album']" mode="content"/></album>
								<location><xsl:apply-templates select="key[. = 'Location']" mode="content"/></location>
								<annotation><xsl:apply-templates select="key[. = 'Comments']" mode="content"/></annotation>
								<duration><xsl:apply-templates select="key[. = 'Total Time']" mode="content"/></duration>
							</track>
						</xsl:if>
					</xsl:for-each>
				</xsl:for-each>
			</trackList>
		</playlist>
	</xsl:template>
 
	<xsl:template match="key" mode="content">
		<xsl:value-of select="following-sibling::*/text()"/>
	</xsl:template>
	<xsl:template match="trim" mode="content">
		<xsl:value-of select="following-sibling::*/text()"/>
	</xsl:template>
</xsl:stylesheet>

Obtenlo en: github.com/tian2992/iTunesXSPF

This post is also available in: Inglés