I made an xslt to convert the Itunes Playlist to Volumio playlist.
Steps:
- Export any ITunes playlist in xml format
- Modify the xsl with your data: replace the two variables source1 and target1 with he information of your source and target location
- Apply xsl (I’m using Notepad++ with XML Tools)
- Save and copy (I’m using WinSCP) to /data/playlist
- Enjoy!
Let me know if it works for you.
<?xml version="1.0"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:text>[
</xsl:text>
<xsl:apply-templates select="/plist/dict/array[preceding-sibling::key[1]='Playlists']/dict/array[preceding-sibling::key[1]='Playlist Items']/dict"/>
<xsl:text>]
</xsl:text>
</xsl:template>
<xsl:template name="string-replace-all">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="by"/>
<xsl:choose>
<xsl:when test="contains($text,$replace)">
<xsl:value-of select="substring-before($text,$replace)"/>
<xsl:value-of select="$by"/>
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
<xsl:with-param name="replace" select="$replace"/>
<xsl:with-param name="by" select="$by"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/plist/dict/array/dict/array/dict">
<xsl:variable name="key" as="xs:string">
<xsl:value-of select="integer"/>
</xsl:variable>
<xsl:variable name="source1" select="'file://localhost/Z:/'"/>
<xsl:variable name="target1" select="'NAS/music/'"/>
<xsl:variable name="location" select="/plist/dict/dict/dict[preceding-sibling::key=$key][1]/string[preceding-sibling::key='Location'][1]" disable-output-escaping="yes"/>
<xsl:variable name="artist" select="/plist/dict/dict/dict[preceding-sibling::key=$key][1]/string[preceding-sibling::key='Artist'][1]"/>
<xsl:variable name="album" select="/plist/dict/dict/dict[preceding-sibling::key=$key][1]/string[preceding-sibling::key='Album'][1]"/>
<xsl:variable name="title" select="/plist/dict/dict/dict[preceding-sibling::key=$key][1]/string[preceding-sibling::key='Name'][1]"/>
<xsl:variable name="uritemp">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$location"/>
<xsl:with-param name="replace" select="$source1"/>
<xsl:with-param name="by" select="$target1"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="uri">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$uritemp"/>
<xsl:with-param name="replace" select="'%20'"/>
<xsl:with-param name="by" select="' '"/>
</xsl:call-template>
</xsl:variable>
<xsl:text> {</xsl:text>
<xsl:text>
"service": "mpd",</xsl:text>
<xsl:text>
"uri": "</xsl:text>
<xsl:value-of select="$uri" disable-output-escaping="yes"/>
<xsl:text>",</xsl:text>
<xsl:text>
"title": "</xsl:text>
<xsl:value-of select="$title"/>
<xsl:text>",</xsl:text>
<xsl:text>
"artist": "</xsl:text>
<xsl:value-of select="$artist"/>
<xsl:text>",</xsl:text>
<xsl:text>
"album": "</xsl:text>
<xsl:value-of select="$album"/>
<xsl:text>",</xsl:text>
<xsl:text>
"albumart": "</xsl:text>
<xsl:text>/albumart?web=</xsl:text>
<xsl:value-of select= "$artist" /><xsl:text>/</xsl:text><xsl:value-of select= "$album" />
<!--<xsl:text>'/extralarge&path=%2Fmnt%2F</xsl:text>
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$location"/>
<xsl:with-param name="replace" select="$source1"/>
<xsl:with-param name="by" select="$target1"/>
</xsl:call-template>-->
<xsl:text>"</xsl:text>
<xsl:text>
}</xsl:text>
<xsl:choose>
<xsl:when test="position() != last()">,
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="text">
<body>
<xsl:value-of select="." disable-output-escaping="yes" />
</body>
</xsl:template>
</xsl:transform>