update of stylesheet; ported to new make install of eogd; minor changes

This commit is contained in:
horchi
2016-06-01 10:18:45 +02:00
parent 34298b6bc4
commit 5f062bc796
4 changed files with 205 additions and 334 deletions

View File

@@ -22,7 +22,7 @@ $(SOFILE): $(OBJS)
$(CC) $(CFLAGS) -shared $(OBJS) $(LIBS) -o $@ $(CC) $(CFLAGS) -shared $(OBJS) $(LIBS) -o $@
install: $(SOFILE) install-config install: $(SOFILE) install-config
install -D $(SOFILE) $(PLGDEST)/ install -D $(SOFILE) $(_PLGDEST)/
clean: clean:
@-rm -f $(OBJS) core* *~ *.so @-rm -f $(OBJS) core* *~ *.so

View File

@@ -1,347 +1,217 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/xhtml1/strict"
xmlns:exsl="http://exslt.org/common" xmlns:exsl="http://exslt.org/common"
xmlns:date="http://exslt.org/dates-and-times" xmlns:date="http://exslt.org/dates-and-times"
xmlns:str="http://exslt.org/strings" xmlns:str="http://exslt.org/strings">
version="1.0"
xmlns="http://www.w3.org/TR/xhtml1/strict">
<xsl:variable name="mapping" select="document('tvsp-category.xml')/mapping"/> <xsl:variable name="mapping" select="document('tvsp-category.xml')/mapping" />
<xsl:variable name="categorieMapping" select="$mapping/categories/category/contains"/> <xsl:variable name="categorieMapping" select="$mapping/categories/category/contains" />
<xsl:template match="/"> <xsl:template match="/">
<events> <events>
<xsl:for-each select="//Event"> <xsl:for-each select="//Event">
<xsl:if test="number(id) = id"> <xsl:if test="number(id) = id">
<event> <event>
<!-- bis eventid im Backend erweitert <!-- bis eventid im Backend erweitert
<xsl:attribute name="id"><xsl:value-of select="id"/></xsl:attribute> <xsl:attribute name="id"><xsl:value-of select="id"/></xsl:attribute>
--> -->
<xsl:attribute name="id"> <xsl:attribute name="id"><xsl:value-of select="number(substring(id,4))"/></xsl:attribute>
<xsl:value-of select="number(substring(id,4))"/>
</xsl:attribute>
<starttime> <starttime><xsl:value-of select="timestart"/></starttime>
<xsl:value-of select="timestart"/> <duration><xsl:value-of select="substring-after(lengthNetAndGross,'/') * 60"/></duration>
</starttime> <title><xsl:value-of select="title"/></title>
<duration>
<xsl:value-of select="substring-after(lengthNetAndGross,'/') * 60"/>
</duration>
<title>
<xsl:value-of select="title"/>
</title>
<xsl:choose>
<xsl:when test="string-length(episodeTitle)>0">
<shorttext>
<xsl:value-of select="episodeTitle"/>
</shorttext>
</xsl:when>
<xsl:when test="string-length(subline)>0">
<shorttext>
<xsl:value-of select="subline"/>
</shorttext>
</xsl:when>
<xsl:when test="string-length(originalTitle)>0">
<shorttext>
<xsl:value-of select="originalTitle"/>
</shorttext>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="sart_id = 'SP'">
<category>Spielfilm</category>
</xsl:when>
<xsl:when test="sart_id = 'SE'">
<category>Serie</category>
</xsl:when>
<xsl:when test="sart_id = 'KIN'">
<category>Kinder</category>
</xsl:when>
<xsl:when test="sart_id = 'SPO'">
<category>Sport</category>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="mapping">
<xsl:with-param name="str" select="genre"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="string-length(genre)">
<xsl:choose>
<xsl:when test="substring(genre,string-length(genre)-5) = 'sserie' and
not(contains('aeiou',substring(genre,string-length(genre)-6,1)))">
<genre>
<xsl:value-of select="substring(genre,1,string-length(genre)-6)"/>
</genre>
</xsl:when>
<xsl:when test="substring(genre,string-length(genre)-4) = 'serie'">
<genre>
<xsl:value-of select="substring(genre,1,string-length(genre)-5)"/>
</genre>
</xsl:when>
<xsl:when test="substring(genre,string-length(genre)-5) = '-Serie'">
<genre>
<xsl:value-of select="substring(genre,1,string-length(genre)-6)"/>
</genre>
</xsl:when>
<xsl:when test="substring(genre,string-length(genre)-5) = 'sreihe' and
not(contains('aeiou',substring(genre,string-length(genre)-6,1)))">
<genre>
<xsl:value-of select="substring(genre,1,string-length(genre)-6)"/>
</genre>
</xsl:when>
<xsl:when test="substring(genre,string-length(genre)-4) = 'reihe'">
<genre>
<xsl:value-of select="substring(genre,1,string-length(genre)-5)"/>
</genre>
</xsl:when>
<xsl:otherwise>
<genre>
<xsl:value-of select="genre"/>
</genre>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="string-length(year)">
<year>
<xsl:value-of select="year"/>
</year>
</xsl:if>
<xsl:if test="string-length(country)">
<country>
<xsl:value-of select="country"/>
</country>
</xsl:if>
<xsl:if test="string-length(fsk)">
<parentalrating>
<xsl:value-of select="fsk"/>
</parentalrating>
</xsl:if>
<xsl:if test="string-length(director)">
<director>
<xsl:value-of select="director"/>
</director>
</xsl:if>
<xsl:if test="string-length(anchorman)">
<moderator>
<xsl:value-of select="anchorman"/>
</moderator>
</xsl:if>
<xsl:if test="string-length(actors)">
<actor>
<xsl:value-of select="actors"/>
</actor>
</xsl:if>
<xsl:if test="string-length(studio_guests)">
<guest>
<xsl:value-of select="studio_guests"/>
</guest>
</xsl:if>
<xsl:if test="string-length(authorComment)">
<commentator>
<xsl:value-of select="authorComment"/>
</commentator>
</xsl:if>
<xsl:if test="string-length(text)">
<longdescription>
<xsl:value-of select="text"/>
</longdescription>
</xsl:if>
<xsl:if test="string-length(conclusion)">
<shortreview>
<xsl:value-of select="conclusion"/>
</shortreview>
</xsl:if>
<xsl:if test="string-length(currentTopics)">
<topic>
<xsl:value-of select="str:replace(currentTopics,'|','/')"/>
</topic>
</xsl:if>
<xsl:if test="string-length(preview)">
<shortdescription>
<xsl:value-of select="preview"/>
</shortdescription>
</xsl:if>
<xsl:choose>
<xsl:when test="commentBroadcast = 'DIE BESTEN FILME ALLER ZEITEN'">
<tipp>GoldTipp</tipp>
</xsl:when>
<xsl:when test="isTopTip = 1">
<tipp>TagesTipp</tipp>
</xsl:when>
<xsl:when test="isTipOfTheDay = 1 and thumbIdNumeric &gt; 3">
<tipp>TopTipp</tipp>
</xsl:when>
<xsl:when test="isTipOfTheDay = 1">
<tipp>Tipp</tipp>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="commentBroadcast = 'DIE BESTEN FILME ALLER ZEITEN'">
<txtrating>Einer der besten Filme aller Zeiten</txtrating>
</xsl:when>
<xsl:when test="thumbIdNumeric = 3">
<txtrating>Sehr empfehlenswert</txtrating>
</xsl:when>
<xsl:when test="thumbIdNumeric = 2">
<txtrating>Empfehlenswert</txtrating>
</xsl:when>
<xsl:when test="thumbIdNumeric = 1">
<txtrating>Eher durchschnittlich</txtrating>
</xsl:when>
<xsl:when test="thumbIdNumeric = 0">
<txtrating>Eher uninteressant</txtrating>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="commentBroadcast = 'DIE BESTEN FILME ALLER ZEITEN'">
<numrating>5</numrating>
</xsl:when>
<xsl:when test="string-length(thumbIdNumeric)">
<numrating>
<xsl:value-of select="thumbIdNumeric +1"/>
</numrating>
</xsl:when>
</xsl:choose>
<xsl:variable name="BEWERTUNG">
<xsl:if test="ratingHumor>0">
<xsl:text> / Spaß </xsl:text><xsl:value-of
select="substring('**********', 1, ratingHumor)"/>
</xsl:if>
<xsl:if test="ratingAction>0">
<xsl:text> / Action </xsl:text><xsl:value-of
select="substring('**********', 1, ratingAction)"/>
</xsl:if>
<xsl:if test="ratingErotic>0">
<xsl:text> / Erotik </xsl:text><xsl:value-of
select="substring('**********', 1, ratingErotic)"/>
</xsl:if>
<xsl:if test="ratingSuspense>0">
<xsl:text> / Spannung </xsl:text><xsl:value-of
select="substring('**********', 1, ratingSuspense)"/>
</xsl:if>
<xsl:if test="ratingDemanding>0">
<xsl:text> / Anspruch </xsl:text><xsl:value-of
select="substring('**********', 1, ratingDemanding)"/>
</xsl:if>
</xsl:variable>
<xsl:if test="string-length($BEWERTUNG)">
<rating>
<xsl:value-of select="$BEWERTUNG"/>
</rating>
</xsl:if>
<xsl:variable name="AUDIO">
<xsl:if test="isStereo=1">
<xsl:text> Stereo</xsl:text>
</xsl:if>
</xsl:variable>
<xsl:if test="string-length($AUDIO)">
<audio>
<xsl:value-of select="normalize-space($AUDIO)"/>
</audio>
</xsl:if>
<xsl:variable name="FLAGS">
<xsl:if test="isHDTV=1">
<xsl:text> [HDTV]</xsl:text>
</xsl:if>
<xsl:if test="isLive=1">
<xsl:text> [Live]</xsl:text>
</xsl:if>
<xsl:if test="isNew=1">
<xsl:text> [Neu]</xsl:text>
</xsl:if>
</xsl:variable>
<xsl:if test="string-length($FLAGS)">
<flags>
<xsl:value-of select="normalize-space($FLAGS)"/>
</flags>
</xsl:if>
<xsl:variable name="BILDER">
<xsl:for-each select="images/image">
<xsl:call-template name="GetLastSegment">
<xsl:with-param name="value" select="substring-before(.,'.jpg')"/>
<xsl:with-param name="separator" select="'/'"/>
</xsl:call-template>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:variable>
<xsl:if test="string-length(normalize-space($BILDER))">
<images>
<xsl:value-of select="translate(normalize-space($BILDER),' ',',')"/>
</images>
<imagetype>jpg</imagetype>
</xsl:if>
<!--
-->
</event>
</xsl:if>
</xsl:for-each>
</events>
</xsl:template>
<xsl:template name="GetLastSegment">
<xsl:param name="value"/>
<xsl:param name="separator" select="'.'"/>
<xsl:choose> <xsl:choose>
<xsl:when test="contains($value, $separator)"> <xsl:when test="string-length(episodeTitle)>0">
<xsl:call-template name="GetLastSegment"> <shorttext><xsl:value-of select="episodeTitle"/></shorttext>
<xsl:with-param name="value" select="substring-after($value, $separator)"/> </xsl:when>
<xsl:with-param name="separator" select="$separator"/> <xsl:when test="string-length(subline)>0">
<shorttext><xsl:value-of select="subline"/></shorttext>
</xsl:when>
<xsl:when test="string-length(originalTitle)>0">
<shorttext><xsl:value-of select="originalTitle"/></shorttext>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="sart_id = 'SP'">
<category>Spielfilm</category>
</xsl:when>
<xsl:when test="sart_id = 'SE'">
<category>Serie</category>
</xsl:when>
<xsl:when test="sart_id = 'KIN'">
<category>Kinder</category>
</xsl:when>
<xsl:when test="sart_id = 'SPO'">
<category>Sport</category>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="mapping">
<xsl:with-param name="str" select="genre" />
</xsl:call-template> </xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$value"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template>
<xsl:template name="mapping">
<xsl:param name="str" select="."/> <xsl:if test="string-length(genre)">
<xsl:variable name="value" <xsl:choose>
select="translate($str,'ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖU', 'abcdefghijklmnopqrstuvwxyzäöü')"/> <xsl:when test="substring(genre,string-length(genre)-5) = 'sserie' and
<xsl:variable name="map" select="$categorieMapping[contains($value, .)]/../@name"/>.... not(contains('aeiou',substring(genre,string-length(genre)-6,1)))">
<genre><xsl:value-of select="substring(genre,1,string-length(genre)-6)"/></genre>
</xsl:when>
<xsl:when test="substring(genre,string-length(genre)-4) = 'serie'">
<genre><xsl:value-of select="substring(genre,1,string-length(genre)-5)"/></genre>
</xsl:when>
<xsl:when test="substring(genre,string-length(genre)-5) = '-Serie'">
<genre><xsl:value-of select="substring(genre,1,string-length(genre)-6)"/></genre>
</xsl:when>
<xsl:when test="substring(genre,string-length(genre)-5) = 'sreihe' and
not(contains('aeiou',substring(genre,string-length(genre)-6,1)))">
<genre><xsl:value-of select="substring(genre,1,string-length(genre)-6)"/></genre>
</xsl:when>
<xsl:when test="substring(genre,string-length(genre)-4) = 'reihe'">
<genre><xsl:value-of select="substring(genre,1,string-length(genre)-5)"/></genre>
</xsl:when>
<xsl:otherwise>
<genre><xsl:value-of select="genre"/></genre>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="string-length(year)"><year><xsl:value-of select="year"/></year></xsl:if>
<xsl:if test="string-length(country)"><country><xsl:value-of select="country"/></country></xsl:if>
<xsl:if test="string-length(fsk)"><parentalrating><xsl:value-of select="fsk"/></parentalrating></xsl:if>
<xsl:if test="string-length(director)"><director><xsl:value-of select="director"/></director></xsl:if>
<xsl:if test="string-length(anchorman)"><moderator><xsl:value-of select="anchorman"/></moderator></xsl:if>
<xsl:if test="string-length(actors)"><actor><xsl:value-of select="actors"/></actor></xsl:if>
<xsl:if test="string-length(studio_guests)"><guest><xsl:value-of select="studio_guests"/></guest></xsl:if>
<xsl:if test="string-length(authorComment)"><commentator><xsl:value-of select="authorComment"/></commentator></xsl:if>
<xsl:if test="string-length(text)"><longdescription><xsl:value-of select="text"/></longdescription></xsl:if>
<xsl:if test="string-length(conclusion)"><shortreview><xsl:value-of select="conclusion"/></shortreview></xsl:if>
<xsl:if test="string-length(currentTopics)"><topic><xsl:value-of select="str:replace(currentTopics,'|','/')"/></topic></xsl:if>
<xsl:if test="string-length(preview)"><shortdescription><xsl:value-of select="preview"/></shortdescription></xsl:if>
<xsl:choose> <xsl:choose>
<xsl:when test="string-length($map)"> <xsl:when test="commentBroadcast = 'DIE BESTEN FILME ALLER ZEITEN'"><tipp>GoldTipp</tipp></xsl:when>
<category> <xsl:when test="isTopTip = 1"><tipp>TagesTipp</tipp></xsl:when>
<xsl:value-of select="$map"/> <xsl:when test="isTipOfTheDay = 1 and thumbIdNumeric &gt; 3"><tipp>TopTipp</tipp></xsl:when>
</category> <xsl:when test="isTipOfTheDay = 1"><tipp>Tipp</tipp></xsl:when>
</xsl:when>
<xsl:otherwise>
<category>
<xsl:text>Sonstige</xsl:text>
</category>
</xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template>
</xsl:stylesheet> <xsl:choose>
<xsl:when test="commentBroadcast = 'DIE BESTEN FILME ALLER ZEITEN'">
<txtrating>Einer der besten Filme aller Zeiten</txtrating>
</xsl:when>
<xsl:when test="thumbIdNumeric = 3">
<txtrating>Sehr empfehlenswert</txtrating>
</xsl:when>
<xsl:when test="thumbIdNumeric = 2">
<txtrating>Empfehlenswert</txtrating>
</xsl:when>
<xsl:when test="thumbIdNumeric = 1">
<txtrating>Eher durchschnittlich</txtrating>
</xsl:when>
<xsl:when test="thumbIdNumeric = 0">
<txtrating>Eher uninteressant</txtrating>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="commentBroadcast = 'DIE BESTEN FILME ALLER ZEITEN'"><numrating>5</numrating></xsl:when>
<xsl:when test="string-length(thumbIdNumeric)"><numrating><xsl:value-of select="thumbIdNumeric +1"/></numrating></xsl:when>
</xsl:choose>
<xsl:variable name="BEWERTUNG">
<xsl:if test="ratingHumor>0"><xsl:text> / Spaß </xsl:text><xsl:value-of select="substring('**********', 1, ratingHumor)"/></xsl:if>
<xsl:if test="ratingAction>0"><xsl:text> / Action </xsl:text><xsl:value-of select="substring('**********', 1, ratingAction)"/></xsl:if>
<xsl:if test="ratingErotic>0"><xsl:text> / Erotik </xsl:text><xsl:value-of select="substring('**********', 1, ratingErotic)"/></xsl:if>
<xsl:if test="ratingSuspense>0"><xsl:text> / Spannung </xsl:text><xsl:value-of select="substring('**********', 1, ratingSuspense)"/></xsl:if>
<xsl:if test="ratingDemanding>0"><xsl:text> / Anspruch </xsl:text><xsl:value-of select="substring('**********', 1, ratingDemanding)"/></xsl:if>
</xsl:variable>
<xsl:if test="string-length($BEWERTUNG)"><rating><xsl:value-of select="$BEWERTUNG"/></rating></xsl:if>
<xsl:variable name="AUDIO">
<xsl:if test="isStereo=1"><xsl:text> Stereo</xsl:text></xsl:if>
</xsl:variable>
<xsl:if test="string-length($AUDIO)"><audio><xsl:value-of select="normalize-space($AUDIO)"/></audio></xsl:if>
<xsl:variable name="FLAGS">
<xsl:if test="isHDTV=1"><xsl:text> [HDTV]</xsl:text></xsl:if>
<xsl:if test="isLive=1"><xsl:text> [Live]</xsl:text></xsl:if>
<xsl:if test="isNew=1"><xsl:text> [Neu]</xsl:text></xsl:if>
</xsl:variable>
<xsl:if test="string-length($FLAGS)"><flags><xsl:value-of select="normalize-space($FLAGS)"/></flags></xsl:if>
<xsl:variable name="BILDER">
<xsl:for-each select="images/image">
<xsl:call-template name="GetLastSegment">
<xsl:with-param name="value" select="substring-before(.,'.jpg')" />
<xsl:with-param name="separator" select="'/'" />
</xsl:call-template>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:variable>
<xsl:if test="string-length(normalize-space($BILDER))">
<images><xsl:value-of select="translate(normalize-space($BILDER),' ',',')"/></images>
<imagetype>jpg</imagetype>
</xsl:if>
<!--
-->
</event>
</xsl:if>
</xsl:for-each>
</events>
</xsl:template>
<xsl:template name="GetLastSegment">
<xsl:param name="value" />
<xsl:param name="separator" select="'.'" />
<xsl:choose>
<xsl:when test="contains($value, $separator)">
<xsl:call-template name="GetLastSegment">
<xsl:with-param name="value" select="substring-after($value, $separator)" />
<xsl:with-param name="separator" select="$separator" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$value" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="mapping">
<xsl:param name="str" select="." />
<xsl:variable name="value" select="translate($str,'ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖU', 'abcdefghijklmnopqrstuvwxyzäöü')" />
<xsl:variable name="map" select="$categorieMapping[contains($value, .)]/../@name" />....
<xsl:choose>
<xsl:when test="string-length($map)">
<category><xsl:value-of select="$map"/></category>
</xsl:when>
<xsl:otherwise>
<category><xsl:text>Sonstige</xsl:text></category>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

