added poster and banner to channels and timers menu current view

This commit is contained in:
louis 2016-02-28 12:32:02 +01:00
parent 3c038ad1c7
commit b288ead2c5
7 changed files with 80 additions and 3 deletions

View File

@ -830,6 +830,7 @@ enum class eCeMenuChannelsST {
presenteventdate,
presenteventdurationminutes,
posterpath,
bannerpath,
nexteventtitle,
nexteventstart,
nexteventstop,
@ -861,6 +862,9 @@ enum class eCeMenuChannelsIT {
hasposter,
posterwidth,
posterheight,
hasbanner,
bannerwidth,
bannerheight,
nexteventduration,
nexteventdurationhours,
count
@ -920,6 +924,7 @@ enum class eCeMenuTimersST {
eventshorttext,
eventdescription,
posterpath,
bannerpath,
count
};
@ -940,6 +945,9 @@ enum class eCeMenuTimersIT {
hasposter,
posterwidth,
posterheight,
hasbanner,
bannerwidth,
bannerheight,
count
};

View File

@ -968,6 +968,7 @@ void cCeMenuChannels::SetTokenContainer(void) {
tokenContainer->DefineStringToken("{presenteventdate}", (int)eCeMenuChannelsST::presenteventdate);
tokenContainer->DefineStringToken("{presenteventdurationminutes}", (int)eCeMenuChannelsST::presenteventdurationminutes);
tokenContainer->DefineStringToken("{posterpath}", (int)eCeMenuChannelsST::posterpath);
tokenContainer->DefineStringToken("{bannerpath}", (int)eCeMenuChannelsST::bannerpath);
tokenContainer->DefineStringToken("{nexteventtitle}", (int)eCeMenuChannelsST::nexteventtitle);
tokenContainer->DefineStringToken("{nexteventstart}", (int)eCeMenuChannelsST::nexteventstart);
tokenContainer->DefineStringToken("{nexteventstop}", (int)eCeMenuChannelsST::nexteventstop);
@ -995,6 +996,9 @@ void cCeMenuChannels::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{hasposter}", (int)eCeMenuChannelsIT::hasposter);
tokenContainer->DefineIntToken("{posterwidth}", (int)eCeMenuChannelsIT::posterwidth);
tokenContainer->DefineIntToken("{posterheight}", (int)eCeMenuChannelsIT::posterheight);
tokenContainer->DefineIntToken("{hasbanner}", (int)eCeMenuChannelsIT::hasbanner);
tokenContainer->DefineIntToken("{bannerwidth}", (int)eCeMenuChannelsIT::bannerwidth);
tokenContainer->DefineIntToken("{bannerheight}", (int)eCeMenuChannelsIT::bannerheight);
tokenContainer->DefineIntToken("{nexteventduration}", (int)eCeMenuChannelsIT::nexteventduration);
tokenContainer->DefineIntToken("{nexteventdurationhours}", (int)eCeMenuChannelsIT::nexteventdurationhours);
tokenContainer->DefineLoopToken("{schedule[title]}", (int)eCeMenuChannelsLT::title);
@ -1060,7 +1064,8 @@ bool cCeMenuChannels::Parse(bool forced) {
tokenContainer->AddIntToken((int)eCeMenuChannelsIT::presenteventduration, presentEvent->Duration() / 60);
tokenContainer->AddIntToken((int)eCeMenuChannelsIT::presenteventdurationhours, presentEvent->Duration() / 3600);
tokenContainer->AddStringToken((int)eCeMenuChannelsST::presenteventdurationminutes, *cString::sprintf("%.2d", (presentEvent->Duration() / 60)%60));
//SetScraperPoster(presentEvent);
if (LoadFullScrapInfo(presentEvent, NULL))
SetScraperPosterBannerChannel(tokenContainer);
}
const cList<cEvent> *events = schedule->Events();
if (events && presentEvent) {
@ -1276,6 +1281,7 @@ void cCeMenuTimers::SetTokenContainer(void) {
tokenContainer->DefineStringToken("{eventshorttext}", (int)eCeMenuTimersST::eventshorttext);
tokenContainer->DefineStringToken("{eventdescription}", (int)eCeMenuTimersST::eventdescription);
tokenContainer->DefineStringToken("{posterpath}", (int)eCeMenuTimersST::posterpath);
tokenContainer->DefineStringToken("{bannerpath}", (int)eCeMenuTimersST::bannerpath);
tokenContainer->DefineIntToken("{menuitemx}", (int)eCeMenuTimersIT::menuitemx);
tokenContainer->DefineIntToken("{menuitemy}", (int)eCeMenuTimersIT::menuitemy);
tokenContainer->DefineIntToken("{menuitemwidth}", (int)eCeMenuTimersIT::menuitemwidth);
@ -1292,6 +1298,9 @@ void cCeMenuTimers::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{hasposter}", (int)eCeMenuTimersIT::hasposter);
tokenContainer->DefineIntToken("{posterwidth}", (int)eCeMenuTimersIT::posterwidth);
tokenContainer->DefineIntToken("{posterheight}", (int)eCeMenuTimersIT::posterheight);
tokenContainer->DefineIntToken("{hasbanner}", (int)eCeMenuTimersIT::hasbanner);
tokenContainer->DefineIntToken("{bannerwidth}", (int)eCeMenuTimersIT::bannerwidth);
tokenContainer->DefineIntToken("{bannerheight}", (int)eCeMenuTimersIT::bannerheight);
InheritTokenContainer();
}
@ -1374,6 +1383,8 @@ bool cCeMenuTimers::Parse(bool forced) {
tokenContainer->AddStringToken((int)eCeMenuTimersST::eventstop, *event->GetEndTimeString());
tokenContainer->AddStringToken((int)eCeMenuTimersST::eventshorttext, event->ShortText());
tokenContainer->AddStringToken((int)eCeMenuTimersST::eventdescription, event->Description());
if (LoadFullScrapInfo(event, NULL))
SetScraperPosterBannerTimer(tokenContainer);
}
return true;
}

View File

@ -195,7 +195,7 @@ public:
/******************************************************************
* cCeMenuChannels
******************************************************************/
class cCeMenuChannels : public cCurrentElement {
class cCeMenuChannels : public cCurrentElement, public cScrapManager {
private:
const cChannel *channel;
bool withProvider;
@ -231,7 +231,7 @@ public:
/******************************************************************
* cCeMenuTimers
******************************************************************/
class cCeMenuTimers : public cCurrentElement {
class cCeMenuTimers : public cCurrentElement, public cScrapManager {
private:
const cTimer *timer;
public:

View File

@ -128,6 +128,54 @@ void cScrapManager::SetScraperPosterBanner(skindesignerapi::cTokenContainer *tk)
}
}
void cScrapManager::SetScraperPosterBannerChannel(skindesignerapi::cTokenContainer *tk) {
if (movie) {
tk->AddIntToken((int)eCeMenuChannelsIT::hasposter, 1);
tk->AddStringToken((int)eCeMenuChannelsST::posterpath, movie->poster.path.c_str());
tk->AddIntToken((int)eCeMenuChannelsIT::posterwidth, movie->poster.width);
tk->AddIntToken((int)eCeMenuChannelsIT::posterheight, movie->poster.height);
} else if (series) {
vector<cTvMedia>::iterator poster = series->posters.begin();
if (poster != series->posters.end()) {
tk->AddIntToken((int)eCeMenuChannelsIT::hasposter, 1);
tk->AddIntToken((int)eCeMenuChannelsIT::posterwidth, (*poster).width);
tk->AddIntToken((int)eCeMenuChannelsIT::posterheight, (*poster).height);
tk->AddStringToken((int)eCeMenuChannelsST::posterpath, (*poster).path.c_str());
}
vector<cTvMedia>::iterator banner = series->banners.begin();
if (banner != series->banners.end()) {
tk->AddIntToken((int)eCeMenuChannelsIT::hasbanner, 1);
tk->AddIntToken((int)eCeMenuChannelsIT::bannerwidth, (*banner).width);
tk->AddIntToken((int)eCeMenuChannelsIT::bannerheight, (*banner).height);
tk->AddStringToken((int)eCeMenuChannelsST::bannerpath, (*banner).path.c_str());
}
}
}
void cScrapManager::SetScraperPosterBannerTimer(skindesignerapi::cTokenContainer *tk) {
if (movie) {
tk->AddIntToken((int)eCeMenuTimersIT::hasposter, 1);
tk->AddStringToken((int)eCeMenuTimersST::posterpath, movie->poster.path.c_str());
tk->AddIntToken((int)eCeMenuTimersIT::posterwidth, movie->poster.width);
tk->AddIntToken((int)eCeMenuTimersIT::posterheight, movie->poster.height);
} else if (series) {
vector<cTvMedia>::iterator poster = series->posters.begin();
if (poster != series->posters.end()) {
tk->AddIntToken((int)eCeMenuTimersIT::hasposter, 1);
tk->AddIntToken((int)eCeMenuTimersIT::posterwidth, (*poster).width);
tk->AddIntToken((int)eCeMenuTimersIT::posterheight, (*poster).height);
tk->AddStringToken((int)eCeMenuTimersST::posterpath, (*poster).path.c_str());
}
vector<cTvMedia>::iterator banner = series->banners.begin();
if (banner != series->banners.end()) {
tk->AddIntToken((int)eCeMenuTimersIT::hasbanner, 1);
tk->AddIntToken((int)eCeMenuTimersIT::bannerwidth, (*banner).width);
tk->AddIntToken((int)eCeMenuTimersIT::bannerheight, (*banner).height);
tk->AddStringToken((int)eCeMenuTimersST::bannerpath, (*banner).path.c_str());
}
}
}
void cScrapManager::SetScraperRecordingPoster(skindesignerapi::cTokenContainer *tk, const cRecording *recording, bool isListElement) {
if (!pScraper) {
return;

View File

@ -18,6 +18,8 @@ protected:
int NumActors(void);
void SetHeaderScrapInfo(skindesignerapi::cTokenContainer *tk);
void SetScraperPosterBanner(skindesignerapi::cTokenContainer *tk);
void SetScraperPosterBannerChannel(skindesignerapi::cTokenContainer *tk);
void SetScraperPosterBannerTimer(skindesignerapi::cTokenContainer *tk);
void SetScraperRecordingPoster(skindesignerapi::cTokenContainer *tk, const cRecording *recording, bool isListElement);
void RecPoster(const cRecording *rec, int &posterWidth, int &posterHeight, string &path, bool &hasPoster);
void SetPosterBanner(skindesignerapi::cTokenContainer *tk, const cEvent *event, const cRecording *recording);

View File

@ -59,6 +59,10 @@
{posterwidth} width of scraped poster
{posterheight} height of scraped poster
{posterpath} absolute path of scraped poster
{hasbanner} true if a scraped banner is available for this elements present evemt
{bannerwidth} width of scraped banner
{bannerheight} height of scraped banner
{bannerpath} absolute path of scraped banner
{nexteventtitle} title of next event on this channel
{nexteventstart} next event start time in hh::mm
{nexteventstop} next event event stop time in hh::mm

View File

@ -53,6 +53,10 @@
{posterwidth} width of scraped poster
{posterheight} height of scraped poster
{posterpath} absolute path of scraped poster
{hasbanner} true if a scraped banner is available for event
{bannerwidth} width of scraped banner
{bannerheight} height of scraped banner
{bannerpath} absolute path of scraped banner
{flagactive} true if timer is active
{flaginstant} true if timer is an instant timer
{flagvps} true if timer uses VPS