Merge branch 'master' into svgtemplates

This commit is contained in:
louis 2015-06-13 15:50:38 +02:00
commit 41736f4428
13 changed files with 121 additions and 95 deletions

View File

@ -366,3 +366,9 @@ Version 0.5.2
- added recording shorttext, description and scraper poster tokens - added recording shorttext, description and scraper poster tokens
to displaymenurecordings listelement to displaymenurecordings listelement
- allow currentelements to use conditions - 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

View File

@ -150,11 +150,12 @@ bool cImageCache::LogoExists(string channelID) {
if (!channel) if (!channel)
return false; return false;
string logoLower = StrToLowerCase(channel->Name()); string logoLower = StrToLowerCase(channel->Name());
string channelIDLower = StrToLowerCase(channelID.c_str());
return (FileExists(logoPath.c_str(), logoLower, "svg") || return (FileExists(logoPath.c_str(), logoLower, "svg") ||
FileExists(logoPath.c_str(), logoLower, "png") || FileExists(logoPath.c_str(), logoLower, "png") ||
FileExists(logoPath.c_str(), channelID, "svg") || FileExists(logoPath.c_str(), channelIDLower, "svg") ||
FileExists(logoPath.c_str(), channelID, "png")); FileExists(logoPath.c_str(), channelIDLower, "png"));
} }
bool cImageCache::SeparatorLogoExists(string name) { bool cImageCache::SeparatorLogoExists(string name) {

View File

@ -991,14 +991,13 @@ void cTemplateFunction::ParseTextToken(string &value, size_t start, size_t end)
value = value.replace(0, start, ""); value = value.replace(0, start, "");
token.type = ttConstString; token.type = ttConstString;
token.value = constString; token.value = constString;
textTokens.push_back(token);
} else { } else {
string tokenName = value.substr(1, end - start - 1); string tokenName = value.substr(1, end - start - 1);
value = value.replace(0, end - start + 1, ""); value = value.replace(0, end - start + 1, "");
token.type = ttToken; token.type = ttToken;
token.value = tokenName; token.value = tokenName;
textTokens.push_back(token);
} }
textTokens.push_back(token);
} }
void cTemplateFunction::ParseConditionalTextToken(string &value, size_t start, size_t end) { 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, ""); value = value.replace(0, start, "");
token.type = ttConstString; token.type = ttConstString;
token.value = constString; token.value = constString;
textTokens.push_back(token);
} else { } else {
string condToken = value.substr(start + 1, end - start - 1); string condToken = value.substr(start + 1, end - start - 1);
value = value.replace(0, 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.type = ttConditionalToken;
token.value = tokenName; token.value = tokenName;
token.subTokens = subTokens; token.subTokens = subTokens;
textTokens.push_back(token);
} }
textTokens.push_back(token);
} }
void cTemplateFunction::ParsePrintfTextToken(string &value, size_t start, size_t end) { 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, ""); value = value.replace(0, start, "");
token.type = ttConstString; token.type = ttConstString;
token.value = constString; token.value = constString;
textTokens.push_back(token);
} else { } else {
token.type = ttPrintfToken; token.type = ttPrintfToken;
//fetch parameter list from printf //fetch parameter list from printf
@ -1814,14 +1810,14 @@ void cTemplateFunction::Debug(void) {
eTextTokenType tokenType = (*it).type; eTextTokenType tokenType = (*it).type;
string tokType = ""; string tokType = "";
if (tokenType == ttConstString) if (tokenType == ttConstString)
tokType = "Const: "; tokType = "Const";
else if (tokenType == ttToken) else if (tokenType == ttToken)
tokType = "Token: "; tokType = "Token";
else if (tokenType == ttConditionalToken) else if (tokenType == ttConditionalToken)
tokType = "Conditional Token: "; tokType = "Conditional Token";
else if (tokenType == ttPrintfToken) else if (tokenType == ttPrintfToken)
tokType = "PrintF Token: "; tokType = "PrintF Token";
esyslog("skindesigner: %s %d = \"%s\"", tokType.c_str(), i++, (*it).value.c_str()); esyslog("skindesigner: Token %d Type %s : \"%s\"", i++, tokType.c_str(), (*it).value.c_str());
if (tokenType == ttConditionalToken) { if (tokenType == ttConditionalToken) {
for (vector<cTextToken>::iterator it2 = (*it).subTokens.begin(); it2 != (*it).subTokens.end(); it2++) { for (vector<cTextToken>::iterator it2 = (*it).subTokens.begin(); it2 != (*it).subTokens.end(); it2++) {
eTextTokenType tokenTypeCond = (*it2).type; eTextTokenType tokenTypeCond = (*it2).type;
@ -1835,7 +1831,7 @@ void cTemplateFunction::Debug(void) {
} }
if (tokenType == ttPrintfToken) { if (tokenType == ttPrintfToken) {
for (vector<string>::iterator it2 = (*it).parameters.begin(); it2 != (*it).parameters.end(); it2++) { for (vector<string>::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());
} }
} }
} }

View File

@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-skindesigner 0.0.1\n" "Project-Id-Version: vdr-skindesigner 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\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" "PO-Revision-Date: 2014-09-27 11:02+0200\n"
"Last-Translator: Louis Braun <louis.braun@gmx.de>\n" "Last-Translator: Louis Braun <louis.braun@gmx.de>\n"
"Language-Team: \n" "Language-Team: \n"
@ -51,8 +51,8 @@ msgstr "Lade Screenshots herunter..."
msgid "Install Skin" msgid "Install Skin"
msgstr "Installiere Skin" msgstr "Installiere Skin"
msgid "Update from Git" msgid "Update"
msgstr "Aus Git aktualisieren" msgstr "Aktualisieren"
msgid "Delete Skin" msgid "Delete Skin"
msgstr "Skin löschen" msgstr "Skin löschen"
@ -155,3 +155,4 @@ msgstr "Unterstützte Plugins"
msgid "Skin Designer" msgid "Skin Designer"
msgstr "Skin Designer" msgstr "Skin Designer"

View File

@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-skindesigner 0.2.0\n" "Project-Id-Version: vdr-skindesigner 0.2.0\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\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" "PO-Revision-Date: 2015-01-25 01:25+0200\n"
"Last-Translator: Rolf Ahrenberg\n" "Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish\n" "Language-Team: Finnish\n"
@ -51,7 +51,7 @@ msgstr ""
msgid "Install Skin" msgid "Install Skin"
msgstr "" msgstr ""
msgid "Update from Git" msgid "Update"
msgstr "" msgstr ""
msgid "Delete Skin" msgid "Delete Skin"

View File

@ -191,7 +191,7 @@ eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) {
cSkinRepo *repo = config.GetSkinRepo(currentSkin); cSkinRepo *repo = config.GetSkinRepo(currentSkin);
if (repo) { if (repo) {
if (repo->Type() == rtGit) if (repo->Type() == rtGit)
SetHelp(tr("Update from Git"), NULL, tr("Delete Skin"), NULL); SetHelp(tr("Update"), NULL, tr("Delete Skin"), NULL);
else else
SetHelp(NULL, NULL, tr("Delete Skin"), NULL); SetHelp(NULL, NULL, tr("Delete Skin"), NULL);
} }
@ -424,7 +424,7 @@ void cSkindesignerSkinSetup::Set(void) {
cSkinRepo *repo = config.GetSkinRepo(skin); cSkinRepo *repo = config.GetSkinRepo(skin);
if (repo) { if (repo) {
if (repo->Type() == rtGit) if (repo->Type() == rtGit)
SetHelp(tr("Update from Git"), NULL, tr("Delete Skin"), NULL); SetHelp(tr("Update"), NULL, tr("Delete Skin"), NULL);
else else
SetHelp(NULL, NULL, tr("Delete Skin"), NULL); SetHelp(NULL, NULL, tr("Delete Skin"), NULL);
} }

View File

@ -19,7 +19,7 @@
#endif #endif
static const char *VERSION = "0.5.2"; static const char *VERSION = "0.5.3";
static const char *DESCRIPTION = trNOOP("Skin Designer"); static const char *DESCRIPTION = trNOOP("Skin Designer");
class cPluginSkinDesigner : public cPlugin, public skindesignerapi::SkindesignerAPI { class cPluginSkinDesigner : public cPlugin, public skindesignerapi::SkindesignerAPI {

View File

@ -363,7 +363,7 @@ void cDisplayChannelView::DrawScraperContent(const cEvent *event) {
if (DetachViewElement(veScraperContent)) { if (DetachViewElement(veScraperContent)) {
cViewElementScraperContent *viewElement = dynamic_cast<cViewElementScraperContent*>(GetViewElement(veScraperContent)); cViewElementScraperContent *viewElement = dynamic_cast<cViewElementScraperContent*>(GetViewElement(veScraperContent));
if (!viewElement) { if (!viewElement) {
viewElement = new cViewElementScraperContent(event, ctPosterBanner, tmplView->GetViewElement(veScraperContent)); viewElement = new cViewElementScraperContent(event, NULL, tmplView->GetViewElement(veScraperContent));
AddViewElement(veScraperContent, viewElement); AddViewElement(veScraperContent, viewElement);
viewElement->Start(); viewElement->Start();
} else { } else {

View File

@ -1,6 +1,7 @@
#define __STL_CONFIG_H #define __STL_CONFIG_H
#include <vdr/menu.h> #include <vdr/menu.h>
#include "../services/scraper2vdr.h" #include "../services/scraper2vdr.h"
#include "displayviewelements.h"
#include "displayreplayview.h" #include "displayreplayview.h"
#include "../libcore/helpers.h" #include "../libcore/helpers.h"
@ -152,71 +153,26 @@ void cDisplayReplayView::DrawScraperContent(const cRecording *recording) {
return; return;
} }
int mediaWidth = 0; if (DetachViewElement(veScraperContent)) {
int mediaHeight = 0; cViewElementScraperContent *viewElement = dynamic_cast<cViewElementScraperContent*>(GetViewElement(veScraperContent));
string mediaPath = ""; if (!viewElement) {
bool isBanner = false; viewElement = new cViewElementScraperContent(NULL, recording, tmplView->GetViewElement(veScraperContent));
int posterWidth = 0; AddViewElement(veScraperContent, viewElement);
int posterHeight = 0; viewElement->Start();
string posterPath = ""; } else {
bool hasPoster = false; if (!viewElement->Starting()) {
int bannerWidth = 0; viewElement->SetRecording(recording);
int bannerHeight = 0; viewElement->Render();
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;
} }
} }
} 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<string,int>("mediawidth", mediaWidth));
intTokens.insert(pair<string,int>("mediaheight", mediaHeight));
intTokens.insert(pair<string,int>("isbanner", isBanner));
stringTokens.insert(pair<string,string>("mediapath", mediaPath));
intTokens.insert(pair<string,int>("posterwidth", posterWidth));
intTokens.insert(pair<string,int>("posterheight", posterHeight));
stringTokens.insert(pair<string,string>("posterpath", posterPath));
intTokens.insert(pair<string,int>("hasposter", hasPoster));
intTokens.insert(pair<string,int>("bannerwidth", bannerWidth));
intTokens.insert(pair<string,int>("bannerheight", bannerHeight));
stringTokens.insert(pair<string,string>("bannerpath", bannerPath));
intTokens.insert(pair<string,int>("hasbanner", hasBanner));
ClearViewElement(veScraperContent);
DrawViewElement(veScraperContent, &stringTokens, &intTokens);
} }
void cDisplayReplayView::DrawCurrent(const char *current) { void cDisplayReplayView::DrawCurrent(const char *current) {

View File

@ -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->event = event;
this->type = type; this->recording = recording;
} }
bool cViewElementScraperContent::Render(void) { bool cViewElementScraperContent::Render(void) {
ClearTokens(); ClearTokens();
SetPosterBanner(event, stringTokens, intTokens); if (event)
SetPosterBanner(event, stringTokens, intTokens);
else if (recording)
SetPosterBannerV2(recording, stringTokens, intTokens);
ClearViewElement(veScraperContent); ClearViewElement(veScraperContent);
DrawViewElement(veScraperContent, &stringTokens, &intTokens); DrawViewElement(veScraperContent, &stringTokens, &intTokens);
return true; return true;

View File

@ -15,19 +15,15 @@ public:
bool Render(void); bool Render(void);
}; };
enum ScraperContentType {
ctPosterBanner,
ctFull
};
class cViewElementScraperContent : public cViewElement, public cViewHelpers { class cViewElementScraperContent : public cViewElement, public cViewHelpers {
private: private:
ScraperContentType type;
const cEvent *event; const cEvent *event;
const cRecording *recording;
public: public:
cViewElementScraperContent(const cEvent *event, ScraperContentType type, cTemplateViewElement *tmplViewElement); cViewElementScraperContent(const cEvent *event, const cRecording *recording, cTemplateViewElement *tmplViewElement);
virtual ~cViewElementScraperContent() {}; virtual ~cViewElementScraperContent() {};
void SetEvent(const cEvent *event) { this->event = event; }; void SetEvent(const cEvent *event) { this->event = event; };
void SetRecording(const cRecording *recording) { this->recording = recording; };
bool Render(void); bool Render(void);
}; };

View File

@ -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<string,int>("mediawidth", mediaWidth));
intTokens.insert(pair<string,int>("mediaheight", mediaHeight));
intTokens.insert(pair<string,int>("isbanner", isBanner));
stringTokens.insert(pair<string,string>("mediapath", mediaPath));
intTokens.insert(pair<string,int>("posterwidth", posterWidth));
intTokens.insert(pair<string,int>("posterheight", posterHeight));
stringTokens.insert(pair<string,string>("posterpath", posterPath));
intTokens.insert(pair<string,int>("hasposter", hasPoster));
intTokens.insert(pair<string,int>("bannerwidth", bannerWidth));
intTokens.insert(pair<string,int>("bannerheight", bannerHeight));
stringTokens.insert(pair<string,string>("bannerpath", bannerPath));
intTokens.insert(pair<string,int>("hasbanner", hasBanner));
}
void cViewHelpers::SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *timers) { void cViewHelpers::SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<map<string,string> > *timers) {
cGlobalSortedTimers SortedTimers;// local and remote timers cGlobalSortedTimers SortedTimers;// local and remote timers
int numTimers = SortedTimers.Size(); int numTimers = SortedTimers.Size();

View File

@ -35,6 +35,7 @@ protected:
int GetLiveBuffer(void); int GetLiveBuffer(void);
void SetScraperTokens(const cEvent *event, const cRecording *recording, stringmap &stringTokens, intmap &intTokens, map < string, vector<stringmap> > &loopTokens); void SetScraperTokens(const cEvent *event, const cRecording *recording, stringmap &stringTokens, intmap &intTokens, map < string, vector<stringmap> > &loopTokens);
void SetPosterBanner(const cEvent *event, stringmap &stringTokens, intmap &intTokens); void SetPosterBanner(const cEvent *event, stringmap &stringTokens, intmap &intTokens);
void SetPosterBannerV2(const cRecording *recording, stringmap &stringTokens, intmap &intTokens);
void SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<stringmap> *timers); void SetTimers(map<string,int> *intTokens, map<string,string> *stringTokens, vector<stringmap> *timers);
void SetLastRecordings(map<string,int> *intTokens, map<string,string> *stringTokens, vector<stringmap> *lastRecordings); void SetLastRecordings(map<string,int> *intTokens, map<string,string> *stringTokens, vector<stringmap> *lastRecordings);
void SetMenuHeader(eMenuCategory cat, string menuTitle, stringmap &stringTokens, intmap &intTokens); void SetMenuHeader(eMenuCategory cat, string menuTitle, stringmap &stringTokens, intmap &intTokens);