diff options
author | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-03-27 21:45:09 +0100 |
---|---|---|
committer | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-03-27 21:45:09 +0100 |
commit | 686836f0fc23838878da872b0f1eab258a6271e7 (patch) | |
tree | 5008d4fee42e60e687ca66f498ecf16b92a4f4c9 | |
parent | a821a54d6b8c5f844623cbabc7a26843dbadccdf (diff) | |
download | skin-flatplus-686836f0fc23838878da872b0f1eab258a6271e7.tar.gz skin-flatplus-686836f0fc23838878da872b0f1eab258a6271e7.tar.bz2 |
tvscraper support for displaychannel
-rw-r--r-- | baserender.h | 3 | ||||
-rw-r--r-- | config.c | 5 | ||||
-rw-r--r-- | config.h | 3 | ||||
-rw-r--r-- | displaychannel.c | 43 | ||||
-rw-r--r-- | displaychannel.h | 5 | ||||
-rw-r--r-- | imageloader.c | 55 | ||||
-rw-r--r-- | imageloader.h | 1 | ||||
-rw-r--r-- | po/de_DE.po | 22 | ||||
-rw-r--r-- | services/tvscraper.h | 56 | ||||
-rw-r--r-- | setup.c | 52 | ||||
-rw-r--r-- | setup.h | 9 |
11 files changed, 241 insertions, 13 deletions
diff --git a/baserender.h b/baserender.h index b9ddcccb..bf583f02 100644 --- a/baserender.h +++ b/baserender.h @@ -10,7 +10,8 @@ enum eBorder { BorderMenuRecord, BorderMessage, BorderButton, - BorderContent + BorderContent, + BorderTVSPoster }; struct sDecorBorder { @@ -54,6 +54,9 @@ cFlatConfig::cFlatConfig(void) { MenuItemRecordingShowFolderDate = 1; MenuItemParseTilde = 1; + TVScraperChanInfoShowPoster = 1; + TVScraperChanInfoPosterSize = 0.01; + decorBorderChannelByTheme = 1; decorBorderChannelTypeUser = 0; decorBorderChannelSizeUser = 0; @@ -199,6 +202,8 @@ bool cFlatConfig::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "TopBarRecConflictsShow") == 0) TopBarRecConflictsShow = atoi(Value); else if (strcmp(Name, "TopBarRecConflictsHigh") == 0) TopBarRecConflictsHigh = atoi(Value); else if (strcmp(Name, "SignalQualityUseColors") == 0) SignalQualityUseColors = atoi(Value); + else if (strcmp(Name, "TVScraperChanInfoShowPoster") == 0) TVScraperChanInfoShowPoster = atoi(Value); + else if (strcmp(Name, "TVScraperChanInfoPosterSize") == 0) TVScraperChanInfoPosterSize = atod(Value); else return false; @@ -191,5 +191,8 @@ class cFlatConfig int MenuItemParseTilde; + // TVScraper + int TVScraperChanInfoShowPoster; + double TVScraperChanInfoPosterSize; int DecorIndex; }; diff --git a/displaychannel.c b/displaychannel.c index 5c57f76e..a5dbdeec 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -16,7 +16,8 @@ cFlatDisplayChannel::cFlatDisplayChannel(bool WithInfo) { chanLogoPixmap = NULL; chanLogoBGPixmap = NULL; chanIconsPixmap = NULL; - + chanEpgImagesPixmap = NULL; + isGroup = false; isRecording = false, isRadioChannel = false; @@ -53,6 +54,14 @@ cFlatDisplayChannel::cFlatDisplayChannel(bool WithInfo) { Config.decorBorderChannelSize+channelHeight - height, channelWidth, heightBottom)); chanIconsPixmap->Fill( clrTransparent ); + TVSLeft = 20 + Config.decorBorderChannelSize; + TVSTop = topBarHeight + 20 + Config.decorBorderChannelSize; + TVSWidth = osdWidth - 40 - Config.decorBorderChannelSize*2; + TVSHeight = osdHeight - topBarHeight - heightBottom - 40 - Config.decorBorderChannelSize*2; + + chanEpgImagesPixmap = osd->CreatePixmap(2, cRect(TVSLeft, TVSTop, TVSWidth, TVSHeight)); + chanEpgImagesPixmap->Fill( clrTransparent ); + chanLogoBGPixmap = osd->CreatePixmap(2, cRect(Config.decorBorderChannelSize, Config.decorBorderChannelSize+channelHeight - height, heightBottom, heightBottom)); chanLogoBGPixmap->Fill( clrTransparent ); @@ -92,6 +101,8 @@ cFlatDisplayChannel::~cFlatDisplayChannel() { osd->DestroyPixmap(chanLogoBGPixmap); if( chanIconsPixmap ) osd->DestroyPixmap(chanIconsPixmap); + if( chanEpgImagesPixmap ) + osd->DestroyPixmap(chanEpgImagesPixmap); } } @@ -413,9 +424,39 @@ void cFlatDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Followi Theme.Color(clrChannelRecordingFollowFg), Theme.Color(clrChannelRecordingFollowBg), fontSml); } } + if( Config.ChannelIconsShow && CurChannel ) { ChannelIconsDraw(CurChannel, false); } + + // TVScraper + chanEpgImagesPixmap->Fill(clrTransparent); + DecorBorderClearByFrom(BorderTVSPoster); + static cPlugin *pTVScraper = cPluginManager::GetPlugin("tvscraper"); + dsyslog("TVScraperChanInfoPosterSize: %f", Config.TVScraperChanInfoPosterSize ); + if( Config.TVScraperChanInfoShowPoster && pTVScraper ) { + TVScraperGetPosterOrBanner call; + call.event = Present; + if (pTVScraper->Service("TVScraperGetPosterOrBanner", &call)) { + int mediaWidth = 0; + int mediaHeight = 0; + if (call.type == typeSeries) { + mediaWidth = call.media.width * Config.TVScraperChanInfoPosterSize*100; + mediaHeight = call.media.height * Config.TVScraperChanInfoPosterSize*100; + } else if (call.type == typeMovie) { + mediaWidth = call.media.width * 0.5 * Config.TVScraperChanInfoPosterSize*100; + mediaHeight = call.media.height * 0.5 * Config.TVScraperChanInfoPosterSize*100; + } + cImage *img = imgLoader.LoadFile(call.media.path.c_str(), mediaWidth, mediaHeight); + + if( img ) { + chanEpgImagesPixmap->DrawImage(cPoint(0, 0), *img); + + DecorBorderDraw(20 + Config.decorBorderChannelSize, topBarHeight + 20 + Config.decorBorderChannelSize, img->Width(), img->Height(), + Config.decorBorderChannelSize, Config.decorBorderChannelType, Config.decorBorderChannelFg, Config.decorBorderChannelBg, BorderTVSPoster); + } + } + } } void cFlatDisplayChannel::SetMessage(eMessageType Type, const char *Text) { diff --git a/displaychannel.h b/displaychannel.h index 83011118..756ba85c 100644 --- a/displaychannel.h +++ b/displaychannel.h @@ -2,6 +2,7 @@ #include "baserender.h" #include "flat.h" +#include "services/tvscraper.h" class cFlatDisplayChannel : public cFlatBaseRender, public cSkinDisplayChannel { private: @@ -18,6 +19,7 @@ class cFlatDisplayChannel : public cFlatBaseRender, public cSkinDisplayChannel { cPixmap *chanLogoPixmap; cPixmap *chanLogoBGPixmap; cPixmap *chanIconsPixmap; + cPixmap *chanEpgImagesPixmap; int screenWidth, lastScreenWidth; int screenHeight; @@ -26,6 +28,9 @@ class cFlatDisplayChannel : public cFlatBaseRender, public cSkinDisplayChannel { int LastSignalStrength, LastSignalQuality; + // TVScraper + int TVSLeft, TVSTop, TVSWidth, TVSHeight; + bool isRecording; bool isRadioChannel; bool isGroup; diff --git a/imageloader.c b/imageloader.c index d1b52984..cef0f5c3 100644 --- a/imageloader.c +++ b/imageloader.c @@ -156,6 +156,61 @@ cImage* cImageLoader::LoadIcon(const char *cIcon, int width, int height, bool pr return img; } +cImage* cImageLoader::LoadFile(const char *cFile, int width, int height, bool preserveAspect) { + if( (width == 0) || (height==0) ) + return NULL; + cString File = cFile; + #ifdef DEBUGIMAGELOADTIME + dsyslog("imageloader load file %s", *File); + #endif + + cImage *img; + #ifdef DEBUGIMAGELOADTIME + uint32_t tick1 = GetMsTicks(); + #endif + + img = imgCache.GetImage( *File, width, height ); + + #ifdef DEBUGIMAGELOADTIME + uint32_t tick2 = GetMsTicks(); + dsyslog(" search in cache: %d ms", tick2 - tick1); + #endif + if( img != NULL ) + return img; + + #ifdef DEBUGIMAGELOADTIME + uint32_t tick3 = GetMsTicks(); + #endif + + bool success = LoadImage(File); + + if( !success ) { + dsyslog("imageloader LoadFile: %s could not be loaded", *File); + return NULL; + } + #ifdef DEBUGIMAGELOADTIME + uint32_t tick4 = GetMsTicks(); + dsyslog(" load file from disk: %d ms", tick4 - tick3); + #endif + + #ifdef DEBUGIMAGELOADTIME + uint32_t tick5 = GetMsTicks(); + #endif + + img = CreateImage(width, height); + + if( img == NULL ) + return NULL; + + #ifdef DEBUGIMAGELOADTIME + uint32_t tick6 = GetMsTicks(); + dsyslog(" scale logo: %d ms", tick6 - tick5); + #endif + + imgCache.InsertImage(img, *File, width, height); + return img; +} + void cImageLoader::toLowerCase(std::string &str) { const int length = str.length(); for(int i=0; i < length; ++i) { diff --git a/imageloader.h b/imageloader.h index bdcfc787..3458b27c 100644 --- a/imageloader.h +++ b/imageloader.h @@ -18,6 +18,7 @@ public: cImage* LoadLogo(const char *logo, int width, int height); cImage* LoadIcon(const char *cIcon, int width, int height, bool preserveAspect = true); + cImage* LoadFile(const char *cFile, int width, int height, bool preserveAspect = true); private: int epgImageWidthLarge, epgImageHeightLarge; diff --git a/po/de_DE.po b/po/de_DE.po index 0d05b841..4c3a9ad9 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skinflat 0.2.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2014-03-22 16:32+0100\n" +"POT-Creation-Date: 2014-03-27 21:33+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -156,6 +156,12 @@ msgstr "Lautstärke Einstellungen" msgid "Tracks settings" msgstr "Audiospur Einstellungen" +msgid "TVScraper settings" +msgstr "TVScraper Einstellungen" + +msgid "TVScraper not installed" +msgstr "TVScraper nicht installiert" + msgid "Decorfile" msgstr "Decordatei" @@ -372,14 +378,8 @@ msgstr "Audiospur Rand Typ" msgid "Tracks border size" msgstr "Audiospur Rand Größe" -#~ msgid "C" -#~ msgstr "K" - -#~ msgid "Recordings" -#~ msgstr "Aufnahmen" - -#~ msgid "Unwatched" -#~ msgstr "Ungesehen" +msgid "Channelinfo show poster?" +msgstr "Kanalinfo zeige Poster?" -#~ msgid "Recs" -#~ msgstr "Aufn." +msgid "Channelinfo poster size" +msgstr "Kanalinfo Poster Größe" diff --git a/services/tvscraper.h b/services/tvscraper.h new file mode 100644 index 00000000..fc278add --- /dev/null +++ b/services/tvscraper.h @@ -0,0 +1,56 @@ +enum tvMediaType { + typeSeries, + typeMovie, + typeNone, +}; + +struct tvMedia { + std::string path; + int width; + int height; +}; + +struct tvActor { + std::string name; + std::string role; + tvMedia thumb; +}; + +// Data structure for service "TVScraper-GetPosterOrBanner" +struct TVScraperGetPosterOrBanner +{ +// in + const cEvent *event; // search image for this event +//out + tvMediaType type; //typeSeries or typeMovie + tvMedia media; //banner or poster +}; + +// Data structure for service "TVScraper-GetPoster" +struct TVScraperGetPoster +{ +// in + const cEvent *event; // search image for this event + bool isRecording; // search in current EPG or recordings +//out + tvMedia media; //poster +}; + + +/* Data structure for service "TVScraper-GetFullEPGInformation" +if type == typeMovie a poster and a fanart image is delivered +if type == typeSeries a banner and up to three posters and fanarts are delivered +*/ +struct TVScraperGetFullInformation +{ +// in + const cEvent *event; // search all media for this event + bool isRecording; // search in current EPG or recordings +//out + tvMediaType type; + tvMedia banner; + std::vector<tvMedia> posters; + std::vector<tvMedia> fanart; + std::vector<tvActor> actors; + std::string description; +};
\ No newline at end of file @@ -76,6 +76,12 @@ void cFlatSetup::Setup(void) { Add(new cOsdItem(tr("Volume settings"), osUnknown, true)); Add(new cOsdItem(tr("Tracks settings"), osUnknown, true)); + static cPlugin *pTVScraper = cPluginManager::GetPlugin("tvscraper"); + if (pTVScraper) + Add(new cOsdItem(tr("TVScraper settings"), osUnknown, true)); + else + Add(new cOsdItem(tr("TVScraper not installed"), osUnknown, false)); + if( ItemLastSel >= 0 ) { SetCurrent(Get(ItemLastSel)); ItemLastSel = -1; @@ -104,6 +110,8 @@ eOSState cFlatSetup::ProcessKey(eKeys Key) { state = AddSubMenu(new cFlatSetupVolume(&SetupConfig)); if (strcmp(ItemText, tr("Tracks settings")) == 0) state = AddSubMenu(new cFlatSetupTracks(&SetupConfig)); + if (strcmp(ItemText, tr("TVScraper settings")) == 0) + state = AddSubMenu(new cFlatSetupTvsraper(&SetupConfig)); } } return state; @@ -189,6 +197,8 @@ void cFlatSetup::Store(void) { SetupStore("TopBarRecConflictsShow", Config.TopBarRecConflictsShow); SetupStore("TopBarRecConflictsHigh", Config.TopBarRecConflictsHigh); SetupStore("SignalQualityUseColors", Config.SignalQualityUseColors); + SetupStore("TVScraperChanInfoShowPoster", Config.TVScraperChanInfoShowPoster); + SetupStore("TVScraperChanInfoPosterSize", dtoa(Config.TVScraperChanInfoPosterSize)); Config.Init(); } @@ -644,3 +654,45 @@ eOSState cFlatSetupTracks::ProcessKey(eKeys Key) { } return state; } + +// TVScraper Settings +cFlatSetupTvsraper::cFlatSetupTvsraper(cFlatConfig* data) : cMenuSetupSubMenu(tr("Tracks settings"), data) { + Setup(); +} + +void cFlatSetupTvsraper::Setup(void) { + Clear(); + + Add(new cMenuEditBoolItem(tr("Channelinfo show poster?"), &SetupConfig->TVScraperChanInfoShowPoster)); + Add(new cMenuEditPrcItem(tr("Channelinfo poster size"), &SetupConfig->TVScraperChanInfoPosterSize, 0.004, 0.015, 2)); + + if( ItemLastSel >= 0 ) { + SetCurrent(Get(ItemLastSel)); + ItemLastSel = -1; + } + + Display(); +} + +eOSState cFlatSetupTvsraper::ProcessKey(eKeys Key) { + eOSState state = cOsdMenu::ProcessKey(Key); + if (state == osUnknown) { + switch (Key) { + case kOk: + return osBack; + default: + break; + } + } + /* + if( Key == kLeft || Key == kRight ) { + const char* ItemText = Get(Current())->Text(); + if( strstr(ItemText, tr("Tracks border by decor-file?")) != NULL + ) { + ItemLastSel = Current(); + Setup(); + } + } + */ + return state; +} @@ -3,6 +3,7 @@ #include <vdr/menu.h> #include <vdr/tools.h> #include "config.h" +#include "services/tvscraper.h" class cFlatSetup : public cMenuSetupPage { public: @@ -76,3 +77,11 @@ class cFlatSetupTracks : public cMenuSetupSubMenu { cFlatSetupTracks(cFlatConfig *data); virtual eOSState ProcessKey(eKeys Key); }; + +class cFlatSetupTvsraper : public cMenuSetupSubMenu { + protected: + void Setup(void); + public: + cFlatSetupTvsraper(cFlatConfig *data); + virtual eOSState ProcessKey(eKeys Key); +}; |