6
tvsp.c
View File

@@ -263,7 +263,9 @@ int Tvsp::processDay(int day, int fullupdate, Statistic *stat) {
} }
obj->connection->commit(); obj->connection->commit();
downloadImages();
if (!obj->doShutDown())
downloadImages();
return success; return success;
} }
@@ -450,7 +452,7 @@ void Tvsp::downloadImages() {
tell(0, "Downloading images..."); tell(0, "Downloading images...");
int n = 0; int n = 0;
for (std::set<std::string>::iterator it = imagefileSet.begin(); it != imagefileSet.end(); ++it) { for (std::set<std::string>::iterator it = imagefileSet.begin(); it != imagefileSet.end() && !obj->doShutDown(); ++it) {
// check if file is not on disk // check if file is not on disk
std::size_t found = it->find_last_of("/"); std::size_t found = it->find_last_of("/");
if (found == std::string::npos) continue; if (found == std::string::npos) continue;

7
tvsp.h
View File

@@ -19,11 +19,10 @@
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include "../../epgd.h" #include "epgd.h"
#include "../../lib/common.h" #include "lib/curl.h"
#include "../../lib/curl.h"
#define TVSP_VERSION "0.0.2" #define TVSP_VERSION "0.0.3"
class Tvsp : public Plugin { class Tvsp : public Plugin {
private: private: