[Windows] Remove redundant DirectSound error codes
[xbmc.git] / xbmc / video / VideoDatabase.h
blob2c8ea6357de4fc99d98fdef9d6ddcaac36539937
1 /*
2 * Copyright (C) 2016-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "Bookmark.h"
12 #include "VideoInfoTag.h"
13 #include "addons/Scraper.h"
14 #include "dbwrappers/Database.h"
15 #include "utils/SortUtils.h"
16 #include "utils/UrlOptions.h"
18 #include <memory>
19 #include <set>
20 #include <utility>
21 #include <vector>
23 class CFileItem;
24 class CFileItemList;
25 class CVideoSettings;
26 class CGUIDialogProgress;
27 class CGUIDialogProgressBarHandle;
28 class TiXmlNode;
30 struct VideoAssetInfo;
32 enum class VideoAssetTypeOwner;
33 enum class VideoAssetType;
35 namespace dbiplus
37 class field_value;
38 typedef std::vector<field_value> sql_record;
41 #ifndef my_offsetof
42 #ifndef TARGET_POSIX
43 #define my_offsetof(TYPE, MEMBER) offsetof(TYPE, MEMBER)
44 #else
46 Custom version of standard offsetof() macro which can be used to get
47 offsets of members in class for non-POD types (according to the current
48 version of C++ standard offsetof() macro can't be used in such cases and
49 attempt to do so causes warnings to be emitted, OTOH in many cases it is
50 still OK to assume that all instances of the class has the same offsets
51 for the same members).
53 #define my_offsetof(TYPE, MEMBER) \
54 ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10))
55 #endif
56 #endif
58 typedef std::vector<CVideoInfoTag> VECMOVIES;
60 namespace KODI::VIDEO
62 class IVideoInfoScannerObserver;
63 struct SScanSettings;
66 enum VideoDbDetails
68 VideoDbDetailsNone = 0x00,
69 VideoDbDetailsRating = 0x01,
70 VideoDbDetailsTag = 0x02,
71 VideoDbDetailsShowLink = 0x04,
72 VideoDbDetailsStream = 0x08,
73 VideoDbDetailsCast = 0x10,
74 VideoDbDetailsBookmark = 0x20,
75 VideoDbDetailsUniqueID = 0x40,
76 VideoDbDetailsAll = 0xFF
77 } ;
79 // these defines are based on how many columns we have and which column certain data is going to be in
80 // when we do GetDetailsForMovie()
81 #define VIDEODB_MAX_COLUMNS 24
82 #define VIDEODB_DETAILS_FILEID 1
84 #define VIDEODB_DETAILS_MOVIE_SET_ID VIDEODB_MAX_COLUMNS + 2
85 #define VIDEODB_DETAILS_MOVIE_USER_RATING VIDEODB_MAX_COLUMNS + 3
86 #define VIDEODB_DETAILS_MOVIE_PREMIERED VIDEODB_MAX_COLUMNS + 4
87 #define VIDEODB_DETAILS_MOVIE_SET_NAME VIDEODB_MAX_COLUMNS + 5
88 #define VIDEODB_DETAILS_MOVIE_SET_OVERVIEW VIDEODB_MAX_COLUMNS + 6
89 #define VIDEODB_DETAILS_MOVIE_FILE VIDEODB_MAX_COLUMNS + 7
90 #define VIDEODB_DETAILS_MOVIE_PATH VIDEODB_MAX_COLUMNS + 8
91 #define VIDEODB_DETAILS_MOVIE_PLAYCOUNT VIDEODB_MAX_COLUMNS + 9
92 #define VIDEODB_DETAILS_MOVIE_LASTPLAYED VIDEODB_MAX_COLUMNS + 10
93 #define VIDEODB_DETAILS_MOVIE_DATEADDED VIDEODB_MAX_COLUMNS + 11
94 #define VIDEODB_DETAILS_MOVIE_RESUME_TIME VIDEODB_MAX_COLUMNS + 12
95 #define VIDEODB_DETAILS_MOVIE_TOTAL_TIME VIDEODB_MAX_COLUMNS + 13
96 #define VIDEODB_DETAILS_MOVIE_PLAYER_STATE VIDEODB_MAX_COLUMNS + 14
97 #define VIDEODB_DETAILS_MOVIE_RATING VIDEODB_MAX_COLUMNS + 15
98 #define VIDEODB_DETAILS_MOVIE_VOTES VIDEODB_MAX_COLUMNS + 16
99 #define VIDEODB_DETAILS_MOVIE_RATING_TYPE VIDEODB_MAX_COLUMNS + 17
100 #define VIDEODB_DETAILS_MOVIE_UNIQUEID_VALUE VIDEODB_MAX_COLUMNS + 18
101 #define VIDEODB_DETAILS_MOVIE_UNIQUEID_TYPE VIDEODB_MAX_COLUMNS + 19
102 #define VIDEODB_DETAILS_MOVIE_HASVERSIONS VIDEODB_MAX_COLUMNS + 20
103 #define VIDEODB_DETAILS_MOVIE_HASEXTRAS VIDEODB_MAX_COLUMNS + 21
104 #define VIDEODB_DETAILS_MOVIE_ISDEFAULTVERSION VIDEODB_MAX_COLUMNS + 22
105 #define VIDEODB_DETAILS_MOVIE_VERSION_FILEID VIDEODB_MAX_COLUMNS + 23
106 #define VIDEODB_DETAILS_MOVIE_VERSION_TYPEID VIDEODB_MAX_COLUMNS + 24
107 #define VIDEODB_DETAILS_MOVIE_VERSION_TYPENAME VIDEODB_MAX_COLUMNS + 25
108 #define VIDEODB_DETAILS_MOVIE_VERSION_ITEMTYPE VIDEODB_MAX_COLUMNS + 26
110 #define VIDEODB_DETAILS_EPISODE_TVSHOW_ID VIDEODB_MAX_COLUMNS + 2
111 #define VIDEODB_DETAILS_EPISODE_USER_RATING VIDEODB_MAX_COLUMNS + 3
112 #define VIDEODB_DETAILS_EPISODE_SEASON_ID VIDEODB_MAX_COLUMNS + 4
113 #define VIDEODB_DETAILS_EPISODE_FILE VIDEODB_MAX_COLUMNS + 5
114 #define VIDEODB_DETAILS_EPISODE_PATH VIDEODB_MAX_COLUMNS + 6
115 #define VIDEODB_DETAILS_EPISODE_PLAYCOUNT VIDEODB_MAX_COLUMNS + 7
116 #define VIDEODB_DETAILS_EPISODE_LASTPLAYED VIDEODB_MAX_COLUMNS + 8
117 #define VIDEODB_DETAILS_EPISODE_DATEADDED VIDEODB_MAX_COLUMNS + 9
118 #define VIDEODB_DETAILS_EPISODE_TVSHOW_NAME VIDEODB_MAX_COLUMNS + 10
119 #define VIDEODB_DETAILS_EPISODE_TVSHOW_GENRE VIDEODB_MAX_COLUMNS + 11
120 #define VIDEODB_DETAILS_EPISODE_TVSHOW_STUDIO VIDEODB_MAX_COLUMNS + 12
121 #define VIDEODB_DETAILS_EPISODE_TVSHOW_AIRED VIDEODB_MAX_COLUMNS + 13
122 #define VIDEODB_DETAILS_EPISODE_TVSHOW_MPAA VIDEODB_MAX_COLUMNS + 14
123 #define VIDEODB_DETAILS_EPISODE_RESUME_TIME VIDEODB_MAX_COLUMNS + 15
124 #define VIDEODB_DETAILS_EPISODE_TOTAL_TIME VIDEODB_MAX_COLUMNS + 16
125 #define VIDEODB_DETAILS_EPISODE_PLAYER_STATE VIDEODB_MAX_COLUMNS + 17
126 #define VIDEODB_DETAILS_EPISODE_RATING VIDEODB_MAX_COLUMNS + 18
127 #define VIDEODB_DETAILS_EPISODE_VOTES VIDEODB_MAX_COLUMNS + 19
128 #define VIDEODB_DETAILS_EPISODE_RATING_TYPE VIDEODB_MAX_COLUMNS + 20
129 #define VIDEODB_DETAILS_EPISODE_UNIQUEID_VALUE VIDEODB_MAX_COLUMNS + 21
130 #define VIDEODB_DETAILS_EPISODE_UNIQUEID_TYPE VIDEODB_MAX_COLUMNS + 22
132 #define VIDEODB_DETAILS_TVSHOW_USER_RATING VIDEODB_MAX_COLUMNS + 1
133 #define VIDEODB_DETAILS_TVSHOW_DURATION VIDEODB_MAX_COLUMNS + 2
134 #define VIDEODB_DETAILS_TVSHOW_PARENTPATHID VIDEODB_MAX_COLUMNS + 3
135 #define VIDEODB_DETAILS_TVSHOW_PATH VIDEODB_MAX_COLUMNS + 4
136 #define VIDEODB_DETAILS_TVSHOW_DATEADDED VIDEODB_MAX_COLUMNS + 5
137 #define VIDEODB_DETAILS_TVSHOW_LASTPLAYED VIDEODB_MAX_COLUMNS + 6
138 #define VIDEODB_DETAILS_TVSHOW_NUM_EPISODES VIDEODB_MAX_COLUMNS + 7
139 #define VIDEODB_DETAILS_TVSHOW_NUM_WATCHED VIDEODB_MAX_COLUMNS + 8
140 #define VIDEODB_DETAILS_TVSHOW_NUM_SEASONS VIDEODB_MAX_COLUMNS + 9
141 #define VIDEODB_DETAILS_TVSHOW_RATING VIDEODB_MAX_COLUMNS + 10
142 #define VIDEODB_DETAILS_TVSHOW_VOTES VIDEODB_MAX_COLUMNS + 11
143 #define VIDEODB_DETAILS_TVSHOW_RATING_TYPE VIDEODB_MAX_COLUMNS + 12
144 #define VIDEODB_DETAILS_TVSHOW_UNIQUEID_VALUE VIDEODB_MAX_COLUMNS + 13
145 #define VIDEODB_DETAILS_TVSHOW_UNIQUEID_TYPE VIDEODB_MAX_COLUMNS + 14
146 #define VIDEODB_DETAILS_TVSHOW_NUM_INPROGRESS VIDEODB_MAX_COLUMNS + 15
148 #define VIDEODB_DETAILS_MUSICVIDEO_USER_RATING VIDEODB_MAX_COLUMNS + 2
149 #define VIDEODB_DETAILS_MUSICVIDEO_PREMIERED VIDEODB_MAX_COLUMNS + 3
150 #define VIDEODB_DETAILS_MUSICVIDEO_FILE VIDEODB_MAX_COLUMNS + 4
151 #define VIDEODB_DETAILS_MUSICVIDEO_PATH VIDEODB_MAX_COLUMNS + 5
152 #define VIDEODB_DETAILS_MUSICVIDEO_PLAYCOUNT VIDEODB_MAX_COLUMNS + 6
153 #define VIDEODB_DETAILS_MUSICVIDEO_LASTPLAYED VIDEODB_MAX_COLUMNS + 7
154 #define VIDEODB_DETAILS_MUSICVIDEO_DATEADDED VIDEODB_MAX_COLUMNS + 8
155 #define VIDEODB_DETAILS_MUSICVIDEO_RESUME_TIME VIDEODB_MAX_COLUMNS + 9
156 #define VIDEODB_DETAILS_MUSICVIDEO_TOTAL_TIME VIDEODB_MAX_COLUMNS + 10
157 #define VIDEODB_DETAILS_MUSICVIDEO_PLAYER_STATE VIDEODB_MAX_COLUMNS + 11
158 #define VIDEODB_DETAILS_MUSICVIDEO_UNIQUEID_VALUE VIDEODB_MAX_COLUMNS + 12
159 #define VIDEODB_DETAILS_MUSICVIDEO_UNIQUEID_TYPE VIDEODB_MAX_COLUMNS + 13
161 #define VIDEODB_TYPE_UNUSED 0
162 #define VIDEODB_TYPE_STRING 1
163 #define VIDEODB_TYPE_INT 2
164 #define VIDEODB_TYPE_FLOAT 3
165 #define VIDEODB_TYPE_BOOL 4
166 #define VIDEODB_TYPE_COUNT 5
167 #define VIDEODB_TYPE_STRINGARRAY 6
168 #define VIDEODB_TYPE_DATE 7
169 #define VIDEODB_TYPE_DATETIME 8
171 enum class VideoDbContentType
173 UNKNOWN = -1,
174 MOVIES = 1,
175 TVSHOWS = 2,
176 MUSICVIDEOS = 3,
177 EPISODES = 4,
178 MOVIE_SETS = 5,
179 MUSICALBUMS = 6
182 typedef enum // this enum MUST match the offset struct further down!! and make sure to keep min and max at -1 and sizeof(offsets)
184 VIDEODB_ID_MIN = -1,
185 VIDEODB_ID_TITLE = 0,
186 VIDEODB_ID_PLOT = 1,
187 VIDEODB_ID_PLOTOUTLINE = 2,
188 VIDEODB_ID_TAGLINE = 3,
189 VIDEODB_ID_VOTES = 4, // unused
190 VIDEODB_ID_RATING_ID = 5,
191 VIDEODB_ID_CREDITS = 6,
192 VIDEODB_ID_YEAR = 7, // unused
193 VIDEODB_ID_THUMBURL = 8,
194 VIDEODB_ID_IDENT_ID = 9,
195 VIDEODB_ID_SORTTITLE = 10,
196 VIDEODB_ID_RUNTIME = 11,
197 VIDEODB_ID_MPAA = 12,
198 VIDEODB_ID_TOP250 = 13,
199 VIDEODB_ID_GENRE = 14,
200 VIDEODB_ID_DIRECTOR = 15,
201 VIDEODB_ID_ORIGINALTITLE = 16,
202 VIDEODB_ID_THUMBURL_SPOOF = 17,
203 VIDEODB_ID_STUDIOS = 18,
204 VIDEODB_ID_TRAILER = 19,
205 VIDEODB_ID_FANART = 20,
206 VIDEODB_ID_COUNTRY = 21,
207 VIDEODB_ID_BASEPATH = 22,
208 VIDEODB_ID_PARENTPATHID = 23,
209 VIDEODB_ID_MAX
210 } VIDEODB_IDS;
212 const struct SDbTableOffsets
214 int type;
215 size_t offset;
216 } DbMovieOffsets[] =
218 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strTitle) },
219 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strPlot) },
220 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strPlotOutline) },
221 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strTagLine) },
222 { VIDEODB_TYPE_UNUSED, 0 }, // unused
223 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iIdRating) },
224 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_writingCredits) },
225 { VIDEODB_TYPE_UNUSED, 0 }, // unused
226 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strPictureURL.m_data) },
227 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iIdUniqueID) },
228 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strSortTitle) },
229 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_duration) },
230 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strMPAARating) },
231 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iTop250) },
232 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_genre) },
233 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_director) },
234 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strOriginalTitle) },
235 { VIDEODB_TYPE_UNUSED, 0 }, // unused
236 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_studio) },
237 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strTrailer) },
238 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_fanart.m_xml) },
239 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_country) },
240 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_basePath) },
241 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_parentPathID) }
244 typedef enum // this enum MUST match the offset struct further down!! and make sure to keep min and max at -1 and sizeof(offsets)
246 VIDEODB_ID_TV_MIN = -1,
247 VIDEODB_ID_TV_TITLE = 0,
248 VIDEODB_ID_TV_PLOT = 1,
249 VIDEODB_ID_TV_STATUS = 2,
250 VIDEODB_ID_TV_VOTES = 3, // unused
251 VIDEODB_ID_TV_RATING_ID = 4,
252 VIDEODB_ID_TV_PREMIERED = 5,
253 VIDEODB_ID_TV_THUMBURL = 6,
254 VIDEODB_ID_TV_THUMBURL_SPOOF = 7,
255 VIDEODB_ID_TV_GENRE = 8,
256 VIDEODB_ID_TV_ORIGINALTITLE = 9,
257 VIDEODB_ID_TV_EPISODEGUIDE = 10,
258 VIDEODB_ID_TV_FANART = 11,
259 VIDEODB_ID_TV_IDENT_ID = 12,
260 VIDEODB_ID_TV_MPAA = 13,
261 VIDEODB_ID_TV_STUDIOS = 14,
262 VIDEODB_ID_TV_SORTTITLE = 15,
263 VIDEODB_ID_TV_TRAILER = 16,
264 VIDEODB_ID_TV_MAX
265 } VIDEODB_TV_IDS;
267 const struct SDbTableOffsets DbTvShowOffsets[] =
269 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strTitle) },
270 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strPlot) },
271 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strStatus) },
272 { VIDEODB_TYPE_UNUSED, 0 }, //unused
273 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iIdRating) },
274 { VIDEODB_TYPE_DATE, my_offsetof(CVideoInfoTag,m_premiered) },
275 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strPictureURL.m_data) },
276 { VIDEODB_TYPE_UNUSED, 0 }, // unused
277 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_genre) },
278 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strOriginalTitle)},
279 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strEpisodeGuide)},
280 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_fanart.m_xml)},
281 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iIdUniqueID)},
282 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strMPAARating)},
283 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_studio)},
284 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strSortTitle)},
285 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strTrailer)}
288 //! @todo is this comment valid for seasons? There is no offset structure or am I wrong?
289 typedef enum // this enum MUST match the offset struct further down!! and make sure to keep min and max at -1 and sizeof(offsets)
291 VIDEODB_ID_SEASON_MIN = -1,
292 VIDEODB_ID_SEASON_ID = 0,
293 VIDEODB_ID_SEASON_TVSHOW_ID = 1,
294 VIDEODB_ID_SEASON_NUMBER = 2,
295 VIDEODB_ID_SEASON_NAME = 3,
296 VIDEODB_ID_SEASON_USER_RATING = 4,
297 VIDEODB_ID_SEASON_TVSHOW_PATH = 5,
298 VIDEODB_ID_SEASON_TVSHOW_TITLE = 6,
299 VIDEODB_ID_SEASON_TVSHOW_PLOT = 7,
300 VIDEODB_ID_SEASON_TVSHOW_PREMIERED = 8,
301 VIDEODB_ID_SEASON_TVSHOW_GENRE = 9,
302 VIDEODB_ID_SEASON_TVSHOW_STUDIO = 10,
303 VIDEODB_ID_SEASON_TVSHOW_MPAA = 11,
304 VIDEODB_ID_SEASON_EPISODES_TOTAL = 12,
305 VIDEODB_ID_SEASON_EPISODES_WATCHED = 13,
306 VIDEODB_ID_SEASON_PREMIERED = 14,
307 VIDEODB_ID_SEASON_EPISODES_INPROGRESS = 15,
308 VIDEODB_ID_SEASON_MAX
309 } VIDEODB_SEASON_IDS;
311 typedef enum // this enum MUST match the offset struct further down!! and make sure to keep min and max at -1 and sizeof(offsets)
313 VIDEODB_ID_EPISODE_MIN = -1,
314 VIDEODB_ID_EPISODE_TITLE = 0,
315 VIDEODB_ID_EPISODE_PLOT = 1,
316 VIDEODB_ID_EPISODE_VOTES = 2, // unused
317 VIDEODB_ID_EPISODE_RATING_ID = 3,
318 VIDEODB_ID_EPISODE_CREDITS = 4,
319 VIDEODB_ID_EPISODE_AIRED = 5,
320 VIDEODB_ID_EPISODE_THUMBURL = 6,
321 VIDEODB_ID_EPISODE_THUMBURL_SPOOF = 7,
322 VIDEODB_ID_EPISODE_PLAYCOUNT = 8, // unused - feel free to repurpose
323 VIDEODB_ID_EPISODE_RUNTIME = 9,
324 VIDEODB_ID_EPISODE_DIRECTOR = 10,
325 VIDEODB_ID_EPISODE_PRODUCTIONCODE = 11,
326 VIDEODB_ID_EPISODE_SEASON = 12,
327 VIDEODB_ID_EPISODE_EPISODE = 13,
328 VIDEODB_ID_EPISODE_ORIGINALTITLE = 14,
329 VIDEODB_ID_EPISODE_SORTSEASON = 15,
330 VIDEODB_ID_EPISODE_SORTEPISODE = 16,
331 VIDEODB_ID_EPISODE_BOOKMARK = 17,
332 VIDEODB_ID_EPISODE_BASEPATH = 18,
333 VIDEODB_ID_EPISODE_PARENTPATHID = 19,
334 VIDEODB_ID_EPISODE_IDENT_ID = 20,
335 VIDEODB_ID_EPISODE_MAX
336 } VIDEODB_EPISODE_IDS;
338 const struct SDbTableOffsets DbEpisodeOffsets[] =
340 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strTitle) },
341 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strPlot) },
342 { VIDEODB_TYPE_UNUSED, 0 }, // unused
343 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iIdRating) },
344 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_writingCredits) },
345 { VIDEODB_TYPE_DATE, my_offsetof(CVideoInfoTag,m_firstAired) },
346 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strPictureURL.m_data) },
347 { VIDEODB_TYPE_UNUSED, 0 }, // unused
348 { VIDEODB_TYPE_UNUSED, 0 }, // unused
349 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_duration) },
350 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_director) },
351 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strProductionCode) },
352 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iSeason) },
353 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iEpisode) },
354 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strOriginalTitle)},
355 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iSpecialSortSeason) },
356 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iSpecialSortEpisode) },
357 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iBookmarkId) },
358 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_basePath) },
359 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_parentPathID) },
360 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iIdUniqueID) }
363 typedef enum // this enum MUST match the offset struct further down!! and make sure to keep min and max at -1 and sizeof(offsets)
365 VIDEODB_ID_MUSICVIDEO_MIN = -1,
366 VIDEODB_ID_MUSICVIDEO_TITLE = 0,
367 VIDEODB_ID_MUSICVIDEO_THUMBURL = 1,
368 VIDEODB_ID_MUSICVIDEO_THUMBURL_SPOOF = 2,
369 VIDEODB_ID_MUSICVIDEO_PLAYCOUNT = 3, // unused - feel free to repurpose
370 VIDEODB_ID_MUSICVIDEO_RUNTIME = 4,
371 VIDEODB_ID_MUSICVIDEO_DIRECTOR = 5,
372 VIDEODB_ID_MUSICVIDEO_STUDIOS = 6,
373 VIDEODB_ID_MUSICVIDEO_YEAR = 7, // unused
374 VIDEODB_ID_MUSICVIDEO_PLOT = 8,
375 VIDEODB_ID_MUSICVIDEO_ALBUM = 9,
376 VIDEODB_ID_MUSICVIDEO_ARTIST = 10,
377 VIDEODB_ID_MUSICVIDEO_GENRE = 11,
378 VIDEODB_ID_MUSICVIDEO_TRACK = 12,
379 VIDEODB_ID_MUSICVIDEO_BASEPATH = 13,
380 VIDEODB_ID_MUSICVIDEO_PARENTPATHID = 14,
381 VIDEODB_ID_MUSICVIDEO_IDENT_ID = 15,
382 VIDEODB_ID_MUSICVIDEO_MAX
383 } VIDEODB_MUSICVIDEO_IDS;
385 const struct SDbTableOffsets DbMusicVideoOffsets[] =
387 { VIDEODB_TYPE_STRING, my_offsetof(class CVideoInfoTag,m_strTitle) },
388 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strPictureURL.m_data) },
389 { VIDEODB_TYPE_UNUSED, 0 }, // unused
390 { VIDEODB_TYPE_UNUSED, 0 }, // unused
391 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_duration) },
392 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_director) },
393 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_studio) },
394 { VIDEODB_TYPE_UNUSED, 0 }, // unused
395 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strPlot) },
396 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_strAlbum) },
397 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_artist) },
398 { VIDEODB_TYPE_STRINGARRAY, my_offsetof(CVideoInfoTag,m_genre) },
399 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iTrack) },
400 { VIDEODB_TYPE_STRING, my_offsetof(CVideoInfoTag,m_basePath) },
401 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_parentPathID) },
402 { VIDEODB_TYPE_INT, my_offsetof(CVideoInfoTag,m_iIdUniqueID)}
405 enum class ArtFallbackOptions
407 NONE,
408 PARENT
411 enum class DeleteMovieCascadeAction
413 DEFAULT_VERSION,
414 ALL_ASSETS
417 enum class DeleteMovieHashAction
419 HASH_DELETE,
420 HASH_PRESERVE
423 #define COMPARE_PERCENTAGE 0.90f // 90%
424 #define COMPARE_PERCENTAGE_MIN 0.50f // 50%
426 class CVideoDatabase : public CDatabase
428 public:
430 class CActor // used for actor retrieval for non-master users
432 public:
433 std::string name;
434 std::string thumb;
435 int playcount;
436 int appearances;
439 class CSeason // used for season retrieval for non-master users
441 public:
442 std::string path;
443 std::vector<std::string> genre;
444 int numEpisodes;
445 int numWatched;
446 int id;
449 class CSetInfo
451 public:
452 std::string name;
453 VECMOVIES movies;
454 DatabaseResults results;
457 CVideoDatabase(void);
458 ~CVideoDatabase(void) override;
460 bool Open() override;
461 bool CommitTransaction() override;
463 int AddNewEpisode(int idShow, CVideoInfoTag& details);
465 // editing functions
466 /*! \brief Set the playcount of an item, update last played time
467 Sets the playcount and last played date to a given value
468 \param item CFileItem to set the playcount for
469 \param count The playcount to set.
470 \param date The date the file was last viewed (does not denote the video was watched to completion).
471 If empty we use current datetime (if count > 0) or never viewed (if count = 0).
472 \return on success, the new last played time set, invalid datetime otherwise.
473 \sa GetPlayCount, IncrementPlayCount, UpdateLastPlayed
475 CDateTime SetPlayCount(const CFileItem& item, int count, const CDateTime& date = CDateTime());
477 /*! \brief Increment the playcount of an item
478 Increments the playcount and updates the last played date
479 \param item CFileItem to increment the playcount for
480 \return on success, the new last played time set, invalid datetime otherwise.
481 \sa GetPlayCount, SetPlayCount, GetPlayCounts
483 CDateTime IncrementPlayCount(const CFileItem& item);
485 /*! \brief Get the playcount of an item
486 \param item CFileItem to get the playcount for
487 \return the playcount of the item, or -1 on error
488 \sa SetPlayCount, IncrementPlayCount, GetPlayCounts
490 int GetPlayCount(const CFileItem &item);
492 /*! \brief Get the playcount of a filename and path
493 \param strFilenameAndPath filename and path to get the playcount for
494 \return the playcount of the item, or -1 on error
495 \sa SetPlayCount, IncrementPlayCount, GetPlayCounts
497 int GetPlayCount(const std::string& strFilenameAndPath);
499 /*! \brief Get the last played time of a filename and path
500 \param strFilenameAndPath filename and path to get the last played time for
501 \return the last played time of the item, or an invalid CDateTime on error
502 \sa UpdateLastPlayed
504 CDateTime GetLastPlayed(const std::string& strFilenameAndPath);
506 /*! \brief Update the last played time of an item
507 Updates the last played date
508 \param item CFileItem to update the last played time for
509 \return on success, the last played time set, invalid datetime otherwise.
510 \sa GetPlayCount, SetPlayCount, IncrementPlayCount, GetPlayCounts
512 CDateTime UpdateLastPlayed(const CFileItem& item);
514 /*! \brief Get the playcount and resume point of a list of items
515 Note that if the resume point is already set on an item, it won't be overridden.
516 \param path the path to fetch videos from
517 \param items CFileItemList to fetch the playcounts for
518 \sa GetPlayCount, SetPlayCount, IncrementPlayCount
520 bool GetPlayCounts(const std::string &path, CFileItemList &items);
522 void UpdateMovieTitle(int idMovie,
523 const std::string& strNewMovieTitle,
524 VideoDbContentType iType = VideoDbContentType::MOVIES);
525 bool UpdateVideoSortTitle(int idDb,
526 const std::string& strNewSortTitle,
527 VideoDbContentType iType = VideoDbContentType::MOVIES);
529 bool HasMovieInfo(const std::string& strFilenameAndPath);
530 bool HasTvShowInfo(const std::string& strFilenameAndPath);
531 bool HasEpisodeInfo(const std::string& strFilenameAndPath);
532 bool HasMusicVideoInfo(const std::string& strFilenameAndPath);
534 void GetFilePathById(int idMovie, std::string& filePath, VideoDbContentType iType);
535 std::string GetGenreById(int id);
536 std::string GetCountryById(int id);
537 std::string GetSetById(int id);
538 std::string GetTagById(int id);
539 std::string GetPersonById(int id);
540 std::string GetStudioById(int id);
541 std::string GetTvShowTitleById(int id);
542 std::string GetMusicVideoAlbumById(int id);
543 int GetTvShowForEpisode(int idEpisode);
544 int GetSeasonForEpisode(int idEpisode);
546 bool LoadVideoInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int getDetails = VideoDbDetailsAll);
547 bool GetMovieInfo(const std::string& strFilenameAndPath,
548 CVideoInfoTag& details,
549 int idMovie = -1,
550 int idVersion = -1,
551 int getDetails = VideoDbDetailsAll);
552 bool GetTvShowInfo(const std::string& strPath, CVideoInfoTag& details, int idTvShow = -1, CFileItem* item = NULL, int getDetails = VideoDbDetailsAll);
553 bool GetSeasonInfo(const std::string& path, int season, CVideoInfoTag& details, CFileItem* item);
554 bool GetSeasonInfo(int idSeason, CVideoInfoTag& details, CFileItem* item);
555 bool GetSeasonInfo(int idSeason, CVideoInfoTag& details, bool allDetails = true);
556 bool GetEpisodeBasicInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idEpisode = -1);
557 bool GetEpisodeInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idEpisode = -1, int getDetails = VideoDbDetailsAll);
558 bool GetMusicVideoInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idMVideo = -1, int getDetails = VideoDbDetailsAll);
559 bool GetSetInfo(int idSet, CVideoInfoTag& details, CFileItem* item = nullptr);
560 bool GetFileInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idFile = -1);
562 int GetPathId(const std::string& strPath);
563 int GetTvShowId(const std::string& strPath);
564 int GetEpisodeId(const std::string& strFilenameAndPath, int idEpisode=-1, int idSeason=-1); // idEpisode, idSeason are used for multipart episodes as hints
565 int GetSeasonId(int idShow, int season);
567 void GetEpisodesByFile(const std::string& strFilenameAndPath, std::vector<CVideoInfoTag>& episodes);
569 int SetDetailsForItem(CVideoInfoTag& details, const std::map<std::string, std::string> &artwork);
570 int SetDetailsForItem(int id, const MediaType& mediaType, CVideoInfoTag& details, const std::map<std::string, std::string> &artwork);
572 int SetDetailsForMovie(CVideoInfoTag& details,
573 const std::map<std::string, std::string>& artwork,
574 int idMovie = -1);
575 int SetDetailsForMovieSet(const CVideoInfoTag& details, const std::map<std::string, std::string> &artwork, int idSet = -1);
577 /*! \brief add a tvshow to the library, setting metadata detail
578 First checks for whether this TV Show is already in the database (based on idTvShow, or via GetMatchingTvShow)
579 and if present adds the paths to the show. If not present, we add a new show and set the show metadata.
580 \param paths a vector<string,string> list of the path(s) and parent path(s) for the show.
581 \param details a CVideoInfoTag filled with the metadata for the show.
582 \param artwork the artwork map for the show.
583 \param seasonArt the artwork map for seasons.
584 \param idTvShow the database id of the tvshow if known (defaults to -1)
585 \return the id of the tvshow.
587 int SetDetailsForTvShow(const std::vector< std::pair<std::string, std::string> > &paths, CVideoInfoTag& details, const std::map<std::string, std::string> &artwork, const std::map<int, std::map<std::string, std::string> > &seasonArt, int idTvShow = -1);
588 bool UpdateDetailsForTvShow(int idTvShow, CVideoInfoTag &details, const std::map<std::string, std::string> &artwork, const std::map<int, std::map<std::string, std::string> > &seasonArt);
589 int SetDetailsForSeason(const CVideoInfoTag& details, const std::map<std::string, std::string> &artwork, int idShow, int idSeason = -1);
590 int SetDetailsForEpisode(CVideoInfoTag& details,
591 const std::map<std::string, std::string>& artwork,
592 int idShow,
593 int idEpisode = -1);
594 bool SetFileForEpisode(const std::string& fileAndPath, int idEpisode, int idFile);
595 bool SetFileForMovie(const std::string& fileAndPath, int idMovie, int idFile);
596 int SetDetailsForMusicVideo(CVideoInfoTag& details,
597 const std::map<std::string, std::string>& artwork,
598 int idMVideo = -1);
599 int SetStreamDetailsForFile(const CStreamDetails& details, const std::string& strFileNameAndPath);
601 * \brief Clear any existing stream details and add the new provided details to a file.
602 * \param[in] details New stream details
603 * \param[in] idFile Identifier of the file
605 void SetStreamDetailsForFileId(const CStreamDetails& details, int idFile);
607 bool SetSingleValue(VideoDbContentType type, int dbId, int dbField, const std::string& strValue);
608 bool SetSingleValue(VideoDbContentType type,
609 int dbId,
610 Field dbField,
611 const std::string& strValue);
612 bool SetSingleValue(const std::string &table, const std::string &fieldName, const std::string &strValue,
613 const std::string &conditionName = "", int conditionValue = -1);
615 int UpdateDetailsForMovie(int idMovie, CVideoInfoTag& details, const std::map<std::string, std::string> &artwork, const std::set<std::string> &updatedDetails);
617 void DeleteMovie(int idMovie,
618 DeleteMovieCascadeAction action = DeleteMovieCascadeAction::ALL_ASSETS,
619 DeleteMovieHashAction hashAction = DeleteMovieHashAction::HASH_DELETE);
620 void DeleteTvShow(int idTvShow, bool bKeepId = false);
621 void DeleteTvShow(const std::string& strPath);
622 void DeleteSeason(int idSeason, bool bKeepId = false);
623 void DeleteEpisode(int idEpisode, bool bKeepId = false);
624 void DeleteMusicVideo(int idMusicVideo, bool bKeepId = false);
625 void DeleteDetailsForTvShow(int idTvShow);
626 void DeleteStreamDetails(int idFile);
627 void RemoveContentForPath(const std::string& strPath,CGUIDialogProgress *progress = NULL);
628 void UpdateFanart(const CFileItem& item, VideoDbContentType type);
629 void DeleteSet(int idSet);
630 void DeleteTag(int idTag, VideoDbContentType mediaType);
632 /*! \brief Get video settings for the specified file id
633 \param idFile file id to get the settings for
634 \return true if video settings found, false otherwise
635 \sa SetVideoSettings
637 bool GetVideoSettings(int idFile, CVideoSettings &settings);
639 /*! \brief Get video settings for the specified file item
640 \param item item to get the settings for
641 \return true if video settings found, false otherwise
642 \sa SetVideoSettings
644 bool GetVideoSettings(const CFileItem &item, CVideoSettings &settings);
646 /*! \brief Get video settings for the specified file path
647 \param filePath filepath to get the settings for
648 \return true if video settings found, false otherwise
649 \sa SetVideoSettings
651 bool GetVideoSettings(const std::string &filePath, CVideoSettings &settings);
653 /*! \brief Set video settings for the specified file path
654 \param fileItem to set the settings for
655 \sa GetVideoSettings
657 void SetVideoSettings(const CFileItem &item, const CVideoSettings &settings);
659 /*! \brief Set video settings for the specified file path
660 \param fileId to set the settings for
661 \sa GetVideoSettings
663 void SetVideoSettings(int idFile, const CVideoSettings &settings);
666 * Erases video settings for file item
667 * @param fileitem
669 void EraseVideoSettings(const CFileItem &item);
672 * Erases all video settings
674 void EraseAllVideoSettings();
677 * Erases video settings for files starting with path
678 * @param path pattern
680 void EraseAllVideoSettings(const std::string& path);
683 * Erases all entries for files starting with path, including the files and path entries
684 * @param path pattern
686 void EraseAllForPath(const std::string& path);
688 bool GetStackTimes(const std::string &filePath, std::vector<uint64_t> &times);
689 void SetStackTimes(const std::string &filePath, const std::vector<uint64_t> &times);
691 void GetBookMarksForFile(const std::string& strFilenameAndPath, VECBOOKMARKS& bookmarks, CBookmark::EType type = CBookmark::STANDARD, bool bAppend=false, long partNumber=0);
692 void AddBookMarkToFile(const std::string& strFilenameAndPath, const CBookmark &bookmark, CBookmark::EType type = CBookmark::STANDARD);
693 bool GetResumeBookMark(const std::string& strFilenameAndPath, CBookmark &bookmark);
694 void DeleteResumeBookMark(const CFileItem& item);
695 void ClearBookMarkOfFile(const std::string& strFilenameAndPath, CBookmark& bookmark, CBookmark::EType type = CBookmark::STANDARD);
696 void ClearBookMarksOfFile(const std::string& strFilenameAndPath, CBookmark::EType type = CBookmark::STANDARD);
697 void ClearBookMarksOfFile(int idFile, CBookmark::EType type = CBookmark::STANDARD);
698 bool GetBookMarkForEpisode(const CVideoInfoTag& tag, CBookmark& bookmark);
699 void AddBookMarkForEpisode(const CVideoInfoTag& tag, const CBookmark& bookmark);
700 void DeleteBookMarkForEpisode(const CVideoInfoTag& tag);
701 bool GetResumePoint(CVideoInfoTag& tag);
702 bool GetStreamDetails(CFileItem& item);
703 bool GetStreamDetails(CVideoInfoTag& tag);
704 bool GetDetailsByTypeAndId(CFileItem& item, VideoDbContentType type, int id);
705 CVideoInfoTag GetDetailsByTypeAndId(VideoDbContentType type, int id);
707 // scraper settings
708 void SetScraperForPath(const std::string& filePath,
709 const ADDON::ScraperPtr& info,
710 const KODI::VIDEO::SScanSettings& settings);
711 ADDON::ScraperPtr GetScraperForPath(const std::string& strPath);
712 ADDON::ScraperPtr GetScraperForPath(const std::string& strPath,
713 KODI::VIDEO::SScanSettings& settings);
715 /*! \brief Retrieve the scraper and settings we should use for the specified path
716 If the scraper is not set on this particular path, we'll recursively check parent folders.
717 \param strPath path to start searching in.
718 \param settings [out] scan settings for this folder.
719 \param foundDirectly [out] true if a scraper was found directly for strPath, false if it was in a parent path.
720 \return A ScraperPtr containing the scraper information. Returns NULL if a trivial (Content == CONTENT_NONE)
721 scraper or no scraper is found.
723 ADDON::ScraperPtr GetScraperForPath(const std::string& strPath,
724 KODI::VIDEO::SScanSettings& settings,
725 bool& foundDirectly);
727 /*! \brief Retrieve the content type of videos in the given path
728 If content is set on the folder, we return the given content type, except in the case of tvshows,
729 where we first check for whether we have episodes directly in the path (thus return episodes) or whether
730 we've found a scraper directly (shows). Any folders inbetween are treated as seasons (regardless of whether
731 they actually are seasons). Note that any subfolders in movies will be treated as movies.
732 \param strPath path to start searching in.
733 \return A content type string for the current path.
735 std::string GetContentForPath(const std::string& strPath);
737 /*! \brief Get videos of the given content type from the given path
738 \param content the content type to fetch.
739 \param path the path to fetch videos from.
740 \param items the returned items
741 \return true if items are found, false otherwise.
743 bool GetItemsForPath(const std::string &content, const std::string &path, CFileItemList &items);
745 /*! \brief Check whether a given scraper is in use.
746 \param scraperID the scraper to check for.
747 \return true if the scraper is in use, false otherwise.
749 bool ScraperInUse(const std::string &scraperID) const;
751 // scanning hashes and paths scanned
752 bool SetPathHash(const std::string &path, const std::string &hash);
753 bool GetPathHash(const std::string &path, std::string &hash);
754 bool GetPaths(std::set<std::string> &paths);
755 bool GetPathsForTvShow(int idShow, std::set<int>& paths);
757 /*! \brief return the paths linked to a tvshow.
758 \param idShow the id of the tvshow.
759 \param paths [out] the list of paths associated with the show.
760 \return true on success, false on failure.
762 bool GetPathsLinkedToTvShow(int idShow, std::vector<std::string> &paths);
764 /*! \brief retrieve subpaths of a given path. Assumes a hierarchical folder structure
765 \param basepath the root path to retrieve subpaths for
766 \param subpaths the returned subpaths
767 \return true if we successfully retrieve subpaths (may be zero), false on error
769 bool GetSubPaths(const std::string& basepath, std::vector< std::pair<int, std::string> >& subpaths);
771 bool GetSourcePath(const std::string &path, std::string &sourcePath);
772 bool GetSourcePath(const std::string& path,
773 std::string& sourcePath,
774 KODI::VIDEO::SScanSettings& settings);
776 // for music + musicvideo linkups - if no album and title given it will return the artist id, else the id of the matching video
777 int GetMatchingMusicVideo(const std::string& strArtist, const std::string& strAlbum = "", const std::string& strTitle = "");
779 // searching functions
780 void GetMoviesByActor(const std::string& strActor, CFileItemList& items);
781 void GetTvShowsByActor(const std::string& strActor, CFileItemList& items);
782 void GetEpisodesByActor(const std::string& strActor, CFileItemList& items);
784 void GetMusicVideosByArtist(const std::string& strArtist, CFileItemList& items);
785 void GetMusicVideosByAlbum(const std::string& strAlbum, CFileItemList& items);
787 void GetMovieGenresByName(const std::string& strSearch, CFileItemList& items);
788 void GetTvShowGenresByName(const std::string& strSearch, CFileItemList& items);
789 void GetMusicVideoGenresByName(const std::string& strSearch, CFileItemList& items);
791 void GetMovieCountriesByName(const std::string& strSearch, CFileItemList& items);
793 void GetMusicVideoAlbumsByName(const std::string& strSearch, CFileItemList& items);
795 void GetMovieActorsByName(const std::string& strSearch, CFileItemList& items);
796 void GetTvShowsActorsByName(const std::string& strSearch, CFileItemList& items);
797 void GetMusicVideoArtistsByName(const std::string& strSearch, CFileItemList& items);
799 void GetMovieDirectorsByName(const std::string& strSearch, CFileItemList& items);
800 void GetTvShowsDirectorsByName(const std::string& strSearch, CFileItemList& items);
801 void GetMusicVideoDirectorsByName(const std::string& strSearch, CFileItemList& items);
803 void GetMoviesByName(const std::string& strSearch, CFileItemList& items);
804 void GetTvShowsByName(const std::string& strSearch, CFileItemList& items);
805 void GetEpisodesByName(const std::string& strSearch, CFileItemList& items);
806 void GetMusicVideosByName(const std::string& strSearch, CFileItemList& items);
808 void GetEpisodesByPlot(const std::string& strSearch, CFileItemList& items);
809 void GetMoviesByPlot(const std::string& strSearch, CFileItemList& items);
811 bool LinkMovieToTvshow(int idMovie, int idShow, bool bRemove);
812 bool IsLinkedToTvshow(int idMovie);
813 bool GetLinksToTvShow(int idMovie, std::vector<int>& ids);
815 // general browsing
816 bool GetGenresNav(const std::string& strBaseDir,
817 CFileItemList& items,
818 VideoDbContentType idContent = VideoDbContentType::UNKNOWN,
819 const Filter& filter = Filter(),
820 bool countOnly = false);
821 bool GetCountriesNav(const std::string& strBaseDir,
822 CFileItemList& items,
823 VideoDbContentType idContent = VideoDbContentType::UNKNOWN,
824 const Filter& filter = Filter(),
825 bool countOnly = false);
826 bool GetStudiosNav(const std::string& strBaseDir,
827 CFileItemList& items,
828 VideoDbContentType idContent = VideoDbContentType::UNKNOWN,
829 const Filter& filter = Filter(),
830 bool countOnly = false);
831 bool GetYearsNav(const std::string& strBaseDir,
832 CFileItemList& items,
833 VideoDbContentType idContent = VideoDbContentType::UNKNOWN,
834 const Filter& filter = Filter());
835 bool GetActorsNav(const std::string& strBaseDir,
836 CFileItemList& items,
837 VideoDbContentType idContent = VideoDbContentType::UNKNOWN,
838 const Filter& filter = Filter(),
839 bool countOnly = false);
840 bool GetDirectorsNav(const std::string& strBaseDir,
841 CFileItemList& items,
842 VideoDbContentType idContent = VideoDbContentType::UNKNOWN,
843 const Filter& filter = Filter(),
844 bool countOnly = false);
845 bool GetWritersNav(const std::string& strBaseDir,
846 CFileItemList& items,
847 VideoDbContentType idContent = VideoDbContentType::UNKNOWN,
848 const Filter& filter = Filter(),
849 bool countOnly = false);
850 bool GetSetsNav(const std::string& strBaseDir,
851 CFileItemList& items,
852 VideoDbContentType idContent = VideoDbContentType::UNKNOWN,
853 const Filter& filter = Filter(),
854 bool ignoreSingleMovieSets = false);
855 bool GetTagsNav(const std::string& strBaseDir,
856 CFileItemList& items,
857 VideoDbContentType idContent = VideoDbContentType::UNKNOWN,
858 const Filter& filter = Filter(),
859 bool countOnly = false);
861 bool GetMusicVideoAlbumsNav(const std::string& strBaseDir, CFileItemList& items, int idArtist, const Filter &filter = Filter(), bool countOnly = false);
863 bool GetMoviesNav(const std::string& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idActor=-1, int idDirector=-1, int idStudio=-1, int idCountry=-1, int idSet=-1, int idTag=-1, const SortDescription &sortDescription = SortDescription(), int getDetails = VideoDbDetailsNone);
864 bool GetTvShowsNav(const std::string& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idActor=-1, int idDirector=-1, int idStudio=-1, int idTag=-1, const SortDescription &sortDescription = SortDescription(), int getDetails = VideoDbDetailsNone);
865 bool GetSeasonsNav(const std::string& strBaseDir, CFileItemList& items, int idActor=-1, int idDirector=-1, int idGenre=-1, int idYear=-1, int idShow=-1, bool getLinkedMovies = true);
866 bool GetEpisodesNav(const std::string& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idActor=-1, int idDirector=-1, int idShow=-1, int idSeason=-1, const SortDescription &sortDescription = SortDescription(), int getDetails = VideoDbDetailsNone);
867 bool GetMusicVideosNav(const std::string& strBaseDir, CFileItemList& items, int idGenre=-1, int idYear=-1, int idArtist=-1, int idDirector=-1, int idStudio=-1, int idAlbum=-1, int idTag=-1, const SortDescription &sortDescription = SortDescription(), int getDetails = VideoDbDetailsNone);
869 bool GetRecentlyAddedMoviesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0, int getDetails = VideoDbDetailsNone);
870 bool GetRecentlyAddedEpisodesNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0, int getDetails = VideoDbDetailsNone);
871 bool GetRecentlyAddedMusicVideosNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0, int getDetails = VideoDbDetailsNone);
872 bool GetInProgressTvShowsNav(const std::string& strBaseDir, CFileItemList& items, unsigned int limit=0, int getDetails = VideoDbDetailsNone);
874 bool HasContent();
875 bool HasContent(VideoDbContentType type);
876 bool HasSets() const;
878 void CleanDatabase(CGUIDialogProgressBarHandle* handle = NULL, const std::set<int>& paths = std::set<int>(), bool showProgress = true);
880 /*! \brief Add a file to the database, if necessary
881 If the file is already in the database, we simply return its id.
882 \param url - full path of the file to add.
883 \param parentPath the parent path of the path to add. If empty, URIUtils::GetParentPath() will determine the path.
884 \param dateAdded datetime when the file was added to the filesystem/database
885 \param playcount the playcount of the file to add.
886 \param lastPlayed the date and time when the file to add was last played.
887 \return id of the file, -1 if it could not be added.
889 int AddFile(const std::string& url,
890 const std::string& parentPath = "",
891 const CDateTime& dateAdded = CDateTime(),
892 int playcount = 0,
893 const CDateTime& lastPlayed = CDateTime());
895 /*! \brief Add a file to the database, if necessary
896 Works for both videodb:// items and normal fileitems
897 \param item CFileItem to add.
898 \return id of the file, -1 if it could not be added.
900 int AddFile(const CFileItem& item);
902 /*! \brief Add a file to the database, if necessary
903 Works for both videodb:// items and normal fileitems
904 \param url full path of the file to add.
905 \param details details of the item to add.
906 \return id of the file, -1 if it could not be added.
908 int AddFile(const CVideoInfoTag& details, const std::string& parentPath = "");
910 /*! \brief Add a path to the database, if necessary
911 If the path is already in the database, we simply return its id.
912 \param strPath the path to add
913 \param parentPath the parent path of the path to add. If empty, URIUtils::GetParentPath() will determine the path.
914 \param dateAdded datetime when the path was added to the filesystem/database
915 \return id of the file, -1 if it could not be added.
917 int AddPath(const std::string& strPath, const std::string &parentPath = "", const CDateTime& dateAdded = CDateTime());
919 /*! \brief Updates the dateAdded field in the files table for the file
920 with the given idFile and the given path based on the files modification date
921 \param details details of the video file
923 void UpdateFileDateAdded(CVideoInfoTag& details);
925 void ExportToXML(const std::string &path, bool singleFile = true, bool images=false, bool actorThumbs=false, bool overwrite=false);
926 void ExportActorThumbs(const std::string &path, const CVideoInfoTag& tag, bool singleFiles, bool overwrite=false);
927 void ImportFromXML(const std::string &path);
928 void DumpToDummyFiles(const std::string &path);
929 bool ImportArtFromXML(const TiXmlNode *node, std::map<std::string, std::string> &artwork);
931 // smart playlists and main retrieval work in these functions
932 bool GetMoviesByWhere(const std::string& strBaseDir, const Filter &filter, CFileItemList& items, const SortDescription &sortDescription = SortDescription(), int getDetails = VideoDbDetailsNone);
933 bool GetSetsByWhere(const std::string& strBaseDir, const Filter &filter, CFileItemList& items, bool ignoreSingleMovieSets = false);
934 bool GetTvShowsByWhere(const std::string& strBaseDir, const Filter &filter, CFileItemList& items, const SortDescription &sortDescription = SortDescription(), int getDetails = VideoDbDetailsNone);
935 bool GetSeasonsByWhere(const std::string& strBaseDir, const Filter &filter, CFileItemList& items, bool appendFullShowPath = true, const SortDescription &sortDescription = SortDescription());
936 bool GetEpisodesByWhere(const std::string& strBaseDir, const Filter &filter, CFileItemList& items, bool appendFullShowPath = true, const SortDescription &sortDescription = SortDescription(), int getDetails = VideoDbDetailsNone);
937 bool GetMusicVideosByWhere(const std::string &baseDir, const Filter &filter, CFileItemList& items, bool checkLocks = true, const SortDescription &sortDescription = SortDescription(), int getDetails = VideoDbDetailsNone);
939 // retrieve sorted and limited items
940 bool GetSortedVideos(const MediaType &mediaType, const std::string& strBaseDir, const SortDescription &sortDescription, CFileItemList& items, const Filter &filter = Filter());
942 // retrieve a list of items
943 bool GetItems(const std::string &strBaseDir, CFileItemList &items, const Filter &filter = Filter(), const SortDescription &sortDescription = SortDescription());
944 bool GetItems(const std::string &strBaseDir, const std::string &mediaType, const std::string &itemType, CFileItemList &items, const Filter &filter = Filter(), const SortDescription &sortDescription = SortDescription());
945 bool GetItems(const std::string& strBaseDir,
946 VideoDbContentType mediaType,
947 const std::string& itemType,
948 CFileItemList& items,
949 const Filter& filter = Filter(),
950 const SortDescription& sortDescription = SortDescription());
951 std::string GetItemById(const std::string &itemType, int id);
953 // partymode
954 /*! \brief Gets music video IDs in random order that match the where clause
955 \param strWhere the SQL where clause to apply in the query
956 \param songIDs a vector of <2, id> pairs suited to party mode use
957 \return count of music video IDs found.
959 unsigned int GetRandomMusicVideoIDs(const std::string& strWhere, std::vector<std::pair<int, int> > &songIDs);
961 static void VideoContentTypeToString(VideoDbContentType type, std::string& out)
963 switch (type)
965 case VideoDbContentType::MOVIES:
966 out = MediaTypeMovie;
967 break;
968 case VideoDbContentType::TVSHOWS:
969 out = MediaTypeTvShow;
970 break;
971 case VideoDbContentType::EPISODES:
972 out = MediaTypeEpisode;
973 break;
974 case VideoDbContentType::MUSICVIDEOS:
975 out = MediaTypeMusicVideo;
976 break;
977 default:
978 break;
982 void SetArtForItem(int mediaId, const MediaType &mediaType, const std::string &artType, const std::string &url);
983 void SetArtForItem(int mediaId, const MediaType &mediaType, const std::map<std::string, std::string> &art);
984 bool GetArtForItem(int mediaId, const MediaType &mediaType, std::map<std::string, std::string> &art);
985 std::string GetArtForItem(int mediaId, const MediaType &mediaType, const std::string &artType);
987 void UpdateArtForItem(int mediaId, const MediaType& mediaType);
990 * \brief Retrieve all art for the given video asset, with optional fallback to the art of the
991 * parent/owner of the asset
992 * \param assetId id of the file of the asset
993 * \param fallback optionally request fallback to the art of the parent/owner for each art type
994 that is not defined for the asset
995 * \param art collection of the retrieved art
996 * \return
998 bool GetArtForAsset(int assetId,
999 ArtFallbackOptions fallback,
1000 std::map<std::string, std::string>& art);
1001 bool HasArtForItem(int mediaId, const MediaType &mediaType);
1002 bool RemoveArtForItem(int mediaId, const MediaType &mediaType, const std::string &artType);
1003 bool RemoveArtForItem(int mediaId, const MediaType &mediaType, const std::set<std::string> &artTypes);
1004 bool GetTvShowSeasons(int showId, std::map<int, int> &seasons);
1005 bool GetTvShowNamedSeasons(int showId, std::map<int, std::string> &seasons);
1008 * \brief Get the custom named season.
1009 * \param tvshowId The tv show id relative to the season.
1010 * \param seasonId The season id for which to search the named title.
1011 * \return The named title if found, otherwise empty.
1013 std::string GetTvShowNamedSeasonById(int tvshowId, int seasonId);
1015 bool GetTvShowSeasonArt(int mediaId, std::map<int, std::map<std::string, std::string> > &seasonArt);
1016 bool GetArtTypes(const MediaType &mediaType, std::vector<std::string> &artTypes);
1018 /*! \brief Fetch the distinct types of available-but-unassigned art held in the
1019 database for a specific media item.
1020 \param mediaId the id in the media table.
1021 \param mediaType the type of media, which corresponds to the table the item resides in.
1022 \return the types of art e.g. "thumb", "fanart", etc.
1024 std::vector<std::string> GetAvailableArtTypesForItem(int mediaId, const MediaType& mediaType);
1026 /*! \brief Fetch the list of available-but-unassigned art URLs held in the
1027 database for a specific media item and art type.
1028 \param mediaId the id in the media table.
1029 \param mediaType corresponds to the table the item resides in.
1030 \param artType e.g. "thumb", "fanart", etc.
1031 \return list of URLs
1033 std::vector<CScraperUrl::SUrlEntry> GetAvailableArtForItem(
1034 int mediaId, const MediaType& mediaType, const std::string& artType);
1036 int AddTag(const std::string &tag);
1037 void AddTagToItem(int idItem, int idTag, const std::string &type);
1038 void RemoveTagFromItem(int idItem, int idTag, const std::string &type);
1039 void RemoveTagsFromItem(int idItem, const std::string &type);
1041 bool GetFilter(CDbUrl &videoUrl, Filter &filter, SortDescription &sorting) override;
1043 /*! \brief Will check if the season exists and if that is not the case add it to the database.
1044 \param showID The id of the show in question.
1045 \param season The season number we want to add.
1046 \return The dbId of the season.
1048 int AddSeason(int showID, int season, const std::string& name = "");
1049 int AddSet(const std::string& strSet,
1050 const std::string& strOverview = "",
1051 const bool updateOverview = true);
1052 void ClearMovieSet(int idMovie);
1053 void SetMovieSet(int idMovie, int idSet);
1054 bool SetVideoUserRating(int dbId, int rating, const MediaType& mediaType);
1055 bool GetUseAllExternalAudioForVideo(const std::string& videoPath);
1057 std::string GetSetByNameLike(const std::string& nameLike) const;
1059 std::string GetVideoItemTitle(VideoDbContentType itemType, int dbId);
1060 std::string GetVideoVersionById(int id);
1061 void GetVideoVersions(VideoDbContentType itemType,
1062 int dbId,
1063 CFileItemList& items,
1064 VideoAssetType videoAssetType);
1065 void GetDefaultVideoVersion(VideoDbContentType itemType, int dbId, CFileItem& item);
1068 * \brief Remove a video from the library and transfer all of its assets to another video of the
1069 * same type.
1070 * \param itemType Type of the video being converted
1071 * \param dbIdSource id of the video being converted
1072 * \param dbIdTarget id that the video will be attached to
1073 * \param idVideoVersion new versiontype of the default version of the video
1074 * \param assetType new asset type of the default version of the video
1075 * \return true for success, false otherwise
1077 bool ConvertVideoToVersion(VideoDbContentType itemType,
1078 int dbIdSource,
1079 int dbIdTarget,
1080 int idVideoVersion,
1081 VideoAssetType assetType);
1082 void SetDefaultVideoVersion(VideoDbContentType itemType, int dbId, int idFile);
1083 void SetVideoVersion(int idFile, int idVideoVersion);
1084 int AddVideoVersionType(const std::string& typeVideoVersion,
1085 VideoAssetTypeOwner owner,
1086 VideoAssetType assetType);
1087 void AddVideoAsset(VideoDbContentType itemType,
1088 int dbId,
1089 int idVideoVersion,
1090 VideoAssetType videoAssetType,
1091 CFileItem& item);
1092 bool DeleteVideoAsset(int idFile);
1093 bool IsDefaultVideoVersion(int idFile);
1094 bool GetVideoVersionTypes(VideoDbContentType idContent,
1095 VideoAssetType asset,
1096 CFileItemList& items);
1097 void SetVideoVersionDefaultArt(int dbId, int idFrom, VideoDbContentType type);
1098 void InitializeVideoVersionTypeTable(int schemaVersion);
1099 void UpdateVideoVersionTypeTable();
1100 bool GetVideoVersionsNav(const std::string& strBaseDir,
1101 CFileItemList& items,
1102 VideoDbContentType idContent = VideoDbContentType::UNKNOWN,
1103 const Filter& filter = Filter());
1104 VideoAssetInfo GetVideoVersionInfo(const std::string& filenameAndPath);
1105 bool GetAssetsForVideo(VideoDbContentType itemType,
1106 int mediaId,
1107 VideoAssetType assetType,
1108 CFileItemList& items);
1109 bool GetDefaultVersionForVideo(VideoDbContentType itemType, int mediaId, CFileItem& item);
1110 bool UpdateAssetsOwner(const std::string& mediaType, int dbIdSource, int dbIdTarget);
1112 int GetMovieId(const std::string& strFilenameAndPath);
1113 std::string GetMovieTitle(int idMovie);
1114 void GetSameVideoItems(const CFileItem& item, CFileItemList& items);
1115 int GetFileIdByMovie(int idMovie);
1116 std::string GetFileBasePathById(int idFile);
1119 * @brief Check the passed in list of images if used in this database. Used to clean the image cache.
1120 * @param imagesToCheck
1121 * @return a list of the passed in images used by this database.
1123 std::vector<std::string> GetUsedImages(const std::vector<std::string>& imagesToCheck);
1125 protected:
1126 int AddNewMovie(CVideoInfoTag& details);
1127 int AddNewMusicVideo(CVideoInfoTag& details);
1129 int GetMusicVideoId(const std::string& strFilenameAndPath);
1131 /*! \brief Get the id of this fileitem
1132 Works for both videodb:// items and normal fileitems
1133 \param item CFileItem to grab the fileid of
1134 \return id of the file, -1 if it is not in the db.
1136 int GetFileId(const CFileItem &item);
1137 int GetFileId(const CVideoInfoTag& details);
1139 /*! \brief Get the id of the file of this item and store it in the item
1140 \param details CVideoInfoTag for which to get and store the id of the file
1141 \return id of the file, -1 if it is not in the db.
1143 int GetAndFillFileId(CVideoInfoTag& details);
1145 /*! \brief Get the id of a file from path
1146 \param url full path to the file
1147 \return id of the file, -1 if it is not in the db.
1149 int GetFileId(const std::string& url);
1151 int AddToTable(const std::string& table, const std::string& firstField, const std::string& secondField, const std::string& value);
1152 int UpdateRatings(int mediaId, const char *mediaType, const RatingMap& values, const std::string& defaultRating);
1153 int AddRatings(int mediaId, const char *mediaType, const RatingMap& values, const std::string& defaultRating);
1154 int UpdateUniqueIDs(int mediaId, const char *mediaType, const CVideoInfoTag& details);
1155 int AddUniqueIDs(int mediaId, const char *mediaType, const CVideoInfoTag& details);
1156 int AddActor(const std::string& strActor, const std::string& thumbURL, const std::string &thumb = "");
1158 int AddTvShow();
1160 /*! \brief Adds a path to the tvshow link table.
1161 \param idShow the id of the show.
1162 \param path the path to add.
1163 \param parentPath the parent path of the path to add.
1164 \param dateAdded date/time when the path was added
1165 \return true if successfully added, false otherwise.
1167 bool AddPathToTvShow(int idShow, const std::string &path, const std::string &parentPath, const CDateTime& dateAdded = CDateTime());
1169 /*! \brief Check whether a show is already in the library.
1170 Matches on unique identifier or matching title and premiered date.
1171 \param show the details of the show to check for.
1172 \return the show id if found, else -1.
1174 int GetMatchingTvShow(const CVideoInfoTag &show);
1176 // link functions - these two do all the work
1177 void AddLinkToActor(int mediaId, const char *mediaType, int actorId, const std::string &role, int order);
1178 void AddToLinkTable(int mediaId, const std::string& mediaType, const std::string& table, int valueId, const char *foreignKey = NULL);
1179 void RemoveFromLinkTable(int mediaId, const std::string& mediaType, const std::string& table, int valueId, const char *foreignKey = NULL);
1181 void AddLinksToItem(int mediaId, const std::string& mediaType, const std::string& field, const std::vector<std::string>& values);
1182 void UpdateLinksToItem(int mediaId, const std::string& mediaType, const std::string& field, const std::vector<std::string>& values);
1183 void AddActorLinksToItem(int mediaId, const std::string& mediaType, const std::string& field, const std::vector<std::string>& values);
1184 void UpdateActorLinksToItem(int mediaId, const std::string& mediaType, const std::string& field, const std::vector<std::string>& values);
1186 void AddCast(int mediaId, const char *mediaType, const std::vector<SActorInfo> &cast);
1188 CVideoInfoTag GetDetailsForMovie(std::unique_ptr<dbiplus::Dataset> &pDS, int getDetails = VideoDbDetailsNone);
1189 CVideoInfoTag GetDetailsForMovie(const dbiplus::sql_record* const record, int getDetails = VideoDbDetailsNone);
1190 CVideoInfoTag GetDetailsForTvShow(std::unique_ptr<dbiplus::Dataset> &pDS, int getDetails = VideoDbDetailsNone, CFileItem* item = NULL);
1191 CVideoInfoTag GetDetailsForTvShow(const dbiplus::sql_record* const record, int getDetails = VideoDbDetailsNone, CFileItem* item = NULL);
1192 CVideoInfoTag GetBasicDetailsForEpisode(std::unique_ptr<dbiplus::Dataset> &pDS);
1193 CVideoInfoTag GetBasicDetailsForEpisode(const dbiplus::sql_record* const record);
1194 CVideoInfoTag GetDetailsForEpisode(std::unique_ptr<dbiplus::Dataset> &pDS, int getDetails = VideoDbDetailsNone);
1195 CVideoInfoTag GetDetailsForEpisode(const dbiplus::sql_record* const record, int getDetails = VideoDbDetailsNone);
1196 CVideoInfoTag GetDetailsForMusicVideo(std::unique_ptr<dbiplus::Dataset> &pDS, int getDetails = VideoDbDetailsNone);
1197 CVideoInfoTag GetDetailsForMusicVideo(const dbiplus::sql_record* const record, int getDetails = VideoDbDetailsNone);
1198 bool GetPeopleNav(const std::string& strBaseDir,
1199 CFileItemList& items,
1200 const char* type,
1201 VideoDbContentType idContent = VideoDbContentType::UNKNOWN,
1202 const Filter& filter = Filter(),
1203 bool countOnly = false);
1204 bool GetNavCommon(const std::string& strBaseDir,
1205 CFileItemList& items,
1206 const char* type,
1207 VideoDbContentType idContent = VideoDbContentType::UNKNOWN,
1208 const Filter& filter = Filter(),
1209 bool countOnly = false);
1210 void GetCast(int media_id, const std::string &media_type, std::vector<SActorInfo> &cast);
1211 void GetTags(int media_id, const std::string &media_type, std::vector<std::string> &tags);
1212 void GetRatings(int media_id, const std::string &media_type, RatingMap &ratings);
1213 void GetUniqueIDs(int media_id, const std::string &media_type, CVideoInfoTag& details);
1215 void GetDetailsFromDB(std::unique_ptr<dbiplus::Dataset> &pDS, int min, int max, const SDbTableOffsets *offsets, CVideoInfoTag &details, int idxOffset = 2);
1216 void GetDetailsFromDB(const dbiplus::sql_record* const record, int min, int max, const SDbTableOffsets *offsets, CVideoInfoTag &details, int idxOffset = 2);
1217 std::string GetValueString(const CVideoInfoTag &details, int min, int max, const SDbTableOffsets *offsets) const;
1219 private:
1220 void CreateTables() override;
1221 void CreateAnalytics() override;
1222 void UpdateTables(int version) override;
1223 void CreateLinkIndex(const char *table);
1224 void CreateForeignLinkIndex(const char *table, const char *foreignkey);
1226 /*! \brief (Re)Create the generic database views for movies, tvshows,
1227 episodes and music videos
1229 virtual void CreateViews();
1231 /*! \brief Helper to get a database id given a query.
1232 Returns an integer, -1 if not found, and greater than 0 if found.
1233 \param query the SQL that will retrieve a database id.
1234 \return -1 if not found, else a valid database id (i.e. > 0)
1236 int GetDbId(const std::string &query);
1238 /*! \brief Run a query on the main dataset and return the number of rows
1239 If no rows are found we close the dataset and return 0.
1240 \param sql the sql query to run
1241 \return the number of rows, -1 for an error.
1243 int RunQuery(const std::string &sql);
1245 void AppendIdLinkFilter(const char* field, const char *table, const MediaType& mediaType, const char *view, const char *viewKey, const CUrlOptions::UrlOptions& options, Filter &filter);
1246 void AppendLinkFilter(const char* field, const char *table, const MediaType& mediaType, const char *view, const char *viewKey, const CUrlOptions::UrlOptions& options, Filter &filter);
1248 /*! \brief Determine whether the path is using lookup using folders
1249 \param path the path to check
1250 \param shows whether this path is from a tvshow (defaults to false)
1252 bool LookupByFolders(const std::string &path, bool shows = false);
1254 /*! \brief Get the playcount for a file id
1255 \param iFileId file id to get the playcount for
1256 \return the playcount of the item, or -1 on error
1257 \sa SetPlayCount, IncrementPlayCount, GetPlayCounts
1259 int GetPlayCount(int iFileId);
1261 /*! \brief Get the last played time of a filename and path
1262 \param iFileId file id to get the playcount for
1263 \return the last played time of the item, or an invalid CDateTime on error
1264 \sa UpdateLastPlayed
1266 CDateTime GetLastPlayed(int iFileId);
1268 bool GetSeasonInfo(int idSeason, CVideoInfoTag& details, bool allDetails, CFileItem* item);
1270 int GetMinSchemaVersion() const override { return 75; }
1271 int GetSchemaVersion() const override;
1272 virtual int GetExportVersion() const { return 1; }
1273 const char* GetBaseDBName() const override { return "MyVideos"; }
1275 void ConstructPath(std::string& strDest, const std::string& strPath, const std::string& strFileName);
1276 void SplitPath(const std::string& strFileNameAndPath, std::string& strPath, std::string& strFileName);
1277 void InvalidatePathHash(const std::string& strPath);
1279 /*! \brief Get a safe filename from a given string
1280 \param dir directory to use for the file
1281 \param name movie, show name, or actor to get a safe filename for
1282 \return safe filename based on this title
1284 std::string GetSafeFile(const std::string &dir, const std::string &name) const;
1286 std::vector<int> CleanMediaType(const std::string &mediaType, const std::string &cleanableFileIDs,
1287 std::map<int, bool> &pathsDeleteDecisions, std::string &deletedFileIDs, bool silent);
1289 static void AnnounceRemove(const std::string& content, int id, bool scanning = false);
1290 static void AnnounceUpdate(const std::string& content, int id);
1292 static CDateTime GetDateAdded(const std::string& filename, CDateTime dateAdded = CDateTime());
1294 bool FillMovieItem(std::unique_ptr<dbiplus::Dataset>& dataset, int movieId, CFileItem& item);