diff --git a/HISTORY b/HISTORY index 118914e..eccf5da 100644 --- a/HISTORY +++ b/HISTORY @@ -366,3 +366,9 @@ Version 0.5.2 - added recording shorttext, description and scraper poster tokens to displaymenurecordings listelement - allow currentelements to use conditions +- fixed bug searching channel logos with channelid +- fixed bug in parsing printf text tokens +- changed "Update from Git" to "Update" +- made viewelement scrapercontent in displayreplay detachable + +Version 0.5.3 \ No newline at end of file diff --git a/libcore/imagecache.c b/libcore/imagecache.c index 2e6a0fc..fe07e98 100644 --- a/libcore/imagecache.c +++ b/libcore/imagecache.c @@ -150,11 +150,12 @@ bool cImageCache::LogoExists(string channelID) { if (!channel) return false; string logoLower = StrToLowerCase(channel->Name()); + string channelIDLower = StrToLowerCase(channelID.c_str()); return (FileExists(logoPath.c_str(), logoLower, "svg") || FileExists(logoPath.c_str(), logoLower, "png") || - FileExists(logoPath.c_str(), channelID, "svg") || - FileExists(logoPath.c_str(), channelID, "png")); + FileExists(logoPath.c_str(), channelIDLower, "svg") || + FileExists(logoPath.c_str(), channelIDLower, "png")); } bool cImageCache::SeparatorLogoExists(string name) { diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c index b2bad34..6c6ae5c 100644 --- a/libtemplate/templatefunction.c +++ b/libtemplate/templatefunction.c @@ -991,14 +991,13 @@ void cTemplateFunction::ParseTextToken(string &value, size_t start, size_t end) value = value.replace(0, start, ""); token.type = ttConstString; token.value = constString; - textTokens.push_back(token); } else { string tokenName = value.substr(1, end - start - 1); value = value.replace(0, end - start + 1, ""); token.type = ttToken; token.value = tokenName; - textTokens.push_back(token); } + textTokens.push_back(token); } void cTemplateFunction::ParseConditionalTextToken(string &value, size_t start, size_t end) { @@ -1008,7 +1007,6 @@ void cTemplateFunction::ParseConditionalTextToken(string &value, size_t start, s value = value.replace(0, start, ""); token.type = ttConstString; token.value = constString; - textTokens.push_back(token); } else { string condToken = value.substr(start + 1, end - start - 1); value = value.replace(0, end - start + 1, ""); @@ -1041,9 +1039,8 @@ void cTemplateFunction::ParseConditionalTextToken(string &value, size_t start, s token.type = ttConditionalToken; token.value = tokenName; token.subTokens = subTokens; - textTokens.push_back(token); } - + textTokens.push_back(token); } void cTemplateFunction::ParsePrintfTextToken(string &value, size_t start, size_t end) { @@ -1053,7 +1050,6 @@ void cTemplateFunction::ParsePrintfTextToken(string &value, size_t start, size_t value = value.replace(0, start, ""); token.type = ttConstString; token.value = constString; - textTokens.push_back(token); } else { token.type = ttPrintfToken; //fetch parameter list from printf @@ -1814,14 +1810,14 @@ void cTemplateFunction::Debug(void) { eTextTokenType tokenType = (*it).type; string tokType = ""; if (tokenType == ttConstString) - tokType = "Const: "; + tokType = "Const"; else if (tokenType == ttToken) - tokType = "Token: "; + tokType = "Token"; else if (tokenType == ttConditionalToken) - tokType = "Conditional Token: "; + tokType = "Conditional Token"; else if (tokenType == ttPrintfToken) - tokType = "PrintF Token: "; - esyslog("skindesigner: %s %d = \"%s\"", tokType.c_str(), i++, (*it).value.c_str()); + tokType = "PrintF Token"; + esyslog("skindesigner: Token %d Type %s : \"%s\"", i++, tokType.c_str(), (*it).value.c_str()); if (tokenType == ttConditionalToken) { for (vector::iterator it2 = (*it).subTokens.begin(); it2 != (*it).subTokens.end(); it2++) { eTextTokenType tokenTypeCond = (*it2).type; @@ -1835,7 +1831,7 @@ void cTemplateFunction::Debug(void) { } if (tokenType == ttPrintfToken) { for (vector::iterator it2 = (*it).parameters.begin(); it2 != (*it).parameters.end(); it2++) { - esyslog("skindesigner: Printf parameter: %s", (*it2).c_str()); + esyslog("skindesigner: PrintF parameter: %s", (*it2).c_str()); } } } diff --git a/po/de_DE.po b/po/de_DE.po index a43a33a..a1e95cc 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skindesigner 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-06-04 16:05+0200\n" +"POT-Creation-Date: 2015-06-13 15:07+0200\n" "PO-Revision-Date: 2014-09-27 11:02+0200\n" "Last-Translator: Louis Braun \n" "Language-Team: \n" @@ -51,8 +51,8 @@ msgstr "Lade Screenshots herunter..." msgid "Install Skin" msgstr "Installiere Skin" -msgid "Update from Git" -msgstr "Aus Git aktualisieren" +msgid "Update" +msgstr "Aktualisieren" msgid "Delete Skin" msgstr "Skin löschen" @@ -155,3 +155,4 @@ msgstr "Unterstützte Plugins" msgid "Skin Designer" msgstr "Skin Designer" + diff --git a/po/fi_FI.po b/po/fi_FI.po index 604b7c4..4a0115d 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skindesigner 0.2.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-06-04 16:05+0200\n" +"POT-Creation-Date: 2015-06-13 15:07+0200\n" "PO-Revision-Date: 2015-01-25 01:25+0200\n" "Last-Translator: Rolf Ahrenberg\n" "Language-Team: Finnish\n" @@ -51,7 +51,7 @@ msgstr "" msgid "Install Skin" msgstr "" -msgid "Update from Git" +msgid "Update" msgstr "" msgid "Delete Skin" diff --git a/setup.c b/setup.c index 98cf5d9..036723f 100644 --- a/setup.c +++ b/setup.c @@ -191,7 +191,7 @@ eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) { cSkinRepo *repo = config.GetSkinRepo(currentSkin); if (repo) { if (repo->Type() == rtGit) - SetHelp(tr("Update from Git"), NULL, tr("Delete Skin"), NULL); + SetHelp(tr("Update"), NULL, tr("Delete Skin"), NULL); else SetHelp(NULL, NULL, tr("Delete Skin"), NULL); } @@ -424,7 +424,7 @@ void cSkindesignerSkinSetup::Set(void) { cSkinRepo *repo = config.GetSkinRepo(skin); if (repo) { if (repo->Type() == rtGit) - SetHelp(tr("Update from Git"), NULL, tr("Delete Skin"), NULL); + SetHelp(tr("Update"), NULL, tr("Delete Skin"), NULL); else SetHelp(NULL, NULL, tr("Delete Skin"), NULL); } diff --git a/skindesigner.c b/skindesigner.c index a632fc7..840a3c4 100644 --- a/skindesigner.c +++ b/skindesigner.c @@ -19,7 +19,7 @@ #endif -static const char *VERSION = "0.5.2"; +static const char *VERSION = "0.5.3"; static const char *DESCRIPTION = trNOOP("Skin Designer"); class cPluginSkinDesigner : public cPlugin, public skindesignerapi::SkindesignerAPI { diff --git a/views/displaychannelview.c b/views/displaychannelview.c index 47537ec..06ebe88 100644 --- a/views/displaychannelview.c +++ b/views/displaychannelview.c @@ -363,7 +363,7 @@ void cDisplayChannelView::DrawScraperContent(const cEvent *event) { if (DetachViewElement(veScraperContent)) { cViewElementScraperContent *viewElement = dynamic_cast(GetViewElement(veScraperContent)); if (!viewElement) { - viewElement = new cViewElementScraperContent(event, ctPosterBanner, tmplView->GetViewElement(veScraperContent)); + viewElement = new cViewElementScraperContent(event, NULL, tmplView->GetViewElement(veScraperContent)); AddViewElement(veScraperContent, viewElement); viewElement->Start(); } else { diff --git a/views/displayreplayview.c b/views/displayreplayview.c index 385ed2e..364b801 100644 --- a/views/displayreplayview.c +++ b/views/displayreplayview.c @@ -1,6 +1,7 @@ #define __STL_CONFIG_H #include #include "../services/scraper2vdr.h" +#include "displayviewelements.h" #include "displayreplayview.h" #include "../libcore/helpers.h" @@ -152,71 +153,26 @@ void cDisplayReplayView::DrawScraperContent(const cRecording *recording) { return; } - int mediaWidth = 0; - int mediaHeight = 0; - string mediaPath = ""; - bool isBanner = false; - int posterWidth = 0; - int posterHeight = 0; - string posterPath = ""; - bool hasPoster = false; - int bannerWidth = 0; - int bannerHeight = 0; - string bannerPath = ""; - bool hasBanner = false; - - static cPlugin *pScraper = GetScraperPlugin(); - if (pScraper) { - ScraperGetPosterBannerV2 call; - call.event = NULL; - call.recording = recording; - if (pScraper->Service("GetPosterBannerV2", &call)) { - if ((call.type == tSeries) && call.banner.path.size() > 0) { - mediaWidth = call.banner.width; - mediaHeight = call.banner.height; - mediaPath = call.banner.path; - isBanner = true; - bannerWidth = mediaWidth; - bannerHeight = mediaHeight; - bannerPath = mediaPath; - hasBanner = true; - - ScraperGetPoster callPoster; - callPoster.event = NULL; - callPoster.recording = recording; - if (pScraper->Service("GetPoster", &callPoster)) { - posterWidth = callPoster.poster.width; - posterHeight = callPoster.poster.height; - posterPath = callPoster.poster.path; - hasPoster = true; - } - } else if (call.type == tMovie && call.poster.path.size() > 0 && call.poster.height > 0) { - mediaWidth = call.poster.width; - mediaHeight = call.poster.height; - mediaPath = call.poster.path; - posterWidth = call.poster.width; - posterHeight = call.poster.height; - posterPath = call.poster.path; - hasPoster = true; + if (DetachViewElement(veScraperContent)) { + cViewElementScraperContent *viewElement = dynamic_cast(GetViewElement(veScraperContent)); + if (!viewElement) { + viewElement = new cViewElementScraperContent(NULL, recording, tmplView->GetViewElement(veScraperContent)); + AddViewElement(veScraperContent, viewElement); + viewElement->Start(); + } else { + if (!viewElement->Starting()) { + viewElement->SetRecording(recording); + viewElement->Render(); } } + } else { + map < string, string > stringTokens; + map < string, int > intTokens; + + SetPosterBannerV2(recording, stringTokens, intTokens); + ClearViewElement(veScraperContent); + DrawViewElement(veScraperContent, &stringTokens, &intTokens); } - map < string, int > intTokens; - map < string, string > stringTokens; - intTokens.insert(pair("mediawidth", mediaWidth)); - intTokens.insert(pair("mediaheight", mediaHeight)); - intTokens.insert(pair("isbanner", isBanner)); - stringTokens.insert(pair("mediapath", mediaPath)); - intTokens.insert(pair("posterwidth", posterWidth)); - intTokens.insert(pair("posterheight", posterHeight)); - stringTokens.insert(pair("posterpath", posterPath)); - intTokens.insert(pair("hasposter", hasPoster)); - intTokens.insert(pair("bannerwidth", bannerWidth)); - intTokens.insert(pair("bannerheight", bannerHeight)); - stringTokens.insert(pair("bannerpath", bannerPath)); - intTokens.insert(pair("hasbanner", hasBanner)); - ClearViewElement(veScraperContent); - DrawViewElement(veScraperContent, &stringTokens, &intTokens); } void cDisplayReplayView::DrawCurrent(const char *current) { diff --git a/views/displayviewelements.c b/views/displayviewelements.c index b09f1d5..1f60804 100644 --- a/views/displayviewelements.c +++ b/views/displayviewelements.c @@ -27,14 +27,17 @@ bool cViewElementDevices::Render(void) { /********************************************************************************************************************/ -cViewElementScraperContent::cViewElementScraperContent(const cEvent *event, ScraperContentType type, cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) { +cViewElementScraperContent::cViewElementScraperContent(const cEvent *event, const cRecording *recording, cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) { this->event = event; - this->type = type; + this->recording = recording; } bool cViewElementScraperContent::Render(void) { ClearTokens(); - SetPosterBanner(event, stringTokens, intTokens); + if (event) + SetPosterBanner(event, stringTokens, intTokens); + else if (recording) + SetPosterBannerV2(recording, stringTokens, intTokens); ClearViewElement(veScraperContent); DrawViewElement(veScraperContent, &stringTokens, &intTokens); return true; diff --git a/views/displayviewelements.h b/views/displayviewelements.h index d55f562..72d31e9 100644 --- a/views/displayviewelements.h +++ b/views/displayviewelements.h @@ -15,19 +15,15 @@ public: bool Render(void); }; -enum ScraperContentType { - ctPosterBanner, - ctFull -}; - class cViewElementScraperContent : public cViewElement, public cViewHelpers { private: - ScraperContentType type; const cEvent *event; + const cRecording *recording; public: - cViewElementScraperContent(const cEvent *event, ScraperContentType type, cTemplateViewElement *tmplViewElement); + cViewElementScraperContent(const cEvent *event, const cRecording *recording, cTemplateViewElement *tmplViewElement); virtual ~cViewElementScraperContent() {}; void SetEvent(const cEvent *event) { this->event = event; }; + void SetRecording(const cRecording *recording) { this->recording = recording; }; bool Render(void); }; diff --git a/views/viewhelpers.c b/views/viewhelpers.c index d504dad..8643753 100644 --- a/views/viewhelpers.c +++ b/views/viewhelpers.c @@ -727,6 +727,72 @@ void cViewHelpers::SetPosterBanner(const cEvent *event, stringmap &stringTokens, } } +void cViewHelpers::SetPosterBannerV2(const cRecording *recording, stringmap &stringTokens, intmap &intTokens) { + static cPlugin *pScraper = GetScraperPlugin(); + if (!pScraper) { + return; + } + + int mediaWidth = 0; + int mediaHeight = 0; + string mediaPath = ""; + bool isBanner = false; + int posterWidth = 0; + int posterHeight = 0; + string posterPath = ""; + bool hasPoster = false; + int bannerWidth = 0; + int bannerHeight = 0; + string bannerPath = ""; + bool hasBanner = false; + + ScraperGetPosterBannerV2 call; + call.event = NULL; + call.recording = recording; + if (pScraper->Service("GetPosterBannerV2", &call)) { + if ((call.type == tSeries) && call.banner.path.size() > 0) { + mediaWidth = call.banner.width; + mediaHeight = call.banner.height; + mediaPath = call.banner.path; + isBanner = true; + bannerWidth = mediaWidth; + bannerHeight = mediaHeight; + bannerPath = mediaPath; + hasBanner = true; + + ScraperGetPoster callPoster; + callPoster.event = NULL; + callPoster.recording = recording; + if (pScraper->Service("GetPoster", &callPoster)) { + posterWidth = callPoster.poster.width; + posterHeight = callPoster.poster.height; + posterPath = callPoster.poster.path; + hasPoster = true; + } + } else if (call.type == tMovie && call.poster.path.size() > 0 && call.poster.height > 0) { + mediaWidth = call.poster.width; + mediaHeight = call.poster.height; + mediaPath = call.poster.path; + posterWidth = call.poster.width; + posterHeight = call.poster.height; + posterPath = call.poster.path; + hasPoster = true; + } + } + intTokens.insert(pair("mediawidth", mediaWidth)); + intTokens.insert(pair("mediaheight", mediaHeight)); + intTokens.insert(pair("isbanner", isBanner)); + stringTokens.insert(pair("mediapath", mediaPath)); + intTokens.insert(pair("posterwidth", posterWidth)); + intTokens.insert(pair("posterheight", posterHeight)); + stringTokens.insert(pair("posterpath", posterPath)); + intTokens.insert(pair("hasposter", hasPoster)); + intTokens.insert(pair("bannerwidth", bannerWidth)); + intTokens.insert(pair("bannerheight", bannerHeight)); + stringTokens.insert(pair("bannerpath", bannerPath)); + intTokens.insert(pair("hasbanner", hasBanner)); +} + void cViewHelpers::SetTimers(map *intTokens, map *stringTokens, vector > *timers) { cGlobalSortedTimers SortedTimers;// local and remote timers int numTimers = SortedTimers.Size(); diff --git a/views/viewhelpers.h b/views/viewhelpers.h index e1675bc..c66b6f6 100644 --- a/views/viewhelpers.h +++ b/views/viewhelpers.h @@ -35,6 +35,7 @@ protected: int GetLiveBuffer(void); void SetScraperTokens(const cEvent *event, const cRecording *recording, stringmap &stringTokens, intmap &intTokens, map < string, vector > &loopTokens); void SetPosterBanner(const cEvent *event, stringmap &stringTokens, intmap &intTokens); + void SetPosterBannerV2(const cRecording *recording, stringmap &stringTokens, intmap &intTokens); void SetTimers(map *intTokens, map *stringTokens, vector *timers); void SetLastRecordings(map *intTokens, map *stringTokens, vector *lastRecordings); void SetMenuHeader(eMenuCategory cat, string menuTitle, stringmap &stringTokens, intmap &intTokens);