-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscrapmanager.h
99 lines (91 loc) · 4.5 KB
/
scrapmanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef __SCRAPMANAGER_H
#define __SCRAPMANAGER_H
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include "lib/common.h"
#include "lib/db.h"
#include "services.h"
#include "tvdbseries.h"
#include "moviedbmovie.h"
using namespace std;
struct sEventsKey {
int eventId;
string channelId;
};
struct sEventsValue {
int seriesId {0};
int episodeId {0};
int movieId {0};
bool isNew {false};
};
struct sRecordingsKey {
int recStart;
string recPath;
};
class cScrapManager {
private:
map<sEventsKey, sEventsValue> events;
map<sEventsKey, sEventsValue>::iterator eventsIterator;
map<sRecordingsKey, sEventsValue> recordings;
map<sRecordingsKey, sEventsValue>::iterator recIterator;
map<int, cTVDBSeries*> series;
map<int, cTVDBSeries*>::iterator seriesIterator;
map<int, cMovieDbMovie*> movies;
map<int, cMovieDbMovie*>::iterator moviesIterator;
map<int, cMovieMedia*> movieActorsThumbs; // map with all movie actor thumbs
map<int, cMovieMedia*>::iterator movieActorsThumbsIterator;
public:
cScrapManager(void);
virtual ~cScrapManager(void);
//Series and Movies Handling
void AddEvent(int eventId, string channelId, int seriesId, int episodeId, int movieId);
void InitIterator(bool isRec);
int GetNumSeries(void) { return series.size(); };
int GetNumMovies(void) { return movies.size(); };
int GetNumMovieActors(void) { return movieActorsThumbs.size(); };
sEventsValue GetEventInformation(int eventId, string channelId);
bool GetNextSeries(bool isRec, int &seriesId, int &episodeId);
bool GetNextMovie(bool isRec, int &movieId);
int GetSeriesFirst(cTVDBSeries* &seriesval); // get first series (also init series iterator)
int GetSeriesNext(cTVDBSeries* &seriesval); // get next series from iterator
int GetMoviesFirst(cMovieDbMovie* &movieval); // get first movie (also init series iterator)
int GetMoviesNext(cMovieDbMovie* &movieval); // get next movie from iterator
cTVDBSeries *GetSeries(int seriesId);
cMovieDbMovie *GetMovie(int movieId);
cTVDBSeries *AddSeries(cDbTable* tSeries);
void UpdateSeries(cTVDBSeries *seriesval, cDbTable* tSeries); // update series using values from current db row
cMovieDbMovie *AddMovie(cDbTable* tMovies);
void UpdateMovie(cMovieDbMovie *movieval, cDbTable* tMovies); // update movie using values from current db row
void AddSeriesEpisode(cTVDBSeries *series, cDbTable* tEpisodes);
void UpdateSeriesEpisode(cTVDBEpisode *episode, cDbTable* tEpisodes); // update episode using values from current db row
cTVDBActor *AddSeriesActor(cTVDBSeries *series, cDbTable* tActors);
void UpdateSeriesActor(cTVDBActor *actor, cDbTable* tActors); // update actor using values from current db row
cMovieActor *AddMovieActor(cMovieDbMovie *movie, cDbTable* tActor, string role, bool noActorThumb);
void UpdateMovieActor(cMovieActor *actor, cDbTable* tActor, string role); // update actor using values from current db row
void AddMovieMedia(cMovieDbMovie *movie, cDbTable* tMovieMedia, string path);
cMovieMedia *GetMovieActorThumb(int actorId); // try to find actor in global movie actor thumbs map
cMovieMedia *AddMovieActorThumb(int actorId, int imgWidth, int imgHeight, string path, bool needrefresh); // insert movie actor thumb
int GetMovieActorThumbFirst(int &actorId, cMovieMedia* &movieActorThumb); // get first movie actor (also init series iterator)
int GetMovieActorThumbNext(int &actorId, cMovieMedia* &movieActorThumb); // get next movie actor from iterator
//Recording Handling
bool AddRecording(int recStart, string recPath, int seriesId, int episodeId, int movieId);
bool RecordingExists(int recStart, string recPath);
bool SeriesInUse(int seriesId);
bool MovieInUse(int movieId);
//Debug
void DumpSeries(void);
void DumpMovies(void);
void DumpRecordings(void);
//Service Calls
bool GetEventType(ScraperGetEventType *call);
bool GetSeries(cSeries *series);
bool GetMovie(cMovie *movie);
bool GetPosterBanner(ScraperGetPosterBanner *call);
bool GetPosterBannerV2(ScraperGetPosterBannerV2 *call);
bool GetPoster(ScraperGetPoster *call);
bool GetPosterThumb(ScraperGetPosterThumb *call);
};
#endif //__SCRAPMANAGER_H