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