2005-11-12, 09:01 AM
Hi,
maybe someone is also interested in this.
Since gbpvr is only using the 'title', 'sub-title' and 'desc' tags of xmltv files for generating epg data, but xmltv files can contain much more information, i've written a small xsl-file as a workaround to put those other information into the 'desc'-tag.
Currently the nodes 'episode-num', 'category', 'country', 'date', 'credits' and 'rating' are used.
I'm german so it is targetted to a german gbpvr and contains some german words like 'Buch' or 'Moderation', but it should be easy to translate it in any other language you want.
Here it is:
For example, the output of this programme:
looks like this:
I'm using saxon as xml processor, but it should also work with any other.
-alibert
maybe someone is also interested in this.
Since gbpvr is only using the 'title', 'sub-title' and 'desc' tags of xmltv files for generating epg data, but xmltv files can contain much more information, i've written a small xsl-file as a workaround to put those other information into the 'desc'-tag.
Currently the nodes 'episode-num', 'category', 'country', 'date', 'credits' and 'rating' are used.
I'm german so it is targetted to a german gbpvr and contains some german words like 'Buch' or 'Moderation', but it should be easy to translate it in any other language you want.
Here it is:
Code:
<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method="xml" indent="yes" encoding="iso-8859-1"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="/tv/programme">
<xsl:copy>
<xsl:apply-templates select="@*" />
<xsl:apply-templates select="title" />
<xsl:apply-templates select="sub-title" />
<desc>
<xsl:apply-templates select="episode-num" />
<xsl:apply-templates select="category" />
<xsl:apply-templates select="country" />
<xsl:apply-templates select="date" />
<xsl:apply-templates select="desc" />
<xsl:apply-templates select="credits" />
<xsl:apply-templates select="rating" />
</desc>
</xsl:copy>
</xsl:template>
<xsl:template match="/tv/programme/title">
<xsl:copy><xsl:apply-templates select="@*|node()" /></xsl:copy>
</xsl:template>
<xsl:template match="/tv/programme/sub-title">
<xsl:copy><xsl:apply-templates select="@*|node()" /></xsl:copy>
</xsl:template>
<xsl:template match="/tv/programme/episode-num">
<xsl:text>Folge </xsl:text><xsl:value-of select="." />
<xsl:choose>
<xsl:when test="not(../category) and not(../country) and not(../date)"><xsl:text>
</xsl:text></xsl:when>
<xsl:otherwise><xsl:text> | </xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/tv/programme/category">
<xsl:value-of select="." />
<xsl:choose>
<xsl:when test="not(../country) and not(../date)"><xsl:text>
</xsl:text></xsl:when>
<xsl:otherwise><xsl:text> | </xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/tv/programme/country">
<xsl:value-of select="." />
<xsl:choose>
<xsl:when test="not(../date)"><xsl:text>
</xsl:text></xsl:when>
<xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/tv/programme/date">
<xsl:value-of select="." /><xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="/tv/programme/desc">
<xsl:value-of select="." /><xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="/tv/programme/credits">
<xsl:apply-templates select="presenter" />
<xsl:apply-templates select="guest" />
<xsl:apply-templates select="producer" />
<xsl:apply-templates select="director" />
<xsl:apply-templates select="actor" />
<xsl:apply-templates select="writer" />
</xsl:template>
<xsl:template match="/tv/programme/credits/presenter">
<xsl:if test="position()=1">Moderation: </xsl:if>
<xsl:value-of select="." />
<xsl:call-template name="comma"/>
<xsl:call-template name="newline"/>
</xsl:template>
<xsl:template match="/tv/programme/credits/guest">
<xsl:if test="position()=1">Zu Gast: </xsl:if>
<xsl:value-of select="." />
<xsl:call-template name="comma"/>
<xsl:call-template name="newline"/>
</xsl:template>
<xsl:template match="/tv/programme/credits/producer">
<xsl:if test="position()=1">Von: </xsl:if>
<xsl:value-of select="." />
<xsl:call-template name="comma"/>
<xsl:call-template name="newline"/>
</xsl:template>
<xsl:template match="/tv/programme/credits/director">
<xsl:if test="position()=1">Regie: </xsl:if>
<xsl:value-of select="." />
<xsl:call-template name="comma"/>
<xsl:call-template name="newline"/>
</xsl:template>
<xsl:template match="/tv/programme/credits/actor">
<xsl:if test="position()=1">Mit: </xsl:if>
<xsl:value-of select="." />
<xsl:call-template name="comma"/>
<xsl:call-template name="newline"/>
</xsl:template>
<xsl:template match="/tv/programme/credits/writer">
<xsl:if test="position()=1">Buch: </xsl:if>
<xsl:value-of select="." />
<xsl:call-template name="comma"/>
<xsl:call-template name="newline"/>
</xsl:template>
<xsl:template match="/tv/programme/rating">
<xsl:if test="@system='FSK'">FSK: <xsl:value-of select="value/." /></xsl:if>
</xsl:template>
<xsl:template name="comma"><xsl:if test="not(position()=last())">, </xsl:if></xsl:template>
<xsl:template name="newline">
<xsl:if test="position()=last()">
<xsl:text>
</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
For example, the output of this programme:
Code:
<programme start="20051111051000 +0100" stop="20051111055000 +0100" showview="98-25-430" channel="rtl2.de">
<title lang="de">Hallo Holly</title>
<sub-title lang="de">Die coole ältere Schwester / Ein alter Papagei</sub-title>
<desc lang="de">Valerie beschlieÃt die Zügel bei Holly etwas lockerer zu lassen, da sie sich durch die ständigen Gebote wie eine strenge Mutter vorkommt. Holly nutzt das natürlich sofort aus. Dabei setzt sie ihre neu erworbene Freiheit gleich wieder aufs Spiel...</desc>
<credits>
<director>Shelley Jensen</director>
<actor>Amanda Bynes</actor>
<actor>Jennie Garth</actor>
</credits>
<date>2002</date>
<category lang="de">Comedy-Serie</category>
<country lang="de">USA</country>
<video>
<present>yes</present>
<colour>yes</colour>
</video>
<audio>
<present>yes</present>
<stereo>mono</stereo>
</audio>
</programme>
looks like this:
Code:
<programme start="20051110170000 +0100" stop="20051110180000 +0100" showview="731-294" channel="rtl2.de" clumpidx="0/1">
<title>Hallo Holly</title>
<sub-title lang="de">Die coole ältere Schwester / Ein alter Papagei</sub-title>
<desc>Comedy-Serie | USA, 2002
Valerie beschlieÃt die Zügel bei Holly etwas lockerer zu lassen, da sie sich durch die ständigen Gebote wie eine strenge Mutter vorkommt. Holly nutzt das natürlich sofort aus. Dabei setzt sie ihre neu erworbene Freiheit gleich wieder aufs Spiel...
Regie: Shelley Jensen
Mit: Amanda Bynes, Jennie Garth
</desc>
</programme>
I'm using saxon as xml processor, but it should also work with any other.
-alibert