summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY4
-rw-r--r--scraper2vdr.c11
-rw-r--r--scraper2vdr.h2
-rw-r--r--scrapmanager.c63
-rw-r--r--scrapmanager.h1
-rw-r--r--services.h20
6 files changed, 89 insertions, 12 deletions
diff --git a/HISTORY b/HISTORY
index 088fadb..016de5a 100644
--- a/HISTORY
+++ b/HISTORY
@@ -29,5 +29,7 @@ Version 0.1.2
Version 0.1.3
- fixed a bug that series meta data is not loaded completely
- fixed crash during shutdown of plugin
-
- fixed escaping when deleting outdated recordings
+
+Version 0.1.4
+- added ScraperGetPosterBannerV2 Service
diff --git a/scraper2vdr.c b/scraper2vdr.c
index e81b9a2..8f81c50 100644
--- a/scraper2vdr.c
+++ b/scraper2vdr.c
@@ -186,11 +186,20 @@ bool cPluginScraper2vdr::Service(const char *Id, void *Data) {
if (strcmp(Id, "GetPosterBanner") == 0) {
ScraperGetPosterBanner* call = (ScraperGetPosterBanner*) Data;
- if (!call->event)
+ if (!call->event) {
return false;
+ }
return scrapManager->GetPosterBanner(call);
}
+ if (strcmp(Id, "GetPosterBannerV2") == 0) {
+ ScraperGetPosterBannerV2* call = (ScraperGetPosterBannerV2*) Data;
+ if (!call->event && !call->recording) {
+ return false;
+ }
+ return scrapManager->GetPosterBannerV2(call);
+ }
+
if (strcmp(Id, "GetPoster") == 0) {
ScraperGetPoster* call = (ScraperGetPoster*) Data;
if (!call->event && !call->recording)
diff --git a/scraper2vdr.h b/scraper2vdr.h
index ee76178..7346edf 100644
--- a/scraper2vdr.h
+++ b/scraper2vdr.h
@@ -13,7 +13,7 @@
//***************************************************************************
// Constants
//***************************************************************************
-static const char *VERSION = "0.1.3";
+static const char *VERSION = "0.1.4";
static const char *DESCRIPTION = "'scraper2vdr' plugin";
static const char *MAINMENUENTRY = "Scraper2Vdr";
diff --git a/scrapmanager.c b/scrapmanager.c
index b3f9af8..4b07ff3 100644
--- a/scrapmanager.c
+++ b/scrapmanager.c
@@ -354,7 +354,7 @@ void cScrapManager::DumpMovies(void) {
}
void cScrapManager::DumpRecordings(void) {
- tell(0, "%ld recordings in memory:", recordings.size());
+ tell(0, "%d recordings in memory:", recordings.size());
for (map<sRecordingsKey, sEventsValue>::iterator it = recordings.begin(); it != recordings.end(); it++) {
sRecordingsKey key = it->first;
sEventsValue val = it->second;
@@ -480,13 +480,60 @@ bool cScrapManager::GetMovie(cMovie *m) {
}
bool cScrapManager::GetPosterBanner(ScraperGetPosterBanner *call) {
- sEventsKey k;
- k.eventId = call->event->EventID();
- k.channelId = *(call->event->ChannelID().ToString());
- map<sEventsKey, sEventsValue>::iterator hit = events.find(k);
- if (hit == events.end())
- return false;
- sEventsValue v = hit->second;
+ sEventsValue v;
+ if (call->event) {
+ sEventsKey k;
+ k.eventId = call->event->EventID();
+ k.channelId = *(call->event->ChannelID().ToString());
+ map<sEventsKey, sEventsValue>::iterator hit = events.find(k);
+ if (hit == events.end())
+ return false;
+ v = hit->second;
+ }
+ if (v.seriesId > 0) {
+ call->type = tSeries;
+ map<int, cTVDBSeries*>::iterator hitSeries = series.find(v.seriesId);
+ if (hitSeries == series.end())
+ return false;
+ cTVDBSeries *s = hitSeries->second;
+ bool found = s->GetRandomBanner(&call->banner);
+ if (v.episodeId > 0) {
+ s->GetSeasonPoster(v.episodeId, &call->poster);
+ }
+ return found;
+ } else if (v.movieId > 0) {
+ call->type = tMovie;
+ map<int, cMovieDbMovie*>::iterator hitMovies = movies.find(v.movieId);
+ if (hitMovies == movies.end())
+ return false;
+ cMovieDbMovie *m = hitMovies->second;
+ return m->GetMedia(mmPoster, &call->poster);
+ } else {
+ call->type = tNone;
+ }
+ return false;
+}
+
+bool cScrapManager::GetPosterBannerV2(ScraperGetPosterBannerV2 *call) {
+ sEventsValue v;
+ if (call->event) {
+ sEventsKey k;
+ k.eventId = call->event->EventID();
+ k.channelId = *(call->event->ChannelID().ToString());
+ map<sEventsKey, sEventsValue>::iterator hit = events.find(k);
+ if (hit == events.end())
+ return false;
+ v = hit->second;
+ } else if (call->recording) {
+ sRecordingsKey k;
+ k.recStart = call->recording->Start();
+ k.recPath = getRecPath(call->recording);
+ map<sRecordingsKey, sEventsValue>::iterator hit = recordings.find(k);
+ if (hit == recordings.end()) {
+ return false;
+ }
+ v = hit->second;
+ }
if (v.seriesId > 0) {
call->type = tSeries;
map<int, cTVDBSeries*>::iterator hitSeries = series.find(v.seriesId);
diff --git a/scrapmanager.h b/scrapmanager.h
index 6899a2f..a65446a 100644
--- a/scrapmanager.h
+++ b/scrapmanager.h
@@ -75,6 +75,7 @@ class cScrapManager {
bool GetSeries(cSeries *series);
bool GetMovie(cMovie *movie);
bool GetPosterBanner(ScraperGetPosterBanner *call);
+ bool GetPosterBannerV2(ScraperGetPosterBannerV2 *call);
bool GetPoster(ScraperGetPoster *call);
bool GetPosterThumb(ScraperGetPosterThumb *call);
};
diff --git a/services.h b/services.h
index 570c350..5812837 100644
--- a/services.h
+++ b/services.h
@@ -162,15 +162,33 @@ class ScraperGetPosterBanner {
public:
ScraperGetPosterBanner(void) {
type = tNone;
+ event = NULL;
};
// in
- const cEvent *event; // check type for this event
+ const cEvent *event; // check type for this event
//out
tvType type; //typeSeries or typeMovie
cTvMedia poster;
cTvMedia banner;
};
+// Data structure for service "GetPosterBannerV2"
+class ScraperGetPosterBannerV2 {
+public:
+ ScraperGetPosterBannerV2(void) {
+ type = tNone;
+ event = NULL;
+ recording = NULL;
+ };
+// in
+ const cEvent *event; // check type for this event
+ const cRecording *recording; // check type for this recording
+//out
+ tvType type; //typeSeries or typeMovie
+ cTvMedia poster;
+ cTvMedia banner;
+};
+
// Data structure for service "GetPoster"
class ScraperGetPoster {
public: