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
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

View File

@ -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) {

View File

@ -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<cTextToken>::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<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 ""
"Project-Id-Version: vdr-skindesigner 0.0.1\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"
"Last-Translator: Louis Braun <louis.braun@gmx.de>\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"

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-skindesigner 0.2.0\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"
"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"

View File

@ -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);
}

View File

@ -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 {

View File

@ -363,7 +363,7 @@ void cDisplayChannelView::DrawScraperContent(const cEvent *event) {
if (DetachViewElement(veScraperContent)) {
cViewElementScraperContent *viewElement = dynamic_cast<cViewElementScraperContent*>(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 {

View File

@ -1,6 +1,7 @@
#define __STL_CONFIG_H
#include <vdr/menu.h>
#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<cViewElementScraperContent*>(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<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) {

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->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;

View File

@ -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);
};

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) {
cGlobalSortedTimers SortedTimers;// local and remote timers
int numTimers = SortedTimers.Size();

View File

@ -35,6 +35,7 @@ protected:
int GetLiveBuffer(void);
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 SetPosterBannerV2(const cRecording *recording, stringmap &stringTokens, intmap &intTokens);
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 SetMenuHeader(eMenuCategory cat, string menuTitle, stringmap &stringTokens, intmap &intTokens);