diff options
author | Antti Ajanki <antti.ajanki@iki.fi> | 2011-08-07 21:06:55 +0300 |
---|---|---|
committer | Antti Ajanki <antti.ajanki@iki.fi> | 2011-08-07 21:06:55 +0300 |
commit | 656cb54aea18035ce33abe44e766ed625aba90e8 (patch) | |
tree | 6d93ef5c11aaafacf67c686b4e9bb8b3b6f7f731 | |
parent | 2b967d6f1db08fcce751aab22e1caf87b2a4f320 (diff) | |
download | vdr-plugin-webvideo-656cb54aea18035ce33abe44e766ed625aba90e8.tar.gz vdr-plugin-webvideo-656cb54aea18035ce33abe44e766ed625aba90e8.tar.bz2 |
cleanup Katsomo titles
-rw-r--r-- | templates/katsomo.fi/description.xsl | 17 | ||||
-rw-r--r-- | templates/katsomo.fi/program.xsl | 19 |
2 files changed, 31 insertions, 5 deletions
diff --git a/templates/katsomo.fi/description.xsl b/templates/katsomo.fi/description.xsl index 59c313b..1a7d39b 100644 --- a/templates/katsomo.fi/description.xsl +++ b/templates/katsomo.fi/description.xsl @@ -12,18 +12,27 @@ <xsl:variable name="episodetitle"> <xsl:choose> <xsl:when test="contains(/html/head/meta[@name='title']/@content, ' - Katsomo')"> - <xsl:value-of select="substring-before(/html/head/meta[@name='title']/@content, ' - Katsomo')"/> + <xsl:value-of select="normalize-space(substring-before(/html/head/meta[@name='title']/@content, ' - Katsomo'))"/> </xsl:when> <xsl:when test="contains(/html/head/meta[@name='title']/@content, ' - MTV3 Katsomo')"> - <xsl:value-of select="substring-before(/html/head/meta[@name='title']/@content, ' - MTV3 Katsomo')"/> + <xsl:value-of select="normalize-space(substring-before(/html/head/meta[@name='title']/@content, ' - MTV3 Katsomo'))"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="/html/head/meta[@name='title']/@content"/> + <xsl:value-of select="normalize-space(/html/head/meta[@name='title']/@content)"/> </xsl:otherwise> </xsl:choose> </xsl:variable> -<xsl:variable name="title" select="normalize-space(concat(id('program_content')/h1, ' ', $episodetitle))"/> +<xsl:variable name="title"> + <xsl:choose> + <xsl:when test="normalize-space(id('program_content')/h1) = $episodetitle"> + <xsl:value-of select="$episodetitle"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space(concat(id('program_content')/h1, ': ', $episodetitle))"/> + </xsl:otherwise> + </xsl:choose> +</xsl:variable> <xsl:variable name="pid" select="substring-after($docurl, 'progId=')"/> diff --git a/templates/katsomo.fi/program.xsl b/templates/katsomo.fi/program.xsl index f1c527a..63def55 100644 --- a/templates/katsomo.fi/program.xsl +++ b/templates/katsomo.fi/program.xsl @@ -6,6 +6,23 @@ exclude-result-prefixes="str"> <xsl:template match="div[contains(@class, 'item')]"> + <xsl:variable name="episodetitle"> + <xsl:value-of select="normalize-space(div[@class='row2']/a)"/> + </xsl:variable> + <xsl:variable name="programtitle"> + <xsl:value-of select="normalize-space(id('program_content')/h1)"/> + </xsl:variable> + <xsl:variable name="title"> + <xsl:choose> + <xsl:when test="$programtitle = $episodetitle"> + <xsl:value-of select="$programtitle"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($programtitle, ': ', $episodetitle)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> <xsl:when test="div[@class='row1']/span[@class='live']"> <xsl:variable name="upcoming" select="concat(div[@class='row1']/span[@class='live'], ' ', div[@class='row1']/span[contains(@class, 'time')])"/> @@ -19,7 +36,7 @@ <link> <label><xsl:value-of select="div[@class='row2']/a"/></label> <ref>wvt:///katsomo.fi/description.xsl?srcurl=<xsl:value-of select="str:encode-uri(div[@class='row2']/a/@href, true())"/></ref> - <stream>wvt:///katsomo.fi/video.xsl?param=pid,<xsl:value-of select="substring-after(div[@class='row2']/a/@href, 'progId=')"/>&param=title,<xsl:value-of select="normalize-space(str:encode-uri(concat(id('program_content')/h1, ' ', div[@class='row2']/a), true()))"/></stream> + <stream>wvt:///katsomo.fi/video.xsl?param=pid,<xsl:value-of select="substring-after(div[@class='row2']/a/@href, 'progId=')"/>&param=title,<xsl:value-of select="str:encode-uri($title, true())"/></stream> </link> </xsl:otherwise> </xsl:choose> |