From 6ae27238afa33e17dece7311c4728b5c1f2f83b2 Mon Sep 17 00:00:00 2001 From: kamel5 Date: Thu, 8 Mar 2018 13:10:09 +0100 Subject: [PATCH] Reinsert old tvscraper compatibility --- detailview.c | 6 +++--- statusheader.c | 6 +++--- tools.c | 8 ++++++++ tools.h | 3 +++ view.c | 12 ++++++------ 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/detailview.c b/detailview.c index 12accc3..e074de2 100644 --- a/detailview.c +++ b/detailview.c @@ -20,14 +20,14 @@ cDetailView::~cDetailView(void){ } void cDetailView::InitiateView(void) { - static cPlugin *pScraper2Vdr = cPluginManager::GetPlugin("scraper2vdr"); + static cPlugin *pScraper = GetScraperPlugin(); ScraperGetEventType call; if (!event) return; call.event = event; - if (!pScraper2Vdr) { + if (!pScraper) { view = new cEPGView(); - } else if (pScraper2Vdr->Service("GetEventType", &call)) { + } else if (pScraper->Service("GetEventType", &call)) { if (call.type == tMovie) { view = new cMovieView(call.movieId); } else if (call.type == tSeries) { diff --git a/statusheader.c b/statusheader.c index cac916e..fab48b5 100644 --- a/statusheader.c +++ b/statusheader.c @@ -104,11 +104,11 @@ int cStatusHeader::DrawPoster(const cEvent *event, int x, int y, int height, int ScraperGetPoster posterScraper2Vdr; int posterWidth = 0; int posterHeight = 0; - static cPlugin *pScraper2Vdr = cPluginManager::GetPlugin("scraper2vdr"); - if (pScraper2Vdr) { + static cPlugin *pScraper = GetScraperPlugin(); + if (pScraper) { posterScraper2Vdr.event = event; posterScraper2Vdr.recording = NULL; - if (pScraper2Vdr->Service("GetPoster", &posterScraper2Vdr)) { + if (pScraper->Service("GetPoster", &posterScraper2Vdr)) { hasPoster = true; int posterWidthOrig = posterScraper2Vdr.poster.width; int posterHeightOrig = posterScraper2Vdr.poster.height; diff --git a/tools.c b/tools.c index 2607332..b4eef16 100644 --- a/tools.c +++ b/tools.c @@ -8,10 +8,18 @@ #include #include #include +#include #include "services/epgsearch.h" #include "tools.h" +cPlugin *GetScraperPlugin(void) { + static cPlugin *pScraper = cPluginManager::GetPlugin("scraper2vdr"); + if( !pScraper ) // if it doesn't exit, try tvscraper + pScraper = cPluginManager::GetPlugin("tvscraper"); + return pScraper; +} + /**************************************************************************************** * CUTTEXT ****************************************************************************************/ diff --git a/tools.h b/tools.h index f401ea4..9dfab27 100644 --- a/tools.h +++ b/tools.h @@ -5,6 +5,9 @@ #include #include #include +#include + +cPlugin *GetScraperPlugin(void); std::string CutText(std::string text, int width, const cFont *font); std::string StrToLowerCase(std::string str); diff --git a/view.c b/view.c index 485ef36..27ab255 100644 --- a/view.c +++ b/view.c @@ -641,12 +641,12 @@ cSeriesView::~cSeriesView(void) { } void cSeriesView::LoadMedia(void) { - static cPlugin *pScraper2Vdr = cPluginManager::GetPlugin("scraper2vdr"); - if (!pScraper2Vdr || seriesId < 1) + static cPlugin *pScraper = GetScraperPlugin(); + if (!pScraper || seriesId < 1) return; series.seriesId = seriesId; series.episodeId = episodeId; - pScraper2Vdr->Service("GetSeries", &series); + pScraper->Service("GetSeries", &series); } void cSeriesView::SetTabs(void) { @@ -863,11 +863,11 @@ cMovieView::~cMovieView(void) { } void cMovieView::LoadMedia(void) { - static cPlugin *pScraper2Vdr = cPluginManager::GetPlugin("scraper2vdr"); - if (!pScraper2Vdr || movieId < 1) + static cPlugin *pScraper = GetScraperPlugin(); + if (!pScraper || movieId < 1) return; movie.movieId = movieId; - pScraper2Vdr->Service("GetMovie", &movie); + pScraper->Service("GetMovie", &movie); } void cMovieView::SetTabs(void) {