blob: f4e8f5a62968e0ad40f43a2d5d4a378f0e584bad (
plain)
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
|
#ifndef __TVSCRAPER_MOVIEDBMANAGER_H
#define __TVSCRAPER_MOVIEDBMANAGER_H
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include "lib/common.h"
#include "lib/db.h"
#include "lib/epgservice.h"
#include "tools/stringhelpers.h"
#include "scraper/themoviedbscraper/themoviedbscraper.h"
#include "scraper/themoviedbscraper/moviedbmovie.h"
#include "scraper/themoviedbscraper/moviedbactor.h"
#include "epgdconfig.h"
struct sMovieResult {
tEventId eventId;
string title;
string year;
int lastScraped;
};
// --- cMovieDBManager -------------------------------------------------------------
class cMovieDBManager {
private:
int bytesDownloaded;
int withutf8;
string language;
map<string, int> alreadyScraped;
cMovieDBScraper *movieDbScraper;
cDbConnection *connection;
cDbTable *tMovies;
cDbTable *tMoviesActor;
cDbTable *tMoviesActors;
cDbTable *tMovieMedia;
cDbTable *tEvents;
// cDbTable *tRecordings;
cDbTable *tRecordingList;
enum mediaType {
mtPoster,
mtFanart,
mtCollectionPoster,
mtCollectionFanart,
mtActorThumb
};
int LoadMovieFromDB(string title);
void UpdateEvent(tEventId eventID, int movieID);
void SaveMovie(cMovieDbMovie *movie);
void SaveMovieBasics(cMovieDbMovie *movie);
void SaveMovieMedia(cMovieDbMovie *movie);
void SaveMovieActors(cMovieDbMovie *movie);
bool LoadMedia(int movieId, int actorId, int mediaType);
int GetPicture(const char* url, MemoryStruct* data);
void DeleteMovie(int movieId);
cMovieDbMovie *SearchRecordingSophisticated(string name);
public:
cMovieDBManager(void);
virtual ~cMovieDBManager(void);
int ConnectDatabase(cDbConnection *conn);
bool ConnectScraper(void);
void ResetBytesDownloaded(void) { bytesDownloaded = 0; };
int GetBytesDownloaded(void) { return bytesDownloaded; };
bool GetMoviesFromEPG(vector<sMovieResult> *result);
void ProcessMovie(sMovieResult mov);
bool SearchRecordingDB(string name, int &movieId);
bool SearchRecordingOnline(string name, int &movieId);
bool CheckScrapInfoDB(int scrapMovieId);
bool CheckScrapInfoOnline(int scrapMovieId);
int CleanupMovies(void);
};
#endif //__TVSCRAPER_MOVIEDBMANAGER_H
|