mirror of
https://projects.vdr-developer.org/git/vdr-plugin-scraper2vdr.git
synced 2023-10-19 17:58:31 +02:00
Version 0.1.4: added ScraperGetPosterBannerV2 Service
This commit is contained in:
parent
2bfb7c7ce2
commit
74969a32d8
4
HISTORY
4
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
|
||||
|
@ -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)
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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) {
|
||||
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;
|
||||
sEventsValue v = hit->second;
|
||||
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);
|
||||
|
@ -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);
|
||||
};
|
||||
|
18
services.h
18
services.h
@ -162,6 +162,7 @@ class ScraperGetPosterBanner {
|
||||
public:
|
||||
ScraperGetPosterBanner(void) {
|
||||
type = tNone;
|
||||
event = NULL;
|
||||
};
|
||||
// in
|
||||
const cEvent *event; // check type for this event
|
||||
@ -171,6 +172,23 @@ public:
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user