INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Temporary solution for missing opml export of podcasts  (Read 1196 times)

plm

  • Regular Member
  • Recent member
  • *
  • Posts: 5
  • nothing more to say...
Temporary solution for missing opml export of podcasts
« on: October 30, 2008, 06:04:06 pm »

Hi,

Since the opml export of podcasts is still missing, I wrote a small xsl stylesheet to convert podcasts.xml to a minimal opml file; at least it is good enough to import into squeezecenter so I can share my media center podcasts into squeezecenter.

I just apply the stylesheet with xsltproc (a simple command line tool available under linux, I guess a similar tool exists for windows). Apart from that I am a complete xsl(t) newbie, I just learned the minimum in the last hour to get this done.

Here is the stylesheet:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <opml version="1.0">
      <head>
        <title>My Podcasts</title>
      </head>
      <body>
        <xsl:for-each select="podcast/feed">
          <xsl:sort select="name"/>
          <xsl:if test="not(starts-with(name,'tv '))">
          <outline type="rss">
            <xsl:attribute name="text"><xsl:value-of select="name"/></xsl:attribute>
            <xsl:attribute name="xmlUrl"><xsl:value-of select="url"/></xsl:attribute>
          </outline>
          </xsl:if>
        </xsl:for-each>
      </body>
    </opml>
  </xsl:template>
</xsl:stylesheet>

I put it in a file named mc2opml.xsl, and generate the opml like this:
xsltproc -o /var/www/Podcasts.opml mc2opml.xsl /data/mclib/podcast.xml

Note that I omit all podcasts that start with "tv " in the name. I name all video podcasts starting with tv, and since squeezecenter can't do anything with video podcasts I wanted to filter them out.

Maybe it can help some of you until we finally have a normale opml export (why is it taking so long?).
Logged
Pages: [1]   Go Up