mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
made viewelement scrapercontent in displayreplay detachable
This commit is contained in:
parent
3eb6418e30
commit
480b0a44e1
1
HISTORY
1
HISTORY
@ -369,3 +369,4 @@ Version 0.5.2
|
|||||||
- fixed bug searching channel logos with channelid
|
- fixed bug searching channel logos with channelid
|
||||||
- fixed bug in parsing printf text tokens
|
- fixed bug in parsing printf text tokens
|
||||||
- changed "Update from Git" to "Update"
|
- changed "Update from Git" to "Update"
|
||||||
|
- made viewelement scrapercontent in displayreplay detachable
|
||||||
|
@ -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 {
|
||||||
|
@ -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,72 +153,27 @@ 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, int > intTokens;
|
|
||||||
map < string, string > stringTokens;
|
map < string, string > stringTokens;
|
||||||
intTokens.insert(pair<string,int>("mediawidth", mediaWidth));
|
map < string, int > intTokens;
|
||||||
intTokens.insert(pair<string,int>("mediaheight", mediaHeight));
|
|
||||||
intTokens.insert(pair<string,int>("isbanner", isBanner));
|
SetPosterBannerV2(recording, stringTokens, intTokens);
|
||||||
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);
|
ClearViewElement(veScraperContent);
|
||||||
DrawViewElement(veScraperContent, &stringTokens, &intTokens);
|
DrawViewElement(veScraperContent, &stringTokens, &intTokens);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cDisplayReplayView::DrawCurrent(const char *current) {
|
void cDisplayReplayView::DrawCurrent(const char *current) {
|
||||||
map < string, string > stringTokens;
|
map < string, string > stringTokens;
|
||||||
|
@ -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();
|
||||||
|
if (event)
|
||||||
SetPosterBanner(event, stringTokens, intTokens);
|
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;
|
||||||
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user