-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtvdbseries.h
179 lines (167 loc) · 5.79 KB
/
tvdbseries.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#pragma once
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include "services.h"
using namespace std;
enum mediaSeries // the old types
{
msBanner1,
msBanner2,
msBanner3,
msPoster1,
msPoster2,
msPoster3,
msSeasonPoster, // 6
msFanart1,
msFanart2,
msFanart3,
msEpisodePic, // 10
msActorThumb,
msPosterThumb, // ??
msSeasonPosterThumb, // ??
};
enum ArtworkType // the new types
{
atBanner = 1,
atPoster = 2,
atBackground = 3,
atIcon = 5,
atSeasonPoster = 7,
atEpisode = 12,
atActor = 13,
atCinemagraph = 20,
atClearArt = 22,
atClearLogo = 23
};
// --- cTVDBMedia -------------------------------------------------------------
class cTVDBMedia {
public:
cTVDBMedia(void) {};
~cTVDBMedia(void) {};
string path;
int mediaType {msBanner1};
int lfn {0};
int width {0};
int height {0};
bool needrefresh {false}; // if is true we need to load new image data from server for this image
bool mediavalid {false}; // if is true there should be a file available for this media
};
// --- cTVDBEpisode -------------------------------------------------------------
class cTVDBEpisode {
public:
cTVDBEpisode(void) {
id = 0;
number = 0;
season = 0;
name = "";
firstAired = "";
guestStars = "";
overview = "";
rating = 0.0;
episodeImage = NULL;
lastupdate = 0;
};
~cTVDBEpisode(void) {
if (episodeImage)
delete episodeImage;
};
int id;
int number;
int season;
string name;
string firstAired;
string guestStars;
string overview;
float rating;
long lastupdate; // Time when episode get updated on thetvdb-server
cTVDBMedia *episodeImage;
};
// --- cTVDBActor -------------------------------------------------------------
class cTVDBActor {
public:
cTVDBActor(void) {
id = 0;
name = "";
role = "";
thumbWidth = 0;
thumbHeight = 0;
actorThumb = NULL;
};
~cTVDBActor(void) {
if (actorThumb)
delete actorThumb;
};
int id;
string name;
string role;
int thumbWidth;
int thumbHeight;
cTVDBMedia *actorThumb;
};
// --- cTVDBSeries -------------------------------------------------------------
class cTVDBSeries {
private:
map<int, cTVDBEpisode*> episodes;
map<int, cTVDBActor*> actors;
vector<cTVDBMedia*> posters;
vector<cTVDBMedia*> banners;
vector<cTVDBMedia*> fanart;
map<int, cTVDBMedia*> seasonPosters;
map<int, cTVDBMedia*> seasonPosterThumbs;
cTVDBMedia *posterThumb;
map<int, cTVDBEpisode*>::iterator episodesIterator;
map<int, cTVDBActor*>::iterator actorsIterator;
map<int, cTVDBMedia*>::iterator seasonPostersIterator;
public:
cTVDBSeries(void);
int id;
virtual ~cTVDBSeries(void);
string name;
string overview;
string firstAired;
string network;
string genre;
float rating;
string status;
long lastupdate; // Time when series/episodes get updated on thetvdb-server (refresh series data and images)
long lastepisodeupdate; // Time when newest event/recording of this series get updated on thetvdb-server (refresh episodes and episode images)
long lastscraped; // Time when newest event/recording of one of the episodes of this series get scraped from epgd (check for new episodes)
bool updatecontent; // True if content should be updated/loaded (true after lastupdate changed)
bool updateimages; // True if there are images inside this series which need to get downloaded
void InsertEpisode(cTVDBEpisode *episode);
cTVDBEpisode *GetEpisode(int episodeId);
void InsertEpisodeImage(int episodeId, int width, int height, string path);
void SetEpisodeImage(int episodeId, int imgWidth, int imgHeight, string path, bool needrefresh); // insert/update episode image
int GetEpisodeFirst(cTVDBEpisode* &episode); // get first episode (also init episode iterator)
int GetEpisodeNext(cTVDBEpisode* &episode); // get next episode from iterator
void InsertActor(cTVDBActor *actor);
cTVDBActor *GetActor(int actorId); // try to find actor with given ID
void SetActorThumb(int actorId, int imgWidth, int imgHeight, string path);
void SetActorThumb(int actorId, int imgWidth, int imgHeight, string path, bool needrefresh); // insert/update actor thumb
int GetActorFirst(cTVDBActor* &actor); // get first actor (also init actor iterator)
int GetActorNext(cTVDBActor* &actor); // get next actor from iterator
void InsertMedia(int mediaType, int lfn, int imgWidth, int imgHeight, string path, int season = 0);
void InsertMedia(int mediaType, int lfn, int imgWidth, int imgHeight, string path, int season, bool needrefresh); // insert media object
cTVDBMedia *GetMedia(int mediaType, int lfn, int season); // try to find media of given type
int GetSeasonPosterFirst(int &season, cTVDBMedia* &media); // get first season poster (also init season poster iterator)
int GetSeasonPosterNext(int &season, cTVDBMedia* &media); // get season poster from iterator
void DeleteSeasonPoster(int season); // delete season poster and thumb
//Getter for Serivice Calls
void GetEpisode(int episodeId, cEpisode *e);
void GetPosters(vector<cTvMedia> *p);
bool GetPoster(cTvMedia *p);
bool GetPosterThumb(cTvMedia *p);
void GetBanners(vector<cTvMedia> *b);
bool GetRandomBanner(cTvMedia *b);
void GetFanart(vector<cTvMedia> *f);
void GetSeasonPoster(int episodeId, cTvMedia *sp);
void GetActors(vector<cActor> *a);
void Dump(void);
static int toOldMediaType(int mediaType, uint lfn);
static int toNewMediaType(int mediaType, uint& lfn);
};