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 in parsing printf text tokens
|
||||
- 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)) {
|
||||
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 {
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user