From 76ab3e4cef2ef37ea8e9f2ababfd4b8c98ceaf54 Mon Sep 17 00:00:00 2001 From: louis Date: Sat, 29 Nov 2014 11:23:54 +0100 Subject: [PATCH] added onpause and onpausemodeonly in displayreplay --- HISTORY | 1 + Makefile | 1 + displayreplay.c | 5 + dtd/displayreplay.dtd | 16 +- libtemplate/templateview.c | 59 ++++-- libtemplate/templateview.h | 14 +- libtemplate/templateviewelement.c | 7 + libtemplate/templateviewelement.h | 5 +- libtemplate/xmlparser.c | 59 +++--- libtemplate/xmlparser.h | 3 +- skins/metrixhd/themes/default/globals.xml | 4 + skins/metrixhd/xmlfiles/displayreplay.xml | 131 +++++++++++++- skins/nopacity/themes/darkred/globals.xml | 5 + skins/nopacity/themes/default/globals.xml | 5 + skins/nopacity/xmlfiles/displayreplay.xml | 124 +++++++++++++ skinskeleton/xmlfiles/displayreplay.xml | 116 ++++++++++++ views/displaymenudetailview.c | 210 +--------------------- views/displaymenudetailview.h | 4 +- views/displayreplayonpauseview.c | 93 ++++++++++ views/displayreplayonpauseview.h | 18 ++ views/displayreplayview.c | 20 +++ views/displayreplayview.h | 4 + views/view.c | 3 +- views/viewhelpers.c | 206 +++++++++++++++++++++ views/viewhelpers.h | 1 + 25 files changed, 829 insertions(+), 285 deletions(-) create mode 100644 views/displayreplayonpauseview.c create mode 100644 views/displayreplayonpauseview.h diff --git a/HISTORY b/HISTORY index ac73f74..4b14c20 100644 --- a/HISTORY +++ b/HISTORY @@ -95,3 +95,4 @@ Version 0.0.6 epgsearch - using VDRs OSD Language instead of system language - added compatibility to librsvg >= 2.36.1 +- added onpause and onpausemodeonly in displayreplay diff --git a/Makefile b/Makefile index dedf333..ace7d29 100644 --- a/Makefile +++ b/Makefile @@ -94,6 +94,7 @@ OBJS = $(PLUGIN).o \ views/displaymenutabview.o \ views/displaymessageview.o \ views/displayreplayview.o \ + views/displayreplayonpauseview.o \ views/displayvolumeview.o \ views/displayaudiotracksview.o diff --git a/displayreplay.c b/displayreplay.c index 5a82eea..95a7235 100644 --- a/displayreplay.c +++ b/displayreplay.c @@ -35,6 +35,11 @@ void cSDDisplayReplay::SetRecording(const cRecording *Recording) { void cSDDisplayReplay::SetMode(bool Play, bool Forward, int Speed) { if (!doOutput) return; + if (!Play && Speed < 0) { + replayView->DrawOnPause(modeOnly); + } else { + replayView->ClearOnPause(); + } replayView->DrawControlIcons(Play, Forward, Speed, modeOnly); } diff --git a/dtd/displayreplay.dtd b/dtd/displayreplay.dtd index baf06d2..5e492d8 100644 --- a/dtd/displayreplay.dtd +++ b/dtd/displayreplay.dtd @@ -5,7 +5,7 @@ + controliconsmodeonly | jump | message | onpause | onpausemodeonly)*> + + + + + + %functions; \ No newline at end of file diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c index 95b3286..4783d13 100644 --- a/libtemplate/templateview.c +++ b/libtemplate/templateview.c @@ -469,9 +469,16 @@ void cTemplateView::Debug(void) { void cTemplateView::SetFunctionDefinitions(void) { - string name = "area"; + string name = "viewelement"; set attributes; attributes.insert("debug"); + attributes.insert("delay"); + attributes.insert("fadetime"); + funcsAllowed.insert(pair< string, set >(name, attributes)); + + name = "area"; + attributes.clear(); + attributes.insert("debug"); attributes.insert("condition"); attributes.insert("x"); attributes.insert("y"); @@ -723,7 +730,7 @@ string cTemplateViewChannel::GetViewElementName(eViewElement ve) { return name; } -void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix, bool debugViewElement) { +void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector > &viewElementattributes) { eViewElement ve = veUndefined; if (!sViewElement.compare("background")) { @@ -770,10 +777,9 @@ void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix, map < eViewElement, cTemplateViewElement* >::iterator hit = viewElements.find(ve); if (hit == viewElements.end()) { cTemplateViewElement *viewElement = new cTemplateViewElement(); + viewElement->SetParameters(viewElementattributes); viewElement->AddPixmap(pix); viewElements.insert(pair< eViewElement, cTemplateViewElement*>(ve, viewElement)); - if (debugViewElement) - viewElement->ActivateDebugTokens(); } else { (hit->second)->AddPixmap(pix); } @@ -1192,7 +1198,7 @@ void cTemplateViewMenu::AddPluginView(string plugName, int templNo, cTemplateVie } } -void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, bool debugViewElement) { +void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector > &viewElementattributes) { eViewElement ve = veUndefined; if (!sViewElement.compare("background")) { @@ -1231,10 +1237,9 @@ void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, boo map < eViewElement, cTemplateViewElement* >::iterator hit = viewElements.find(ve); if (hit == viewElements.end()) { cTemplateViewElement *viewElement = new cTemplateViewElement(); + viewElement->SetParameters(viewElementattributes); viewElement->AddPixmap(pix); viewElements.insert(pair< eViewElement, cTemplateViewElement*>(ve, viewElement)); - if (debugViewElement) - viewElement->ActivateDebugTokens(); } else { (hit->second)->AddPixmap(pix); } @@ -1309,7 +1314,7 @@ string cTemplateViewMessage::GetViewElementName(eViewElement ve) { return name; } -void cTemplateViewMessage::AddPixmap(string sViewElement, cTemplatePixmap *pix, bool debugViewElement) { +void cTemplateViewMessage::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector > &viewElementattributes) { eViewElement ve = veUndefined; if (!sViewElement.compare("background")) { @@ -1328,10 +1333,9 @@ void cTemplateViewMessage::AddPixmap(string sViewElement, cTemplatePixmap *pix, map < eViewElement, cTemplateViewElement* >::iterator hit = viewElements.find(ve); if (hit == viewElements.end()) { cTemplateViewElement *viewElement = new cTemplateViewElement(); + viewElement->SetParameters(viewElementattributes); viewElement->AddPixmap(pix); viewElements.insert(pair< eViewElement, cTemplateViewElement*>(ve, viewElement)); - if (debugViewElement) - viewElement->ActivateDebugTokens(); } else { (hit->second)->AddPixmap(pix); } @@ -1357,6 +1361,14 @@ cTemplateViewReplay::cTemplateViewReplay(void) { attributes.insert("scaletvheight"); funcsAllowed.insert(pair< string, set >(viewName, attributes)); + //definition of allowed parameters for onpause and onpausemodeonly viewelement + attributes.clear(); + attributes.insert("debug"); + attributes.insert("delay"); + attributes.insert("fadetime"); + funcsAllowed.insert(pair< string, set >("onpause", attributes)); + funcsAllowed.insert(pair< string, set >("onpausemodeonly", attributes)); + SetViewElements(); } @@ -1378,6 +1390,8 @@ void cTemplateViewReplay::SetViewElements(void) { viewElementsAllowed.insert("controliconsmodeonly"); viewElementsAllowed.insert("jump"); viewElementsAllowed.insert("message"); + viewElementsAllowed.insert("onpause"); + viewElementsAllowed.insert("onpausemodeonly"); } string cTemplateViewReplay::GetViewElementName(eViewElement ve) { @@ -1422,6 +1436,12 @@ string cTemplateViewReplay::GetViewElementName(eViewElement ve) { case veScraperContent: name = "Scraper Content"; break; + case veOnPause: + name = "On Pause"; + break; + case veOnPauseModeOnly: + name = "On Pause Mode Only"; + break; default: name = "Unknown"; break; @@ -1429,7 +1449,7 @@ string cTemplateViewReplay::GetViewElementName(eViewElement ve) { return name; } -void cTemplateViewReplay::AddPixmap(string sViewElement, cTemplatePixmap *pix, bool debugViewElement) { +void cTemplateViewReplay::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector > &viewElementattributes) { eViewElement ve = veUndefined; if (!sViewElement.compare("background")) { @@ -1460,6 +1480,10 @@ void cTemplateViewReplay::AddPixmap(string sViewElement, cTemplatePixmap *pix, b ve = veRecJump; } else if (!sViewElement.compare("message")) { ve = veMessage; + } else if (!sViewElement.compare("onpause")) { + ve = veOnPause; + } else if (!sViewElement.compare("onpausemodeonly")) { + ve = veOnPauseModeOnly; } if (ve == veUndefined) { @@ -1472,10 +1496,9 @@ void cTemplateViewReplay::AddPixmap(string sViewElement, cTemplatePixmap *pix, b map < eViewElement, cTemplateViewElement* >::iterator hit = viewElements.find(ve); if (hit == viewElements.end()) { cTemplateViewElement *viewElement = new cTemplateViewElement(); + viewElement->SetParameters(viewElementattributes); viewElement->AddPixmap(pix); viewElements.insert(pair< eViewElement, cTemplateViewElement*>(ve, viewElement)); - if (debugViewElement) - viewElement->ActivateDebugTokens(); } else { (hit->second)->AddPixmap(pix); } @@ -1529,7 +1552,7 @@ string cTemplateViewVolume::GetViewElementName(eViewElement ve) { return name; } -void cTemplateViewVolume::AddPixmap(string sViewElement, cTemplatePixmap *pix, bool debugViewElement) { +void cTemplateViewVolume::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector > &viewElementattributes) { eViewElement ve = veUndefined; if (!sViewElement.compare("background")) { @@ -1548,10 +1571,9 @@ void cTemplateViewVolume::AddPixmap(string sViewElement, cTemplatePixmap *pix, b map < eViewElement, cTemplateViewElement* >::iterator hit = viewElements.find(ve); if (hit == viewElements.end()) { cTemplateViewElement *viewElement = new cTemplateViewElement(); + viewElement->SetParameters(viewElementattributes); viewElement->AddPixmap(pix); viewElements.insert(pair< eViewElement, cTemplateViewElement*>(ve, viewElement)); - if (debugViewElement) - viewElement->ActivateDebugTokens(); } else { (hit->second)->AddPixmap(pix); } @@ -1634,7 +1656,7 @@ string cTemplateViewAudioTracks::GetViewListName(eViewList vl) { return name; } -void cTemplateViewAudioTracks::AddPixmap(string sViewElement, cTemplatePixmap *pix, bool debugViewElement) { +void cTemplateViewAudioTracks::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector > &viewElementattributes) { eViewElement ve = veUndefined; if (!sViewElement.compare("background")) { @@ -1653,10 +1675,9 @@ void cTemplateViewAudioTracks::AddPixmap(string sViewElement, cTemplatePixmap *p map < eViewElement, cTemplateViewElement* >::iterator hit = viewElements.find(ve); if (hit == viewElements.end()) { cTemplateViewElement *viewElement = new cTemplateViewElement(); + viewElement->SetParameters(viewElementattributes); viewElement->AddPixmap(pix); viewElements.insert(pair< eViewElement, cTemplateViewElement*>(ve, viewElement)); - if (debugViewElement) - viewElement->ActivateDebugTokens(); } else { (hit->second)->AddPixmap(pix); } diff --git a/libtemplate/templateview.h b/libtemplate/templateview.h index 828eb21..20f1c51 100644 --- a/libtemplate/templateview.h +++ b/libtemplate/templateview.h @@ -72,7 +72,7 @@ public: virtual string GetViewListName(eViewList vl) { return ""; }; virtual void AddSubView(string sSubView, cTemplateView *subView) {}; virtual void AddPluginView(string plugName, int templNo, cTemplateView *plugView) {}; - virtual void AddPixmap(string sViewElement, cTemplatePixmap *pix, bool debugViewElement) {}; + virtual void AddPixmap(string sViewElement, cTemplatePixmap *pix, vector > &viewElementattributes) {}; virtual void AddViewList(string sViewList, cTemplateViewList *viewList) {}; virtual void AddViewTab(cTemplateViewTab *viewTab) {}; //Setter Functions @@ -129,7 +129,7 @@ public: cTemplateViewChannel(void); virtual ~cTemplateViewChannel(void); string GetViewElementName(eViewElement ve); - void AddPixmap(string viewElement, cTemplatePixmap *pix, bool debugViewElement); + void AddPixmap(string viewElement, cTemplatePixmap *pix, vector > &viewElementattributes); }; // --- cTemplateViewMenu ------------------------------------------------------------- @@ -147,7 +147,7 @@ public: string GetViewListName(eViewList vl); void AddSubView(string sSubView, cTemplateView *subView); void AddPluginView(string plugName, int templNo, cTemplateView *plugView); - void AddPixmap(string viewElement, cTemplatePixmap *pix, bool debugViewElement); + void AddPixmap(string viewElement, cTemplatePixmap *pix, vector > &viewElementattributes); void AddViewList(string sViewList, cTemplateViewList *viewList); void AddViewTab(cTemplateViewTab *viewTab); }; @@ -161,7 +161,7 @@ public: cTemplateViewMessage(void); virtual ~cTemplateViewMessage(void); string GetViewElementName(eViewElement ve); - void AddPixmap(string viewElement, cTemplatePixmap *pix, bool debugViewElement); + void AddPixmap(string viewElement, cTemplatePixmap *pix, vector > &viewElementattributes); }; // --- cTemplateViewReplay ------------------------------------------------------------- @@ -173,7 +173,7 @@ public: cTemplateViewReplay(void); virtual ~cTemplateViewReplay(void); string GetViewElementName(eViewElement ve); - void AddPixmap(string viewElement, cTemplatePixmap *pix, bool debugViewElement); + void AddPixmap(string viewElement, cTemplatePixmap *pix, vector > &viewElementattributes); }; // --- cTemplateViewVolume ------------------------------------------------------------- @@ -185,7 +185,7 @@ public: cTemplateViewVolume(void); virtual ~cTemplateViewVolume(void); string GetViewElementName(eViewElement ve); - void AddPixmap(string viewElement, cTemplatePixmap *pix, bool debugViewElement); + void AddPixmap(string viewElement, cTemplatePixmap *pix, vector > &viewElementattributes); }; // --- cTemplateViewAudioTracks ------------------------------------------------------------- @@ -199,7 +199,7 @@ public: virtual ~cTemplateViewAudioTracks(void); string GetViewElementName(eViewElement ve); string GetViewListName(eViewList vl); - void AddPixmap(string viewElement, cTemplatePixmap *pix, bool debugViewElement); + void AddPixmap(string viewElement, cTemplatePixmap *pix, vector > &viewElementattributes); void AddViewList(string sViewList, cTemplateViewList *viewList); }; diff --git a/libtemplate/templateviewelement.c b/libtemplate/templateviewelement.c index 87aeade..1a2ef6e 100644 --- a/libtemplate/templateviewelement.c +++ b/libtemplate/templateviewelement.c @@ -118,6 +118,13 @@ cTemplateFunction *cTemplateViewElement::GetFunction(string name) { return NULL; } +bool cTemplateViewElement::DebugTokens(void) { + if (!parameters) + return false; + return parameters->DoDebug(); +} + + void cTemplateViewElement::Debug(void) { esyslog("skindesigner: viewelement container size x: %d, y: %d, width: %d, height %d", containerX, containerY, containerWidth, containerHeight); if (parameters) diff --git a/libtemplate/templateviewelement.h b/libtemplate/templateviewelement.h index 7fe78b9..6d148e7 100644 --- a/libtemplate/templateviewelement.h +++ b/libtemplate/templateviewelement.h @@ -60,6 +60,8 @@ enum eViewElement { veControlIconsModeOnly, veBackgroundModeOnly, veRecJump, + veOnPause, + veOnPauseModeOnly, //DisplayVolume ViewElements veVolume }; @@ -93,8 +95,7 @@ public: void InitIterator(void); cTemplatePixmap *GetNextPixmap(void); cTemplateFunction *GetFunction(string name); - void ActivateDebugTokens(void) {debugTokens = true; }; - bool DebugTokens(void) { return debugTokens; }; + bool DebugTokens(void); virtual void Debug(void); }; diff --git a/libtemplate/xmlparser.c b/libtemplate/xmlparser.c index 0fede38..bdaf0bb 100644 --- a/libtemplate/xmlparser.c +++ b/libtemplate/xmlparser.c @@ -139,12 +139,18 @@ bool cXmlParser::ParseView(void) { node = node->next; continue; } - if (view->ValidSubView((const char*)node->name)) { ParseSubView(node); } else if (view->ValidViewElement((const char*)node->name)) { - bool debugViewElement = DebugViewElement(node); - ParseViewElement(node->name, node->xmlChildrenNode, debugViewElement); + xmlAttrPtr attr = node->properties; + vector > attribs; + ParseAttributes(attr, node, attribs); + /* + for (vector >::iterator it = attribs.begin(); it != attribs.end(); it++) { + esyslog("skindesigner: attribute %s value %s", (it->first).c_str(), (it->second).c_str()); + } + */ + ParseViewElement(node->name, node->xmlChildrenNode, attribs); } else if (view->ValidViewList((const char*)node->name)) { ParseViewList(node); } else { @@ -178,8 +184,8 @@ bool cXmlParser::ParsePluginView(string plugName, int templateNumber) { } if (plugView->ValidViewElement((const char*)childNode->name)) { - bool debugViewElement = DebugViewElement(childNode); - ParseViewElement(childNode->name, childNode->xmlChildrenNode, debugViewElement, plugView); + vector > attribs; + ParseViewElement(childNode->name, childNode->xmlChildrenNode, attribs, plugView); } else if (plugView->ValidViewList((const char*)childNode->name)) { ParseViewList(childNode, plugView); } else if (!xmlStrcmp(childNode->name, (const xmlChar *) "tab")) { @@ -508,8 +514,8 @@ bool cXmlParser::ParseSubView(xmlNodePtr node) { } if (subView->ValidViewElement((const char*)childNode->name)) { - bool debugViewElement = DebugViewElement(childNode); - ParseViewElement(childNode->name, childNode->xmlChildrenNode, debugViewElement, subView); + vector > attribs; + ParseViewElement(childNode->name, childNode->xmlChildrenNode, attribs, subView); } else if (subView->ValidViewList((const char*)childNode->name)) { ParseViewList(childNode, subView); } else if (!xmlStrcmp(childNode->name, (const xmlChar *) "tab")) { @@ -527,17 +533,13 @@ bool cXmlParser::ParseSubView(xmlNodePtr node) { } -void cXmlParser::ParseViewElement(const xmlChar * viewElement, xmlNodePtr node, bool debugVE, cTemplateView *subView) { +void cXmlParser::ParseViewElement(const xmlChar * viewElement, xmlNodePtr node, vector > &attributes, cTemplateView *subView) { if (!node) return; if (!view) return; - if (debugVE) { - dsyslog("skindesigner: activating debugging of viewElement %s", (const char*)viewElement); - } - while (node != NULL) { if (node->type != XML_ELEMENT_NODE) { @@ -562,9 +564,9 @@ void cXmlParser::ParseViewElement(const xmlChar * viewElement, xmlNodePtr node, pix->SetParameters(attribs); ParseFunctionCalls(node->xmlChildrenNode, pix); if (subView) - subView->AddPixmap((const char*)viewElement, pix, debugVE); + subView->AddPixmap((const char*)viewElement, pix, attributes); else - view->AddPixmap((const char*)viewElement, pix, debugVE); + view->AddPixmap((const char*)viewElement, pix, attributes); node = node->next; } @@ -601,15 +603,6 @@ void cXmlParser::ParseViewList(xmlNodePtr parentNode, cTemplateView *subView) { ParseAttributes(attrCur, node, attribsCur); currentElement->SetGlobals(globals); currentElement->SetParameters(attribsCur); - bool debugCurrent = false; - for (vector >::iterator it = attribsCur.begin(); it != attribsCur.end(); it++) { - if (!(it->first).compare("debug")) { - debugCurrent = true; - break; - } - } - if (debugCurrent) - currentElement->ActivateDebugTokens(); while (childNode != NULL) { if (childNode->type != XML_ELEMENT_NODE) { childNode = childNode->next; @@ -631,13 +624,15 @@ void cXmlParser::ParseViewList(xmlNodePtr parentNode, cTemplateView *subView) { } viewList->AddCurrentElement(currentElement); } else if (!xmlStrcmp(node->name, (const xmlChar *) "listelement")) { - bool debugViewList = DebugViewElement(node); xmlNodePtr childNode = node->xmlChildrenNode; if (!childNode) continue; cTemplateViewElement *listElement = new cTemplateViewElement(); - if (debugViewList) - listElement->ActivateDebugTokens(); + xmlAttrPtr attrList = node->properties; + vector > attribsList; + ParseAttributes(attrList, node, attribsList); + listElement->SetGlobals(globals); + listElement->SetParameters(attribsList); while (childNode != NULL) { if (childNode->type != XML_ELEMENT_NODE) { childNode = childNode->next; @@ -775,6 +770,7 @@ bool cXmlParser::ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vectorname); if (!view->ValidAttribute((const char*)node->name, (const char*)attr->name)) { + esyslog("skindesigner: unknown attribute %s in %s", (const char*)attr->name, (const char*)node->name); attr = attr->next; if (value) xmlFree(value); @@ -789,17 +785,6 @@ bool cXmlParser::ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vectorproperties; - vector > attribs; - ParseAttributes(attr, node, attribs); - for (vector >::iterator it = attribs.begin(); it != attribs.end(); it++) { - if (!(it->first).compare("debug")) - return true; - } - return false; -} - void cXmlParser::InitLibXML() { xmlInitParser(); } diff --git a/libtemplate/xmlparser.h b/libtemplate/xmlparser.h index 18476e9..5ff829f 100644 --- a/libtemplate/xmlparser.h +++ b/libtemplate/xmlparser.h @@ -36,13 +36,12 @@ private: void ParseGlobalFonts(xmlNodePtr node); void ParseTranslations(xmlNodePtr node); bool ParseSubView(xmlNodePtr node); - void ParseViewElement(const xmlChar * viewElement, xmlNodePtr node, bool debugVE, cTemplateView *subView = NULL); + void ParseViewElement(const xmlChar * viewElement, xmlNodePtr node, vector > &attributes, cTemplateView *subView = NULL); void ParseViewList(xmlNodePtr parentNode, cTemplateView *subView = NULL); void ParseViewTab(xmlNodePtr parentNode, cTemplateView *subView); void ParseFunctionCalls(xmlNodePtr node, cTemplatePixmap *pix); void ParseLoopFunctionCalls(xmlNodePtr node, cTemplateLoopFunction *loopFunc); bool ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector > &attribs); - bool DebugViewElement(xmlNodePtr node); public: cXmlParser(void); virtual ~cXmlParser(void); diff --git a/skins/metrixhd/themes/default/globals.xml b/skins/metrixhd/themes/default/globals.xml index 11c3e1f..3f54d56 100644 --- a/skins/metrixhd/themes/default/globals.xml +++ b/skins/metrixhd/themes/default/globals.xml @@ -190,6 +190,10 @@ Volume Lautstärke + + Pause + Pause + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/skinskeleton/xmlfiles/displayreplay.xml b/skinskeleton/xmlfiles/displayreplay.xml index e9834fc..ee63f7a 100644 --- a/skinskeleton/xmlfiles/displayreplay.xml +++ b/skinskeleton/xmlfiles/displayreplay.xml @@ -125,4 +125,120 @@ + + + + + + + + diff --git a/views/displaymenudetailview.c b/views/displaymenudetailview.c index 2e3bf4c..c24fc6b 100644 --- a/views/displaymenudetailview.c +++ b/views/displaymenudetailview.c @@ -153,7 +153,7 @@ void cDisplayMenuDetailView::SetTokens(void) { intTokens.insert(pair("hasreruns", hasReruns)); - SetScraperTokens(); + SetScraperTokens(event, recording, stringTokens, intTokens, loopTokens); SetEpgPictures(event->EventID()); } else if (recording) { @@ -205,7 +205,7 @@ void cDisplayMenuDetailView::SetTokens(void) { stringTokens.insert(pair("durationeventminutes", "")); } LoadRecordingInformation(); - SetScraperTokens(); + SetScraperTokens(event, recording, stringTokens, intTokens, loopTokens); SetRecordingImages(recording->FileName()); } else if (text) { stringTokens.insert(pair("text", text)); @@ -215,212 +215,6 @@ void cDisplayMenuDetailView::SetTokens(void) { } } -void cDisplayMenuDetailView::SetScraperTokens(void) { - static cPlugin *pScraper = GetScraperPlugin(); - if (!pScraper || (!event && !recording)) { - intTokens.insert(pair("ismovie", false)); - intTokens.insert(pair("isseries", false)); - return; - } - - ScraperGetEventType getType; - getType.event = event; - getType.recording = recording; - if (!pScraper->Service("GetEventType", &getType)) { - intTokens.insert(pair("ismovie", false)); - intTokens.insert(pair("isseries", false)); - return; - } - - if (getType.type == tMovie) { - cMovie movie; - movie.movieId = getType.movieId; - pScraper->Service("GetMovie", &movie); - intTokens.insert(pair("ismovie", true)); - intTokens.insert(pair("isseries", false)); - - stringTokens.insert(pair("movietitle", movie.title)); - stringTokens.insert(pair("movieoriginalTitle", movie.originalTitle)); - stringTokens.insert(pair("movietagline", movie.tagline)); - stringTokens.insert(pair("movieoverview", movie.overview)); - stringTokens.insert(pair("moviegenres", movie.genres)); - stringTokens.insert(pair("moviehomepage", movie.homepage)); - stringTokens.insert(pair("moviereleasedate", movie.releaseDate)); - stringstream pop; - pop << movie.popularity; - stringTokens.insert(pair("moviepopularity", pop.str())); - stringstream vote; - vote << movie.voteAverage; - stringTokens.insert(pair("movievoteaverage", pop.str())); - stringTokens.insert(pair("posterpath", movie.poster.path)); - stringTokens.insert(pair("fanartpath", movie.fanart.path)); - stringTokens.insert(pair("collectionposterpath", movie.collectionPoster.path)); - stringTokens.insert(pair("collectionfanartpath", movie.collectionFanart.path)); - - intTokens.insert(pair("movieadult", movie.adult)); - intTokens.insert(pair("moviebudget", movie.budget)); - intTokens.insert(pair("movierevenue", movie.revenue)); - intTokens.insert(pair("movieruntime", movie.runtime)); - intTokens.insert(pair("posterwidth", movie.poster.width)); - intTokens.insert(pair("posterheight", movie.poster.height)); - intTokens.insert(pair("fanartwidth", movie.fanart.width)); - intTokens.insert(pair("fanartheight", movie.fanart.height)); - intTokens.insert(pair("collectionposterwidth", movie.collectionPoster.width)); - intTokens.insert(pair("collectionposterheight", movie.collectionPoster.height)); - intTokens.insert(pair("collectionfanartwidth", movie.collectionFanart.width)); - intTokens.insert(pair("collectionfanartheight", movie.collectionFanart.height)); - - vector< map< string, string > > actors; - for (vector::iterator act = movie.actors.begin(); act != movie.actors.end(); act++) { - map< string, string > actor; - actor.insert(pair("actors[name]", (*act).name)); - actor.insert(pair("actors[role]", (*act).role)); - actor.insert(pair("actors[thumb]", (*act).actorThumb.path)); - stringstream actWidth, actHeight; - actWidth << (*act).actorThumb.width; - actHeight << (*act).actorThumb.height; - actor.insert(pair("actors[thumbwidth]", actWidth.str())); - actor.insert(pair("actors[thumbheight]", actHeight.str())); - actors.push_back(actor); - } - loopTokens.insert(pair > >("actors", actors)); - - } else if (getType.type == tSeries) { - cSeries series; - series.seriesId = getType.seriesId; - series.episodeId = getType.episodeId; - pScraper->Service("GetSeries", &series); - intTokens.insert(pair("ismovie", false)); - intTokens.insert(pair("isseries", true)); - //Series Basics - stringTokens.insert(pair("seriesname", series.name)); - stringTokens.insert(pair("seriesoverview", series.overview)); - stringTokens.insert(pair("seriesfirstaired", series.firstAired)); - stringTokens.insert(pair("seriesnetwork", series.network)); - stringTokens.insert(pair("seriesgenre", series.genre)); - stringstream rating; - rating << series.rating; - stringTokens.insert(pair("seriesrating", rating.str())); - stringTokens.insert(pair("seriesstatus", series.status)); - //Episode Information - intTokens.insert(pair("episodenumber", series.episode.number)); - intTokens.insert(pair("episodeseason", series.episode.season)); - stringTokens.insert(pair("episodetitle", series.episode.name)); - stringTokens.insert(pair("episodefirstaired", series.episode.firstAired)); - stringTokens.insert(pair("episodegueststars", series.episode.guestStars)); - stringTokens.insert(pair("episodeoverview", series.episode.overview)); - stringstream eprating; - eprating << series.episode.rating; - stringTokens.insert(pair("episoderating", eprating.str())); - intTokens.insert(pair("episodeimagewidth", series.episode.episodeImage.width)); - intTokens.insert(pair("episodeimageheight", series.episode.episodeImage.height)); - stringTokens.insert(pair("episodeimagepath", series.episode.episodeImage.path)); - //Seasonposter - intTokens.insert(pair("seasonposterwidth", series.seasonPoster.width)); - intTokens.insert(pair("seasonposterheight", series.seasonPoster.height)); - stringTokens.insert(pair("seasonposterpath", series.seasonPoster.path)); - - //Posters - int current = 1; - for(vector::iterator poster = series.posters.begin(); poster != series.posters.end(); poster++) { - stringstream labelWidth, labelHeight, labelPath; - labelWidth << "seriesposter" << current << "width"; - labelHeight << "seriesposter" << current << "height"; - labelPath << "seriesposter" << current << "path"; - - intTokens.insert(pair(labelWidth.str(), (*poster).width)); - intTokens.insert(pair(labelHeight.str(), (*poster).height)); - stringTokens.insert(pair(labelPath.str(), (*poster).path)); - current++; - } - if (current < 3) { - for (; current < 4; current++) { - stringstream labelWidth, labelHeight, labelPath; - labelWidth << "seriesposter" << current << "width"; - labelHeight << "seriesposter" << current << "height"; - labelPath << "seriesposter" << current << "path"; - - intTokens.insert(pair(labelWidth.str(), 0)); - intTokens.insert(pair(labelHeight.str(), 0)); - stringTokens.insert(pair(labelPath.str(), "")); - } - } - - //Banners - current = 1; - for(vector::iterator banner = series.banners.begin(); banner != series.banners.end(); banner++) { - stringstream labelWidth, labelHeight, labelPath; - labelWidth << "seriesbanner" << current << "width"; - labelHeight << "seriesbanner" << current << "height"; - labelPath << "seriesbanner" << current << "path"; - - intTokens.insert(pair(labelWidth.str(), (*banner).width)); - intTokens.insert(pair(labelHeight.str(), (*banner).height)); - stringTokens.insert(pair(labelPath.str(), (*banner).path)); - current++; - } - if (current < 3) { - for (; current < 4; current++) { - stringstream labelWidth, labelHeight, labelPath; - labelWidth << "seriesbanner" << current << "width"; - labelHeight << "seriesbanner" << current << "height"; - labelPath << "seriesbanner" << current << "path"; - - intTokens.insert(pair(labelWidth.str(), 0)); - intTokens.insert(pair(labelHeight.str(), 0)); - stringTokens.insert(pair(labelPath.str(), "")); - } - } - - //Fanarts - current = 1; - for(vector::iterator fanart = series.fanarts.begin(); fanart != series.fanarts.end(); fanart++) { - stringstream labelWidth, labelHeight, labelPath; - labelWidth << "seriesfanart" << current << "width"; - labelHeight << "seriesfanart" << current << "height"; - labelPath << "seriesfanart" << current << "path"; - - intTokens.insert(pair(labelWidth.str(), (*fanart).width)); - intTokens.insert(pair(labelHeight.str(), (*fanart).height)); - stringTokens.insert(pair(labelPath.str(), (*fanart).path)); - current++; - } - if (current < 3) { - for (; current < 4; current++) { - stringstream labelWidth, labelHeight, labelPath; - labelWidth << "seriesfanart" << current << "width"; - labelHeight << "seriesfanart" << current << "height"; - labelPath << "seriesfanart" << current << "path"; - - intTokens.insert(pair(labelWidth.str(), 0)); - intTokens.insert(pair(labelHeight.str(), 0)); - stringTokens.insert(pair(labelPath.str(), "")); - } - } - - //Actors - vector< map< string, string > > actors; - for (vector::iterator act = series.actors.begin(); act != series.actors.end(); act++) { - map< string, string > actor; - actor.insert(pair("actors[name]", (*act).name)); - actor.insert(pair("actors[role]", (*act).role)); - actor.insert(pair("actors[thumb]", (*act).actorThumb.path)); - stringstream actWidth, actHeight; - actWidth << (*act).actorThumb.width; - actHeight << (*act).actorThumb.height; - actor.insert(pair("actors[thumbwidth]", actWidth.str())); - actor.insert(pair("actors[thumbheight]", actHeight.str())); - actors.push_back(actor); - } - loopTokens.insert(pair > >("actors", actors)); - - } else { - intTokens.insert(pair("ismovie", false)); - intTokens.insert(pair("isseries", false)); - } - -} - void cDisplayMenuDetailView::InitTabs(void) { tmplView->InitViewTabIterator(); cTemplateViewTab *tmplTab = NULL; diff --git a/views/displaymenudetailview.h b/views/displaymenudetailview.h index 2387609..1b43687 100644 --- a/views/displaymenudetailview.h +++ b/views/displaymenudetailview.h @@ -4,9 +4,10 @@ #include #include "../libtemplate/template.h" #include "view.h" +#include "viewhelpers.h" #include "displaymenutabview.h" -class cDisplayMenuDetailView : public cView { +class cDisplayMenuDetailView : public cView, public cViewHelpers { private: bool detailViewInit; bool isPluginTextView; @@ -21,7 +22,6 @@ private: map < string, int > intTokens; map < string, vector< map< string, string > > > loopTokens; void SetTokens(void); - void SetScraperTokens(void); void InitTabs(void); bool LoadReruns(vector< map< string, string > > *reruns); void LoadRecordingInformation(void); diff --git a/views/displayreplayonpauseview.c b/views/displayreplayonpauseview.c new file mode 100644 index 0000000..976d37b --- /dev/null +++ b/views/displayreplayonpauseview.c @@ -0,0 +1,93 @@ +#define __STL_CONFIG_H +#include +#include "displayreplayonpauseview.h" + +cDisplayReplayOnPauseView::cDisplayReplayOnPauseView(cTemplateViewElement *tmplViewElement) : cView(tmplViewElement) { + tmplViewElement->SetPixOffset(0); + delay = tmplViewElement->GetNumericParameter(ptDelay) * 1000; + SetFadeTime(tmplViewElement->GetNumericParameter(ptFadeTime)); +} + +cDisplayReplayOnPauseView::~cDisplayReplayOnPauseView() { + CancelSave(); + FadeOut(); +} + +void cDisplayReplayOnPauseView::Render(void) { + map < string, string > stringTokens; + map < string, int > intTokens; + map < string, vector< map< string, string > > > loopTokens; + const cRecording *recording = NULL; + cControl *control = cControl::Control(); + if (control) { + recording = control->GetRecording(); + } + if (recording) { + string name = recording->Name() ? recording->Name() : ""; + stringTokens.insert(pair("name", name)); + const cRecordingInfo *info = recording->Info(); + if (info) { + stringTokens.insert(pair("shorttext", info->ShortText() ? info->ShortText() : "")); + stringTokens.insert(pair("description", info->Description() ? info->Description() : "")); + const cEvent *event = info->GetEvent(); + if (event) { + string recDate = *(event->GetDateString()); + string recTime = *(event->GetTimeString()); + if (recDate.find("1970") != string::npos) { + time_t start = recording->Start(); + recDate = *DateString(start); + recTime = *TimeString(start); + } + stringTokens.insert(pair("date", recDate.c_str())); + stringTokens.insert(pair("time", recTime.c_str())); + time_t startTime = event->StartTime(); + struct tm * sStartTime = localtime(&startTime); + intTokens.insert(pair("year", sStartTime->tm_year + 1900)); + intTokens.insert(pair("daynumeric", sStartTime->tm_mday)); + intTokens.insert(pair("month", sStartTime->tm_mon+1)); + int duration = event->Duration() / 60; + int recDuration = recording->LengthInSeconds(); + recDuration = (recDuration>0)?(recDuration / 60):0; + intTokens.insert(pair("duration", recDuration)); + intTokens.insert(pair("durationhours", recDuration / 60)); + stringTokens.insert(pair("durationminutes", *cString::sprintf("%.2d", recDuration%60))); + intTokens.insert(pair("durationevent", duration)); + intTokens.insert(pair("durationeventhours", duration / 60)); + stringTokens.insert(pair("durationeventminutes", *cString::sprintf("%.2d", duration%60))); + } + } else { + stringTokens.insert(pair("shorttext", "")); + stringTokens.insert(pair("description", "")); + int recDuration = recording->LengthInSeconds(); + recDuration = (recDuration>0)?(recDuration / 60):0; + stringTokens.insert(pair("date", "")); + stringTokens.insert(pair("time", "")); + intTokens.insert(pair("duration", recDuration)); + intTokens.insert(pair("durationhours", recDuration / 60)); + stringTokens.insert(pair("durationminutes", *cString::sprintf("%.2d", recDuration%60))); + intTokens.insert(pair("durationevent", 0)); + intTokens.insert(pair("durationeventhours", 0)); + stringTokens.insert(pair("durationeventminutes", "")); + } + } else { + stringTokens.insert(pair("name", "")); + stringTokens.insert(pair("shorttext", "")); + stringTokens.insert(pair("description", "")); + stringTokens.insert(pair("date", "")); + stringTokens.insert(pair("time", "")); + stringTokens.insert(pair("durationminutes", "")); + stringTokens.insert(pair("durationeventminutes", "")); + } + SetScraperTokens(NULL, recording, stringTokens, intTokens, loopTokens); + DrawViewElement(veOnPause, &stringTokens, &intTokens, &loopTokens); +} + +void cDisplayReplayOnPauseView::Action(void) { + DoSleep(delay); + if (!Running()) + return; + Render(); + SetInitFinished(); + FadeIn(); + DoFlush(); +} diff --git a/views/displayreplayonpauseview.h b/views/displayreplayonpauseview.h new file mode 100644 index 0000000..6c50ce6 --- /dev/null +++ b/views/displayreplayonpauseview.h @@ -0,0 +1,18 @@ +#ifndef __DISPLAYREPLAYONPAUSEVIEW_H +#define __DISPLAYREPLAYONPAUSEVIEW_H + +#include "../libtemplate/template.h" +#include "view.h" +#include "viewhelpers.h" + +class cDisplayReplayOnPauseView : public cView, public cViewHelpers { +private: + int delay; + virtual void Action(void); +public: + cDisplayReplayOnPauseView(cTemplateViewElement *tmplViewElement); + virtual ~cDisplayReplayOnPauseView(); + void Render(void); + void Flush(void) { DoFlush(); }; +}; +#endif //__DISPLAYREPLAYONPAUSEVIEW_H diff --git a/views/displayreplayview.c b/views/displayreplayview.c index 680eea6..299978f 100644 --- a/views/displayreplayview.c +++ b/views/displayreplayview.c @@ -5,6 +5,7 @@ #include "../libcore/helpers.h" cDisplayReplayView::cDisplayReplayView(cTemplateView *tmplView) : cView(tmplView) { + onPauseView = NULL; lastDate = ""; numMarksLast = 0; lastMarks = NULL; @@ -17,6 +18,9 @@ cDisplayReplayView::~cDisplayReplayView() { if (lastMarks) { delete[] lastMarks; } + if (onPauseView) { + delete onPauseView; + } CancelSave(); FadeOut(); } @@ -369,6 +373,22 @@ void cDisplayReplayView::DrawMessage(eMessageType type, const char *text) { DrawViewElement(veMessage, &stringTokens, &intTokens); } +void cDisplayReplayView::DrawOnPause(bool modeOnly) { + eViewElement veTmplOnPause = modeOnly ? veOnPauseModeOnly : veOnPause; + cTemplateViewElement *tmplOnPause = tmplView->GetViewElement(veTmplOnPause); + if (!tmplOnPause) + return; + onPauseView = new cDisplayReplayOnPauseView(tmplOnPause); + onPauseView->Start(); +} + +void cDisplayReplayView::ClearOnPause(void) { + if (onPauseView) { + delete onPauseView; + onPauseView = NULL; + } +} + /**************************************************************************************** * Private Functions *****************************************************************************************/ diff --git a/views/displayreplayview.h b/views/displayreplayview.h index e637214..cf94a4a 100644 --- a/views/displayreplayview.h +++ b/views/displayreplayview.h @@ -3,9 +3,11 @@ #include "../libtemplate/template.h" #include "view.h" +#include "displayreplayonpauseview.h" class cDisplayReplayView : public cView { private: + cDisplayReplayOnPauseView *onPauseView; cString lastDate; int numMarksLast; int *lastMarks; @@ -29,6 +31,8 @@ public: void DrawControlIcons(bool play, bool forward, int speed, bool modeOnly); void DrawJump(const char *jump); void DrawMessage(eMessageType type, const char *text); + void DrawOnPause(bool modeOnly); + void ClearOnPause(void); void DoFadeIn(void) { Start(); }; void Flush(void) { DoFlush(); }; }; diff --git a/views/view.c b/views/view.c index 864eb45..2b9c4bf 100644 --- a/views/view.c +++ b/views/view.c @@ -73,7 +73,7 @@ void cView::Stop(void) { void cView::DrawViewElement(eViewElement ve, map *stringTokens, map *intTokens, map < string, vector< map< string, string > > > *loopTokens) { //setting correct ViewElement, depending which constructor was used cTemplateViewElement *viewElement; - if (tmplItem && ve == veMenuCurrentItemDetail) { + if (tmplItem && (ve == veMenuCurrentItemDetail || ve == veOnPause)) { viewElement = tmplItem; } else if (tmplView) { viewElement = tmplView->GetViewElement(ve); @@ -84,7 +84,6 @@ void cView::DrawViewElement(eViewElement ve, map *stringTokens, if (viewElement->DebugTokens()) { DebugTokens(tmplView ? (tmplView->GetViewElementName(ve)) : "current view", stringTokens, intTokens, loopTokens); } - //iterate through pixmaps of viewelement int pixCurrent = viewElement->GetPixOffset(); if (pixCurrent < 0) diff --git a/views/viewhelpers.c b/views/viewhelpers.c index abb46a3..38a332d 100644 --- a/views/viewhelpers.c +++ b/views/viewhelpers.c @@ -1,4 +1,5 @@ #include +#include "../services/scraper2vdr.h" #include "../config.h" #include "../libcore/helpers.h" #include "viewhelpers.h" @@ -168,3 +169,208 @@ bool cViewHelpers::CheckNewMails(void) { return false; } +void cViewHelpers::SetScraperTokens(const cEvent *event, const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens, map < string, vector< map< string, string > > > &loopTokens) { + static cPlugin *pScraper = GetScraperPlugin(); + if (!pScraper || (!event && !recording)) { + intTokens.insert(pair("ismovie", false)); + intTokens.insert(pair("isseries", false)); + return; + } + + ScraperGetEventType getType; + getType.event = event; + getType.recording = recording; + if (!pScraper->Service("GetEventType", &getType)) { + intTokens.insert(pair("ismovie", false)); + intTokens.insert(pair("isseries", false)); + return; + } + + if (getType.type == tMovie) { + cMovie movie; + movie.movieId = getType.movieId; + pScraper->Service("GetMovie", &movie); + intTokens.insert(pair("ismovie", true)); + intTokens.insert(pair("isseries", false)); + + stringTokens.insert(pair("movietitle", movie.title)); + stringTokens.insert(pair("movieoriginalTitle", movie.originalTitle)); + stringTokens.insert(pair("movietagline", movie.tagline)); + stringTokens.insert(pair("movieoverview", movie.overview)); + stringTokens.insert(pair("moviegenres", movie.genres)); + stringTokens.insert(pair("moviehomepage", movie.homepage)); + stringTokens.insert(pair("moviereleasedate", movie.releaseDate)); + stringstream pop; + pop << movie.popularity; + stringTokens.insert(pair("moviepopularity", pop.str())); + stringstream vote; + vote << movie.voteAverage; + stringTokens.insert(pair("movievoteaverage", pop.str())); + stringTokens.insert(pair("posterpath", movie.poster.path)); + stringTokens.insert(pair("fanartpath", movie.fanart.path)); + stringTokens.insert(pair("collectionposterpath", movie.collectionPoster.path)); + stringTokens.insert(pair("collectionfanartpath", movie.collectionFanart.path)); + + intTokens.insert(pair("movieadult", movie.adult)); + intTokens.insert(pair("moviebudget", movie.budget)); + intTokens.insert(pair("movierevenue", movie.revenue)); + intTokens.insert(pair("movieruntime", movie.runtime)); + intTokens.insert(pair("posterwidth", movie.poster.width)); + intTokens.insert(pair("posterheight", movie.poster.height)); + intTokens.insert(pair("fanartwidth", movie.fanart.width)); + intTokens.insert(pair("fanartheight", movie.fanart.height)); + intTokens.insert(pair("collectionposterwidth", movie.collectionPoster.width)); + intTokens.insert(pair("collectionposterheight", movie.collectionPoster.height)); + intTokens.insert(pair("collectionfanartwidth", movie.collectionFanart.width)); + intTokens.insert(pair("collectionfanartheight", movie.collectionFanart.height)); + + vector< map< string, string > > actors; + for (vector::iterator act = movie.actors.begin(); act != movie.actors.end(); act++) { + map< string, string > actor; + actor.insert(pair("actors[name]", (*act).name)); + actor.insert(pair("actors[role]", (*act).role)); + actor.insert(pair("actors[thumb]", (*act).actorThumb.path)); + stringstream actWidth, actHeight; + actWidth << (*act).actorThumb.width; + actHeight << (*act).actorThumb.height; + actor.insert(pair("actors[thumbwidth]", actWidth.str())); + actor.insert(pair("actors[thumbheight]", actHeight.str())); + actors.push_back(actor); + } + loopTokens.insert(pair > >("actors", actors)); + + } else if (getType.type == tSeries) { + cSeries series; + series.seriesId = getType.seriesId; + series.episodeId = getType.episodeId; + pScraper->Service("GetSeries", &series); + intTokens.insert(pair("ismovie", false)); + intTokens.insert(pair("isseries", true)); + //Series Basics + stringTokens.insert(pair("seriesname", series.name)); + stringTokens.insert(pair("seriesoverview", series.overview)); + stringTokens.insert(pair("seriesfirstaired", series.firstAired)); + stringTokens.insert(pair("seriesnetwork", series.network)); + stringTokens.insert(pair("seriesgenre", series.genre)); + stringstream rating; + rating << series.rating; + stringTokens.insert(pair("seriesrating", rating.str())); + stringTokens.insert(pair("seriesstatus", series.status)); + //Episode Information + intTokens.insert(pair("episodenumber", series.episode.number)); + intTokens.insert(pair("episodeseason", series.episode.season)); + stringTokens.insert(pair("episodetitle", series.episode.name)); + stringTokens.insert(pair("episodefirstaired", series.episode.firstAired)); + stringTokens.insert(pair("episodegueststars", series.episode.guestStars)); + stringTokens.insert(pair("episodeoverview", series.episode.overview)); + stringstream eprating; + eprating << series.episode.rating; + stringTokens.insert(pair("episoderating", eprating.str())); + intTokens.insert(pair("episodeimagewidth", series.episode.episodeImage.width)); + intTokens.insert(pair("episodeimageheight", series.episode.episodeImage.height)); + stringTokens.insert(pair("episodeimagepath", series.episode.episodeImage.path)); + //Seasonposter + intTokens.insert(pair("seasonposterwidth", series.seasonPoster.width)); + intTokens.insert(pair("seasonposterheight", series.seasonPoster.height)); + stringTokens.insert(pair("seasonposterpath", series.seasonPoster.path)); + + //Posters + int current = 1; + for(vector::iterator poster = series.posters.begin(); poster != series.posters.end(); poster++) { + stringstream labelWidth, labelHeight, labelPath; + labelWidth << "seriesposter" << current << "width"; + labelHeight << "seriesposter" << current << "height"; + labelPath << "seriesposter" << current << "path"; + + intTokens.insert(pair(labelWidth.str(), (*poster).width)); + intTokens.insert(pair(labelHeight.str(), (*poster).height)); + stringTokens.insert(pair(labelPath.str(), (*poster).path)); + current++; + } + if (current < 3) { + for (; current < 4; current++) { + stringstream labelWidth, labelHeight, labelPath; + labelWidth << "seriesposter" << current << "width"; + labelHeight << "seriesposter" << current << "height"; + labelPath << "seriesposter" << current << "path"; + + intTokens.insert(pair(labelWidth.str(), 0)); + intTokens.insert(pair(labelHeight.str(), 0)); + stringTokens.insert(pair(labelPath.str(), "")); + } + } + + //Banners + current = 1; + for(vector::iterator banner = series.banners.begin(); banner != series.banners.end(); banner++) { + stringstream labelWidth, labelHeight, labelPath; + labelWidth << "seriesbanner" << current << "width"; + labelHeight << "seriesbanner" << current << "height"; + labelPath << "seriesbanner" << current << "path"; + + intTokens.insert(pair(labelWidth.str(), (*banner).width)); + intTokens.insert(pair(labelHeight.str(), (*banner).height)); + stringTokens.insert(pair(labelPath.str(), (*banner).path)); + current++; + } + if (current < 3) { + for (; current < 4; current++) { + stringstream labelWidth, labelHeight, labelPath; + labelWidth << "seriesbanner" << current << "width"; + labelHeight << "seriesbanner" << current << "height"; + labelPath << "seriesbanner" << current << "path"; + + intTokens.insert(pair(labelWidth.str(), 0)); + intTokens.insert(pair(labelHeight.str(), 0)); + stringTokens.insert(pair(labelPath.str(), "")); + } + } + + //Fanarts + current = 1; + for(vector::iterator fanart = series.fanarts.begin(); fanart != series.fanarts.end(); fanart++) { + stringstream labelWidth, labelHeight, labelPath; + labelWidth << "seriesfanart" << current << "width"; + labelHeight << "seriesfanart" << current << "height"; + labelPath << "seriesfanart" << current << "path"; + + intTokens.insert(pair(labelWidth.str(), (*fanart).width)); + intTokens.insert(pair(labelHeight.str(), (*fanart).height)); + stringTokens.insert(pair(labelPath.str(), (*fanart).path)); + current++; + } + if (current < 3) { + for (; current < 4; current++) { + stringstream labelWidth, labelHeight, labelPath; + labelWidth << "seriesfanart" << current << "width"; + labelHeight << "seriesfanart" << current << "height"; + labelPath << "seriesfanart" << current << "path"; + + intTokens.insert(pair(labelWidth.str(), 0)); + intTokens.insert(pair(labelHeight.str(), 0)); + stringTokens.insert(pair(labelPath.str(), "")); + } + } + + //Actors + vector< map< string, string > > actors; + for (vector::iterator act = series.actors.begin(); act != series.actors.end(); act++) { + map< string, string > actor; + actor.insert(pair("actors[name]", (*act).name)); + actor.insert(pair("actors[role]", (*act).role)); + actor.insert(pair("actors[thumb]", (*act).actorThumb.path)); + stringstream actWidth, actHeight; + actWidth << (*act).actorThumb.width; + actHeight << (*act).actorThumb.height; + actor.insert(pair("actors[thumbwidth]", actWidth.str())); + actor.insert(pair("actors[thumbheight]", actHeight.str())); + actors.push_back(actor); + } + loopTokens.insert(pair > >("actors", actors)); + + } else { + intTokens.insert(pair("ismovie", false)); + intTokens.insert(pair("isseries", false)); + } + +} diff --git a/views/viewhelpers.h b/views/viewhelpers.h index 7946b53..8e57bb4 100644 --- a/views/viewhelpers.h +++ b/views/viewhelpers.h @@ -11,6 +11,7 @@ protected: void InitDevices(void); bool SetDevices(bool initial, map *intTokens, vector > *devices); bool CheckNewMails(void); + void SetScraperTokens(const cEvent *event, const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens, map < string, vector< map< string, string > > > &loopTokens); public: cViewHelpers(void); virtual ~cViewHelpers(void);