diff options
author | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-05-18 14:34:45 +0200 |
---|---|---|
committer | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-05-18 14:34:45 +0200 |
commit | 1271728831c84ae458720dc0f659ef23f18aadd8 (patch) | |
tree | 1d3342a4558c9111bcdbce20b3a01b244e9994ec | |
parent | 19235b742a8aa6b02cce98325945ca79e72feca1 (diff) | |
download | skin-flatplus-1271728831c84ae458720dc0f659ef23f18aadd8.tar.gz skin-flatplus-1271728831c84ae458720dc0f659ef23f18aadd8.tar.bz2 |
new tvscraper service api. Use only with new tvscraper version 0.2.0 or greater!
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | baserender.c | 1 | ||||
-rw-r--r-- | displaychannel.c | 23 | ||||
-rw-r--r-- | displaychannel.h | 1 | ||||
-rw-r--r-- | displaymenu.c | 148 | ||||
-rw-r--r-- | services/tvscraper.h | 56 | ||||
-rw-r--r-- | setup.c | 8 | ||||
-rw-r--r-- | setup.h | 1 |
8 files changed, 50 insertions, 192 deletions
@@ -1,6 +1,10 @@ VDR Plugin 'skinflatplus' Revision History --------------------------------------- +2014-XX-XX: Version 0.3.1 +- [fix] epg image position on channel info +- [update] tvsraper service api. ! Use only with new TVScraper Version 0.2.0 or greater ! + 2014-11-05: Version 0.3.0 - [fix] use only current Event in extraevent display in displaychannel - [fix] SetRecording border with deleteresume.patch diff --git a/baserender.c b/baserender.c index e6dce06f..eebda28e 100644 --- a/baserender.c +++ b/baserender.c @@ -2,7 +2,6 @@ #include "flat.h" #include <vdr/menu.h> #include "services/epgsearch.h" -#include "services/tvscraper.h" cFlatBaseRender::cFlatBaseRender(void) { font = cFont::CreateFont(Setup.FontOsd, Setup.FontOsdSize ); diff --git a/displaychannel.c b/displaychannel.c index 1301efcb..b06ec3f7 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -439,12 +439,14 @@ void cFlatDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Followi int mediaHeight = 0; // TVScraper - static cPlugin *pTVScraper = cPluginManager::GetPlugin("tvscraper"); - static cPlugin *pScraper2Vdr = cPluginManager::GetPlugin("scraper2vdr"); - if( Config.TVScraperChanInfoShowPoster && pScraper2Vdr ) { + // first try scraper2vdr + static cPlugin *pScraper = cPluginManager::GetPlugin("scraper2vdr"); + if( !pScraper ) // if it doesn't exit, try tvscraper + pScraper = cPluginManager::GetPlugin("tvscraper"); + if( Config.TVScraperChanInfoShowPoster && pScraper ) { ScraperGetPosterBanner call; call.event = Present; - if (pScraper2Vdr->Service("GetPosterBanner", &call)) { + if (pScraper->Service("GetPosterBanner", &call)) { if ((call.type == tSeries) && call.banner.path.size() > 0) { mediaWidth = call.banner.width * Config.TVScraperChanInfoPosterSize*100; mediaHeight = call.banner.height * Config.TVScraperChanInfoPosterSize*100; @@ -455,19 +457,6 @@ void cFlatDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Followi mediaPath = call.poster.path; } } - } else if( Config.TVScraperChanInfoShowPoster && pTVScraper ) { - TVScraperGetPosterOrBanner call; - call.event = Present; - if (pTVScraper->Service("TVScraperGetPosterOrBanner", &call)) { - 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; - } - mediaPath = call.media.path; - } } chanEpgImagesPixmap->Fill(clrTransparent); diff --git a/displaychannel.h b/displaychannel.h index 696002a1..660fc60b 100644 --- a/displaychannel.h +++ b/displaychannel.h @@ -2,7 +2,6 @@ #include "baserender.h" #include "flat.h" -#include "services/tvscraper.h" #include "services/scraper2vdr.h" class cFlatDisplayChannel : public cFlatBaseRender, public cSkinDisplayChannel { diff --git a/displaymenu.c b/displaymenu.c index 94610750..521f7be9 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -1,5 +1,4 @@ #include "displaymenu.h" -#include "services/tvscraper.h" #include "services/scraper2vdr.h" #include "services/epgsearch.h" @@ -946,13 +945,16 @@ void cFlatDisplayMenu::DrawItemExtraEvent(const cEvent *Event, cString EmptyText int mediaWidth = 0; int mediaHeight = 0; int mediaType = 0; - // TVScraper - static cPlugin *pTVScraper = cPluginManager::GetPlugin("tvscraper"); - static cPlugin *pScraper2Vdr = cPluginManager::GetPlugin("scraper2vdr"); - if( Config.TVScraperEPGInfoShowPoster && pScraper2Vdr ) { + + // first try scraper2vdr + static cPlugin *pScraper = cPluginManager::GetPlugin("scraper2vdr"); + if( !pScraper ) // if it doesn't exit, try tvscraper + pScraper = cPluginManager::GetPlugin("tvscraper"); + + if( Config.TVScraperEPGInfoShowPoster && pScraper ) { ScraperGetPosterBanner call; call.event = Event; - if (pScraper2Vdr->Service("GetPosterBanner", &call)) { + if (pScraper->Service("GetPosterBanner", &call)) { if ((call.type == tSeries) && call.banner.path.size() > 0) { mediaWidth = cWidth - marginItem*2; mediaHeight = 999; @@ -965,21 +967,6 @@ void cFlatDisplayMenu::DrawItemExtraEvent(const cEvent *Event, cString EmptyText mediaType = 2; } } - } else if( Config.TVScraperEPGInfoShowPoster && pTVScraper ) { - TVScraperGetPosterOrBanner call; - call.event = Event; - if (pTVScraper->Service("TVScraperGetPosterOrBanner", &call)) { - if (call.type == typeSeries) { - mediaWidth = cWidth - marginItem*2; - mediaHeight = 999; - mediaType = 1; - } else if (call.type == typeMovie) { - mediaWidth = cWidth/2 - marginItem*3; - mediaHeight = 999; - mediaType = 2; - } - mediaPath = call.media.path; - } } if( mediaPath.length() > 0 ) { @@ -2003,17 +1990,18 @@ void cFlatDisplayMenu::SetEvent(const cEvent *Event) { uint32_t tick3 = GetMsTicks(); #endif - // TVScraper - static cPlugin *pTVScraper = cPluginManager::GetPlugin("tvscraper"); - static cPlugin *pScraper2Vdr = cPluginManager::GetPlugin("scraper2vdr"); - if( (Config.TVScraperEPGInfoShowPoster || Config.TVScraperEPGInfoShowActors) && pScraper2Vdr ) { + // first try scraper2vdr + static cPlugin *pScraper = cPluginManager::GetPlugin("scraper2vdr"); + if( !pScraper ) // if it doesn't exit, try tvscraper + pScraper = cPluginManager::GetPlugin("tvscraper"); + if( (Config.TVScraperEPGInfoShowPoster || Config.TVScraperEPGInfoShowActors) && pScraper ) { ScraperGetEventType call; call.event = Event; int seriesId = 0; int episodeId = 0; int movieId = 0; - if (pScraper2Vdr->Service("GetEventType", &call)) { + if (pScraper->Service("GetEventType", &call)) { seriesId = call.seriesId; episodeId = call.episodeId; movieId = call.movieId; @@ -2022,7 +2010,7 @@ void cFlatDisplayMenu::SetEvent(const cEvent *Event) { cSeries series; series.seriesId = seriesId; series.episodeId = episodeId; - if (pScraper2Vdr->Service("GetSeries", &series)) { + if (pScraper->Service("GetSeries", &series)) { if( series.banners.size() > 0 ) mediaPath = series.banners[0].path; mediaWidth = cWidth/2 - marginItem*2; @@ -2056,7 +2044,7 @@ void cFlatDisplayMenu::SetEvent(const cEvent *Event) { } else if (movieId > 0) { cMovie movie; movie.movieId = movieId; - if (pScraper2Vdr->Service("GetMovie", &movie)) { + if (pScraper->Service("GetMovie", &movie)) { mediaPath = movie.poster.path; mediaWidth = cWidth/2 - marginItem*3; mediaHeight = cHeight - marginItem*2 - fontHeight - 6; @@ -2085,32 +2073,8 @@ void cFlatDisplayMenu::SetEvent(const cEvent *Event) { movie_info << tr("vote average: ") << movie.voteAverage << endl; } } - } else if( (Config.TVScraperEPGInfoShowPoster || Config.TVScraperEPGInfoShowActors) && pTVScraper ) { - TVScraperGetFullInformation call; - call.event = Event; - call.isRecording = false; - if (pTVScraper->Service("TVScraperGetFullInformation", &call)) { - if (call.type == typeSeries) { - mediaWidth = cWidth/2 - marginItem*2; - mediaHeight = cHeight - marginItem*2 - fontHeight - 6; - mediaPath = call.banner.path; - } else if (call.type == typeMovie) { - mediaWidth = cWidth/2 - marginItem*3; - mediaHeight = cHeight - marginItem*2 - fontHeight - 6; - if( call.posters.size() > 0 ) - mediaPath = call.posters[0].path; - } - if( Config.TVScraperEPGInfoShowActors ) { - for( unsigned int i = 0; i < call.actors.size(); i++ ) { - if( imgLoader.FileExits(call.actors[i].thumb.path) ) { - actors_path.push_back(call.actors[i].thumb.path); - actors_name.push_back(call.actors[i].name); - actors_role.push_back(call.actors[i].role); - } - } - } - } } + #ifdef DEBUGEPGTIME uint32_t tick4 = GetMsTicks(); dsyslog("SetEvent tvscraper time: %d ms", tick4 - tick3); @@ -2268,10 +2232,8 @@ void cFlatDisplayMenu::DrawItemExtraRecording(const cRecording *Recording, cStri buttonsHeight + Config.decorBorderButtonSize*2 + marginItem*3 + Config.decorBorderMenuContentSize*2); ostringstream text; - const cEvent *Event = NULL; if( Recording ) { const cRecordingInfo *recInfo = Recording->Info(); - Event = recInfo->GetEvent(); text.imbue(std::locale("")); if (!isempty(recInfo->Description())) @@ -2474,17 +2436,18 @@ void cFlatDisplayMenu::DrawItemExtraRecording(const cRecording *Recording, cStri int mediaHeight = 0; int mediaType = 0; - // TVScraper - static cPlugin *pTVScraper = cPluginManager::GetPlugin("tvscraper"); - static cPlugin *pScraper2Vdr = cPluginManager::GetPlugin("scraper2vdr"); - if( Config.TVScraperRecInfoShowPoster && pScraper2Vdr ) { + // first try scraper2vdr + static cPlugin *pScraper = cPluginManager::GetPlugin("scraper2vdr"); + if( !pScraper ) // if it doesn't exit, try tvscraper + pScraper = cPluginManager::GetPlugin("tvscraper"); + if( Config.TVScraperRecInfoShowPoster && pScraper ) { ScraperGetEventType call; call.recording = Recording; int seriesId = 0; int episodeId = 0; int movieId = 0; - if (pScraper2Vdr->Service("GetEventType", &call)) { + if (pScraper->Service("GetEventType", &call)) { seriesId = call.seriesId; episodeId = call.episodeId; movieId = call.movieId; @@ -2493,7 +2456,7 @@ void cFlatDisplayMenu::DrawItemExtraRecording(const cRecording *Recording, cStri cSeries series; series.seriesId = seriesId; series.episodeId = episodeId; - if (pScraper2Vdr->Service("GetSeries", &series)) { + if (pScraper->Service("GetSeries", &series)) { if( series.banners.size() > 0 ) mediaPath = series.banners[0].path; mediaWidth = cWidth - marginItem*2; @@ -2503,32 +2466,15 @@ void cFlatDisplayMenu::DrawItemExtraRecording(const cRecording *Recording, cStri } else if (movieId > 0) { cMovie movie; movie.movieId = movieId; - if (pScraper2Vdr->Service("GetMovie", &movie)) { + if (pScraper->Service("GetMovie", &movie)) { mediaPath = movie.poster.path; mediaWidth = cWidth/2 - marginItem*3; mediaHeight = 999; mediaType = 2; } } - } else if( Config.TVScraperRecInfoShowPoster && pTVScraper ) { - TVScraperGetFullInformation call; - call.event = Event; - call.isRecording = true; - if (pTVScraper->Service("TVScraperGetFullInformation", &call)) { - if (call.type == typeSeries) { - mediaWidth = cWidth - marginItem*2; - mediaHeight = 999; - mediaType = 1; - mediaPath = call.banner.path; - } else if (call.type == typeMovie) { - mediaWidth = cWidth/2 - marginItem*3; - mediaHeight = 999; - mediaType = 2; - if( call.posters.size() > 0 ) - mediaPath = call.posters[0].path; - } - } } + if( mediaPath.length() > 0 ) { cImage *img = imgLoader.LoadFile(mediaPath.c_str(), mediaWidth, mediaHeight); if( img && mediaType == 2 ) { @@ -2573,7 +2519,6 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { ItemBorderClear(); const cRecordingInfo *recInfo = Recording->Info(); - const cEvent *Event = recInfo->GetEvent(); chLeft = Config.decorBorderMenuContentHeadSize; chTop = topBarHeight + marginItem + Config.decorBorderTopBarSize*2 + Config.decorBorderMenuContentHeadSize; @@ -2827,17 +2772,18 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { uint32_t tick2 = GetMsTicks(); #endif - // TVScraper - static cPlugin *pTVScraper = cPluginManager::GetPlugin("tvscraper"); - static cPlugin *pScraper2Vdr = cPluginManager::GetPlugin("scraper2vdr"); - if( (Config.TVScraperRecInfoShowPoster || Config.TVScraperRecInfoShowActors) && pScraper2Vdr ) { + // first try scraper2vdr + static cPlugin *pScraper = cPluginManager::GetPlugin("scraper2vdr"); + if( !pScraper ) // if it doesn't exit, try tvscraper + pScraper = cPluginManager::GetPlugin("tvscraper"); + if( (Config.TVScraperRecInfoShowPoster || Config.TVScraperRecInfoShowActors) && pScraper ) { ScraperGetEventType call; call.recording = Recording; int seriesId = 0; int episodeId = 0; int movieId = 0; - if (pScraper2Vdr->Service("GetEventType", &call)) { + if (pScraper->Service("GetEventType", &call)) { seriesId = call.seriesId; episodeId = call.episodeId; movieId = call.movieId; @@ -2846,7 +2792,7 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { cSeries series; series.seriesId = seriesId; series.episodeId = episodeId; - if (pScraper2Vdr->Service("GetSeries", &series)) { + if (pScraper->Service("GetSeries", &series)) { if( series.banners.size() > 0 ) mediaPath = series.banners[0].path; mediaWidth = cWidth/2 - marginItem*2; @@ -2880,7 +2826,7 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { } else if (movieId > 0) { cMovie movie; movie.movieId = movieId; - if (pScraper2Vdr->Service("GetMovie", &movie)) { + if (pScraper->Service("GetMovie", &movie)) { mediaPath = movie.poster.path; mediaWidth = cWidth/2 - marginItem*3; mediaHeight = cHeight - marginItem*2 - fontHeight - 6; @@ -2909,32 +2855,8 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { movie_info << tr("vote average: ") << movie.voteAverage << endl; } } - } else if( (Config.TVScraperRecInfoShowPoster || Config.TVScraperRecInfoShowActors) && pTVScraper ) { - TVScraperGetFullInformation call; - call.event = Event; - call.isRecording = true; - if (pTVScraper->Service("TVScraperGetFullInformation", &call)) { - if (call.type == typeSeries) { - mediaWidth = cWidth/2 - marginItem*2; - mediaHeight = cHeight - marginItem*2 - fontHeight - 6; - mediaPath = call.banner.path; - } else if (call.type == typeMovie) { - mediaWidth = cWidth/2 - marginItem*3; - mediaHeight = cHeight - marginItem*2 - fontHeight - 6; - if( call.posters.size() > 0 ) - mediaPath = call.posters[0].path; - } - if( Config.TVScraperRecInfoShowActors ) { - for( unsigned int i = 0; i < call.actors.size(); i++ ) { - if( imgLoader.FileExits( call.actors[i].thumb.path )) { - actors_path.push_back(call.actors[i].thumb.path); - actors_name.push_back(call.actors[i].name); - actors_role.push_back(call.actors[i].role); - } - } - } - } } + #ifdef DEBUGEPGTIME uint32_t tick3 = GetMsTicks(); dsyslog("SetRecording tvscraper time: %d ms", tick3 - tick2); diff --git a/services/tvscraper.h b/services/tvscraper.h deleted file mode 100644 index fc278add..00000000 --- a/services/tvscraper.h +++ /dev/null @@ -1,56 +0,0 @@ -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 @@ -83,9 +83,11 @@ 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"); - static cPlugin *pScraper2Vdr = cPluginManager::GetPlugin("scraper2vdr"); - if( pTVScraper || pScraper2Vdr ) + // first try scraper2vdr + static cPlugin *pScraper = cPluginManager::GetPlugin("scraper2vdr"); + if( !pScraper ) // if it doesn't exit, try tvscraper + pScraper = cPluginManager::GetPlugin("tvscraper"); + if( pScraper ) Add(new cOsdItem(tr("TVScraper / scraper2vdr settings"), osUnknown, true)); else Add(new cOsdItem(tr("TVScraper / scraper2vdr not installed"), osUnknown, false)); @@ -3,7 +3,6 @@ #include <vdr/menu.h> #include <vdr/tools.h> #include "config.h" -#include "services/tvscraper.h" #include "services/scraper2vdr.h" class cFlatSetup : public cMenuSetupPage { |