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.
12 #include "VideoInfoTag.h"
13 #include "addons/Scraper.h"
14 #include "dbwrappers/Database.h"
15 #include "utils/SortUtils.h"
16 #include "utils/UrlOptions.h"
26 class CGUIDialogProgress
;
27 class CGUIDialogProgressBarHandle
;
29 struct VideoAssetInfo
;
31 enum class VideoAssetTypeOwner
;
32 enum class VideoAssetType
;
37 typedef std::vector
<field_value
> sql_record
;
42 #define my_offsetof(TYPE, MEMBER) offsetof(TYPE, MEMBER)
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))
57 typedef std::vector
<CVideoInfoTag
> VECMOVIES
;
61 class IVideoInfoScannerObserver
;
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
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
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)
184 VIDEODB_ID_TITLE
= 0,
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,
211 const struct SDbTableOffsets
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,
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
410 enum class DeleteMovieCascadeAction
416 #define COMPARE_PERCENTAGE 0.90f // 90%
417 #define COMPARE_PERCENTAGE_MIN 0.50f // 50%
419 class CVideoDatabase
: public CDatabase
423 class CActor
// used for actor retrieval for non-master users
432 class CSeason
// used for season retrieval for non-master users
436 std::vector
<std::string
> genre
;
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
);
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
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
,
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
,
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
,
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
,
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
,
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
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
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
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
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
651 void SetVideoSettings(int idFile
, const CVideoSettings
&settings
);
654 * Erases video settings for file item
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> ×
);
677 void SetStackTimes(const std::string
&filePath
, const std::vector
<uint64_t> ×
);
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
);
696 void SetScraperForPath(const std::string
& filePath
, const ADDON::ScraperPtr
& info
, const VIDEO::SScanSettings
& settings
);
697 ADDON::ScraperPtr
GetScraperForPath(const std::string
& strPath
);
698 ADDON::ScraperPtr
GetScraperForPath(const std::string
& strPath
, VIDEO::SScanSettings
& settings
);
700 /*! \brief Retrieve the scraper and settings we should use for the specified path
701 If the scraper is not set on this particular path, we'll recursively check parent folders.
702 \param strPath path to start searching in.
703 \param settings [out] scan settings for this folder.
704 \param foundDirectly [out] true if a scraper was found directly for strPath, false if it was in a parent path.
705 \return A ScraperPtr containing the scraper information. Returns NULL if a trivial (Content == CONTENT_NONE)
706 scraper or no scraper is found.
708 ADDON::ScraperPtr
GetScraperForPath(const std::string
& strPath
, VIDEO::SScanSettings
& settings
, bool& foundDirectly
);
710 /*! \brief Retrieve the content type of videos in the given path
711 If content is set on the folder, we return the given content type, except in the case of tvshows,
712 where we first check for whether we have episodes directly in the path (thus return episodes) or whether
713 we've found a scraper directly (shows). Any folders inbetween are treated as seasons (regardless of whether
714 they actually are seasons). Note that any subfolders in movies will be treated as movies.
715 \param strPath path to start searching in.
716 \return A content type string for the current path.
718 std::string
GetContentForPath(const std::string
& strPath
);
720 /*! \brief Get videos of the given content type from the given path
721 \param content the content type to fetch.
722 \param path the path to fetch videos from.
723 \param items the returned items
724 \return true if items are found, false otherwise.
726 bool GetItemsForPath(const std::string
&content
, const std::string
&path
, CFileItemList
&items
);
728 /*! \brief Check whether a given scraper is in use.
729 \param scraperID the scraper to check for.
730 \return true if the scraper is in use, false otherwise.
732 bool ScraperInUse(const std::string
&scraperID
) const;
734 // scanning hashes and paths scanned
735 bool SetPathHash(const std::string
&path
, const std::string
&hash
);
736 bool GetPathHash(const std::string
&path
, std::string
&hash
);
737 bool GetPaths(std::set
<std::string
> &paths
);
738 bool GetPathsForTvShow(int idShow
, std::set
<int>& paths
);
740 /*! \brief return the paths linked to a tvshow.
741 \param idShow the id of the tvshow.
742 \param paths [out] the list of paths associated with the show.
743 \return true on success, false on failure.
745 bool GetPathsLinkedToTvShow(int idShow
, std::vector
<std::string
> &paths
);
747 /*! \brief retrieve subpaths of a given path. Assumes a hierarchical folder structure
748 \param basepath the root path to retrieve subpaths for
749 \param subpaths the returned subpaths
750 \return true if we successfully retrieve subpaths (may be zero), false on error
752 bool GetSubPaths(const std::string
& basepath
, std::vector
< std::pair
<int, std::string
> >& subpaths
);
754 bool GetSourcePath(const std::string
&path
, std::string
&sourcePath
);
755 bool GetSourcePath(const std::string
&path
, std::string
&sourcePath
, VIDEO::SScanSettings
& settings
);
757 // for music + musicvideo linkups - if no album and title given it will return the artist id, else the id of the matching video
758 int GetMatchingMusicVideo(const std::string
& strArtist
, const std::string
& strAlbum
= "", const std::string
& strTitle
= "");
760 // searching functions
761 void GetMoviesByActor(const std::string
& strActor
, CFileItemList
& items
);
762 void GetTvShowsByActor(const std::string
& strActor
, CFileItemList
& items
);
763 void GetEpisodesByActor(const std::string
& strActor
, CFileItemList
& items
);
765 void GetMusicVideosByArtist(const std::string
& strArtist
, CFileItemList
& items
);
766 void GetMusicVideosByAlbum(const std::string
& strAlbum
, CFileItemList
& items
);
768 void GetMovieGenresByName(const std::string
& strSearch
, CFileItemList
& items
);
769 void GetTvShowGenresByName(const std::string
& strSearch
, CFileItemList
& items
);
770 void GetMusicVideoGenresByName(const std::string
& strSearch
, CFileItemList
& items
);
772 void GetMovieCountriesByName(const std::string
& strSearch
, CFileItemList
& items
);
774 void GetMusicVideoAlbumsByName(const std::string
& strSearch
, CFileItemList
& items
);
776 void GetMovieActorsByName(const std::string
& strSearch
, CFileItemList
& items
);
777 void GetTvShowsActorsByName(const std::string
& strSearch
, CFileItemList
& items
);
778 void GetMusicVideoArtistsByName(const std::string
& strSearch
, CFileItemList
& items
);
780 void GetMovieDirectorsByName(const std::string
& strSearch
, CFileItemList
& items
);
781 void GetTvShowsDirectorsByName(const std::string
& strSearch
, CFileItemList
& items
);
782 void GetMusicVideoDirectorsByName(const std::string
& strSearch
, CFileItemList
& items
);
784 void GetMoviesByName(const std::string
& strSearch
, CFileItemList
& items
);
785 void GetTvShowsByName(const std::string
& strSearch
, CFileItemList
& items
);
786 void GetEpisodesByName(const std::string
& strSearch
, CFileItemList
& items
);
787 void GetMusicVideosByName(const std::string
& strSearch
, CFileItemList
& items
);
789 void GetEpisodesByPlot(const std::string
& strSearch
, CFileItemList
& items
);
790 void GetMoviesByPlot(const std::string
& strSearch
, CFileItemList
& items
);
792 bool LinkMovieToTvshow(int idMovie
, int idShow
, bool bRemove
);
793 bool IsLinkedToTvshow(int idMovie
);
794 bool GetLinksToTvShow(int idMovie
, std::vector
<int>& ids
);
797 bool GetGenresNav(const std::string
& strBaseDir
,
798 CFileItemList
& items
,
799 VideoDbContentType idContent
= VideoDbContentType::UNKNOWN
,
800 const Filter
& filter
= Filter(),
801 bool countOnly
= false);
802 bool GetCountriesNav(const std::string
& strBaseDir
,
803 CFileItemList
& items
,
804 VideoDbContentType idContent
= VideoDbContentType::UNKNOWN
,
805 const Filter
& filter
= Filter(),
806 bool countOnly
= false);
807 bool GetStudiosNav(const std::string
& strBaseDir
,
808 CFileItemList
& items
,
809 VideoDbContentType idContent
= VideoDbContentType::UNKNOWN
,
810 const Filter
& filter
= Filter(),
811 bool countOnly
= false);
812 bool GetYearsNav(const std::string
& strBaseDir
,
813 CFileItemList
& items
,
814 VideoDbContentType idContent
= VideoDbContentType::UNKNOWN
,
815 const Filter
& filter
= Filter());
816 bool GetActorsNav(const std::string
& strBaseDir
,
817 CFileItemList
& items
,
818 VideoDbContentType idContent
= VideoDbContentType::UNKNOWN
,
819 const Filter
& filter
= Filter(),
820 bool countOnly
= false);
821 bool GetDirectorsNav(const std::string
& strBaseDir
,
822 CFileItemList
& items
,
823 VideoDbContentType idContent
= VideoDbContentType::UNKNOWN
,
824 const Filter
& filter
= Filter(),
825 bool countOnly
= false);
826 bool GetWritersNav(const std::string
& strBaseDir
,
827 CFileItemList
& items
,
828 VideoDbContentType idContent
= VideoDbContentType::UNKNOWN
,
829 const Filter
& filter
= Filter(),
830 bool countOnly
= false);
831 bool GetSetsNav(const std::string
& strBaseDir
,
832 CFileItemList
& items
,
833 VideoDbContentType idContent
= VideoDbContentType::UNKNOWN
,
834 const Filter
& filter
= Filter(),
835 bool ignoreSingleMovieSets
= false);
836 bool GetTagsNav(const std::string
& strBaseDir
,
837 CFileItemList
& items
,
838 VideoDbContentType idContent
= VideoDbContentType::UNKNOWN
,
839 const Filter
& filter
= Filter(),
840 bool countOnly
= false);
842 bool GetMusicVideoAlbumsNav(const std::string
& strBaseDir
, CFileItemList
& items
, int idArtist
, const Filter
&filter
= Filter(), bool countOnly
= false);
844 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
);
845 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
);
846 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);
847 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
);
848 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
);
850 bool GetRecentlyAddedMoviesNav(const std::string
& strBaseDir
, CFileItemList
& items
, unsigned int limit
=0, int getDetails
= VideoDbDetailsNone
);
851 bool GetRecentlyAddedEpisodesNav(const std::string
& strBaseDir
, CFileItemList
& items
, unsigned int limit
=0, int getDetails
= VideoDbDetailsNone
);
852 bool GetRecentlyAddedMusicVideosNav(const std::string
& strBaseDir
, CFileItemList
& items
, unsigned int limit
=0, int getDetails
= VideoDbDetailsNone
);
853 bool GetInProgressTvShowsNav(const std::string
& strBaseDir
, CFileItemList
& items
, unsigned int limit
=0, int getDetails
= VideoDbDetailsNone
);
856 bool HasContent(VideoDbContentType type
);
857 bool HasSets() const;
859 void CleanDatabase(CGUIDialogProgressBarHandle
* handle
= NULL
, const std::set
<int>& paths
= std::set
<int>(), bool showProgress
= true);
861 /*! \brief Add a file to the database, if necessary
862 If the file is already in the database, we simply return its id.
863 \param url - full path of the file to add.
864 \param parentPath the parent path of the path to add. If empty, URIUtils::GetParentPath() will determine the path.
865 \param dateAdded datetime when the file was added to the filesystem/database
866 \param playcount the playcount of the file to add.
867 \param lastPlayed the date and time when the file to add was last played.
868 \return id of the file, -1 if it could not be added.
870 int AddFile(const std::string
& url
,
871 const std::string
& parentPath
= "",
872 const CDateTime
& dateAdded
= CDateTime(),
874 const CDateTime
& lastPlayed
= CDateTime());
876 /*! \brief Add a file to the database, if necessary
877 Works for both videodb:// items and normal fileitems
878 \param item CFileItem to add.
879 \return id of the file, -1 if it could not be added.
881 int AddFile(const CFileItem
& item
);
883 /*! \brief Add a file to the database, if necessary
884 Works for both videodb:// items and normal fileitems
885 \param url full path of the file to add.
886 \param details details of the item to add.
887 \return id of the file, -1 if it could not be added.
889 int AddFile(const CVideoInfoTag
& details
, const std::string
& parentPath
= "");
891 /*! \brief Add a path to the database, if necessary
892 If the path is already in the database, we simply return its id.
893 \param strPath the path to add
894 \param parentPath the parent path of the path to add. If empty, URIUtils::GetParentPath() will determine the path.
895 \param dateAdded datetime when the path was added to the filesystem/database
896 \return id of the file, -1 if it could not be added.
898 int AddPath(const std::string
& strPath
, const std::string
&parentPath
= "", const CDateTime
& dateAdded
= CDateTime());
900 /*! \brief Updates the dateAdded field in the files table for the file
901 with the given idFile and the given path based on the files modification date
902 \param details details of the video file
904 void UpdateFileDateAdded(CVideoInfoTag
& details
);
906 void ExportToXML(const std::string
&path
, bool singleFile
= true, bool images
=false, bool actorThumbs
=false, bool overwrite
=false);
907 void ExportActorThumbs(const std::string
&path
, const CVideoInfoTag
& tag
, bool singleFiles
, bool overwrite
=false);
908 void ImportFromXML(const std::string
&path
);
909 void DumpToDummyFiles(const std::string
&path
);
910 bool ImportArtFromXML(const TiXmlNode
*node
, std::map
<std::string
, std::string
> &artwork
);
912 // smart playlists and main retrieval work in these functions
913 bool GetMoviesByWhere(const std::string
& strBaseDir
, const Filter
&filter
, CFileItemList
& items
, const SortDescription
&sortDescription
= SortDescription(), int getDetails
= VideoDbDetailsNone
);
914 bool GetSetsByWhere(const std::string
& strBaseDir
, const Filter
&filter
, CFileItemList
& items
, bool ignoreSingleMovieSets
= false);
915 bool GetTvShowsByWhere(const std::string
& strBaseDir
, const Filter
&filter
, CFileItemList
& items
, const SortDescription
&sortDescription
= SortDescription(), int getDetails
= VideoDbDetailsNone
);
916 bool GetSeasonsByWhere(const std::string
& strBaseDir
, const Filter
&filter
, CFileItemList
& items
, bool appendFullShowPath
= true, const SortDescription
&sortDescription
= SortDescription());
917 bool GetEpisodesByWhere(const std::string
& strBaseDir
, const Filter
&filter
, CFileItemList
& items
, bool appendFullShowPath
= true, const SortDescription
&sortDescription
= SortDescription(), int getDetails
= VideoDbDetailsNone
);
918 bool GetMusicVideosByWhere(const std::string
&baseDir
, const Filter
&filter
, CFileItemList
& items
, bool checkLocks
= true, const SortDescription
&sortDescription
= SortDescription(), int getDetails
= VideoDbDetailsNone
);
920 // retrieve sorted and limited items
921 bool GetSortedVideos(const MediaType
&mediaType
, const std::string
& strBaseDir
, const SortDescription
&sortDescription
, CFileItemList
& items
, const Filter
&filter
= Filter());
923 // retrieve a list of items
924 bool GetItems(const std::string
&strBaseDir
, CFileItemList
&items
, const Filter
&filter
= Filter(), const SortDescription
&sortDescription
= SortDescription());
925 bool GetItems(const std::string
&strBaseDir
, const std::string
&mediaType
, const std::string
&itemType
, CFileItemList
&items
, const Filter
&filter
= Filter(), const SortDescription
&sortDescription
= SortDescription());
926 bool GetItems(const std::string
& strBaseDir
,
927 VideoDbContentType mediaType
,
928 const std::string
& itemType
,
929 CFileItemList
& items
,
930 const Filter
& filter
= Filter(),
931 const SortDescription
& sortDescription
= SortDescription());
932 std::string
GetItemById(const std::string
&itemType
, int id
);
935 /*! \brief Gets music video IDs in random order that match the where clause
936 \param strWhere the SQL where clause to apply in the query
937 \param songIDs a vector of <2, id> pairs suited to party mode use
938 \return count of music video IDs found.
940 unsigned int GetRandomMusicVideoIDs(const std::string
& strWhere
, std::vector
<std::pair
<int, int> > &songIDs
);
942 static void VideoContentTypeToString(VideoDbContentType type
, std::string
& out
)
946 case VideoDbContentType::MOVIES
:
947 out
= MediaTypeMovie
;
949 case VideoDbContentType::TVSHOWS
:
950 out
= MediaTypeTvShow
;
952 case VideoDbContentType::EPISODES
:
953 out
= MediaTypeEpisode
;
955 case VideoDbContentType::MUSICVIDEOS
:
956 out
= MediaTypeMusicVideo
;
963 void SetArtForItem(int mediaId
, const MediaType
&mediaType
, const std::string
&artType
, const std::string
&url
);
964 void SetArtForItem(int mediaId
, const MediaType
&mediaType
, const std::map
<std::string
, std::string
> &art
);
965 bool GetArtForItem(int mediaId
, const MediaType
&mediaType
, std::map
<std::string
, std::string
> &art
);
966 std::string
GetArtForItem(int mediaId
, const MediaType
&mediaType
, const std::string
&artType
);
969 * \brief Retrieve all art for the given video asset, with optional fallback to the art of the
970 * parent/owner of the asset
971 * \param assetId id of the file of the asset
972 * \param fallback optionally request fallback to the art of the parent/owner for each art type
973 that is not defined for the asset
974 * \param art collection of the retrieved art
977 bool GetArtForAsset(int assetId
,
978 ArtFallbackOptions fallback
,
979 std::map
<std::string
, std::string
>& art
);
980 bool HasArtForItem(int mediaId
, const MediaType
&mediaType
);
981 bool RemoveArtForItem(int mediaId
, const MediaType
&mediaType
, const std::string
&artType
);
982 bool RemoveArtForItem(int mediaId
, const MediaType
&mediaType
, const std::set
<std::string
> &artTypes
);
983 bool GetTvShowSeasons(int showId
, std::map
<int, int> &seasons
);
984 bool GetTvShowNamedSeasons(int showId
, std::map
<int, std::string
> &seasons
);
987 * \brief Get the custom named season.
988 * \param tvshowId The tv show id relative to the season.
989 * \param seasonId The season id for which to search the named title.
990 * \return The named title if found, otherwise empty.
992 std::string
GetTvShowNamedSeasonById(int tvshowId
, int seasonId
);
994 bool GetTvShowSeasonArt(int mediaId
, std::map
<int, std::map
<std::string
, std::string
> > &seasonArt
);
995 bool GetArtTypes(const MediaType
&mediaType
, std::vector
<std::string
> &artTypes
);
997 /*! \brief Fetch the distinct types of available-but-unassigned art held in the
998 database for a specific media item.
999 \param mediaId the id in the media table.
1000 \param mediaType the type of media, which corresponds to the table the item resides in.
1001 \return the types of art e.g. "thumb", "fanart", etc.
1003 std::vector
<std::string
> GetAvailableArtTypesForItem(int mediaId
, const MediaType
& mediaType
);
1005 /*! \brief Fetch the list of available-but-unassigned art URLs held in the
1006 database for a specific media item and art type.
1007 \param mediaId the id in the media table.
1008 \param mediaType corresponds to the table the item resides in.
1009 \param artType e.g. "thumb", "fanart", etc.
1010 \return list of URLs
1012 std::vector
<CScraperUrl::SUrlEntry
> GetAvailableArtForItem(
1013 int mediaId
, const MediaType
& mediaType
, const std::string
& artType
);
1015 int AddTag(const std::string
&tag
);
1016 void AddTagToItem(int idItem
, int idTag
, const std::string
&type
);
1017 void RemoveTagFromItem(int idItem
, int idTag
, const std::string
&type
);
1018 void RemoveTagsFromItem(int idItem
, const std::string
&type
);
1020 bool GetFilter(CDbUrl
&videoUrl
, Filter
&filter
, SortDescription
&sorting
) override
;
1022 /*! \brief Will check if the season exists and if that is not the case add it to the database.
1023 \param showID The id of the show in question.
1024 \param season The season number we want to add.
1025 \return The dbId of the season.
1027 int AddSeason(int showID
, int season
, const std::string
& name
= "");
1028 int AddSet(const std::string
& strSet
,
1029 const std::string
& strOverview
= "",
1030 const bool updateOverview
= true);
1031 void ClearMovieSet(int idMovie
);
1032 void SetMovieSet(int idMovie
, int idSet
);
1033 bool SetVideoUserRating(int dbId
, int rating
, const MediaType
& mediaType
);
1034 bool GetUseAllExternalAudioForVideo(const std::string
& videoPath
);
1036 std::string
GetSetByNameLike(const std::string
& nameLike
) const;
1038 std::string
GetVideoItemTitle(VideoDbContentType itemType
, int dbId
);
1039 std::string
GetVideoVersionById(int id
);
1040 void GetVideoVersions(VideoDbContentType itemType
,
1042 CFileItemList
& items
,
1043 VideoAssetType videoAssetType
);
1044 void GetDefaultVideoVersion(VideoDbContentType itemType
, int dbId
, CFileItem
& item
);
1047 * \brief Remove a video from the library and transfer all of its assets to another video of the
1049 * \param itemType Type of the video being converted
1050 * \param dbIdSource id of the video being converted
1051 * \param dbIdTarget id that the video will be attached to
1052 * \param idVideoVersion new versiontype of the default version of the video
1053 * \param assetType new asset type of the default version of the video
1054 * \return true for success, false otherwise
1056 bool ConvertVideoToVersion(VideoDbContentType itemType
,
1060 VideoAssetType assetType
);
1061 void SetDefaultVideoVersion(VideoDbContentType itemType
, int dbId
, int idFile
);
1062 void SetVideoVersion(int idFile
, int idVideoVersion
);
1063 int AddVideoVersionType(const std::string
& typeVideoVersion
,
1064 VideoAssetTypeOwner owner
,
1065 VideoAssetType assetType
);
1066 void AddVideoAsset(VideoDbContentType itemType
,
1069 VideoAssetType videoAssetType
,
1071 bool DeleteVideoAsset(int idFile
);
1072 bool IsDefaultVideoVersion(int idFile
);
1073 bool GetVideoVersionTypes(VideoDbContentType idContent
,
1074 VideoAssetType asset
,
1075 CFileItemList
& items
);
1076 void SetVideoVersionDefaultArt(int dbId
, int idFrom
, VideoDbContentType type
);
1077 void InitializeVideoVersionTypeTable(int schemaVersion
);
1078 void UpdateVideoVersionTypeTable();
1079 bool GetVideoVersionsNav(const std::string
& strBaseDir
,
1080 CFileItemList
& items
,
1081 VideoDbContentType idContent
= VideoDbContentType::UNKNOWN
,
1082 const Filter
& filter
= Filter());
1083 VideoAssetInfo
GetVideoVersionInfo(const std::string
& filenameAndPath
);
1084 bool GetAssetsForVideo(VideoDbContentType itemType
,
1086 VideoAssetType assetType
,
1087 CFileItemList
& items
);
1088 bool GetDefaultVersionForVideo(VideoDbContentType itemType
, int mediaId
, CFileItem
& item
);
1089 bool UpdateAssetsOwner(const std::string
& mediaType
, int dbIdSource
, int dbIdTarget
);
1091 int GetMovieId(const std::string
& strFilenameAndPath
);
1092 std::string
GetMovieTitle(int idMovie
);
1093 void GetSameVideoItems(const CFileItem
& item
, CFileItemList
& items
);
1094 int GetFileIdByMovie(int idMovie
);
1095 std::string
GetFileBasePathById(int idFile
);
1098 int AddNewMovie(CVideoInfoTag
& details
);
1099 int AddNewMusicVideo(CVideoInfoTag
& details
);
1101 int GetMusicVideoId(const std::string
& strFilenameAndPath
);
1103 /*! \brief Get the id of this fileitem
1104 Works for both videodb:// items and normal fileitems
1105 \param item CFileItem to grab the fileid of
1106 \return id of the file, -1 if it is not in the db.
1108 int GetFileId(const CFileItem
&item
);
1109 int GetFileId(const CVideoInfoTag
& details
);
1111 /*! \brief Get the id of the file of this item and store it in the item
1112 \param details CVideoInfoTag for which to get and store the id of the file
1113 \return id of the file, -1 if it is not in the db.
1115 int GetAndFillFileId(CVideoInfoTag
& details
);
1117 /*! \brief Get the id of a file from path
1118 \param url full path to the file
1119 \return id of the file, -1 if it is not in the db.
1121 int GetFileId(const std::string
& url
);
1123 int AddToTable(const std::string
& table
, const std::string
& firstField
, const std::string
& secondField
, const std::string
& value
);
1124 int UpdateRatings(int mediaId
, const char *mediaType
, const RatingMap
& values
, const std::string
& defaultRating
);
1125 int AddRatings(int mediaId
, const char *mediaType
, const RatingMap
& values
, const std::string
& defaultRating
);
1126 int UpdateUniqueIDs(int mediaId
, const char *mediaType
, const CVideoInfoTag
& details
);
1127 int AddUniqueIDs(int mediaId
, const char *mediaType
, const CVideoInfoTag
& details
);
1128 int AddActor(const std::string
& strActor
, const std::string
& thumbURL
, const std::string
&thumb
= "");
1132 /*! \brief Adds a path to the tvshow link table.
1133 \param idShow the id of the show.
1134 \param path the path to add.
1135 \param parentPath the parent path of the path to add.
1136 \param dateAdded date/time when the path was added
1137 \return true if successfully added, false otherwise.
1139 bool AddPathToTvShow(int idShow
, const std::string
&path
, const std::string
&parentPath
, const CDateTime
& dateAdded
= CDateTime());
1141 /*! \brief Check whether a show is already in the library.
1142 Matches on unique identifier or matching title and premiered date.
1143 \param show the details of the show to check for.
1144 \return the show id if found, else -1.
1146 int GetMatchingTvShow(const CVideoInfoTag
&show
);
1148 // link functions - these two do all the work
1149 void AddLinkToActor(int mediaId
, const char *mediaType
, int actorId
, const std::string
&role
, int order
);
1150 void AddToLinkTable(int mediaId
, const std::string
& mediaType
, const std::string
& table
, int valueId
, const char *foreignKey
= NULL
);
1151 void RemoveFromLinkTable(int mediaId
, const std::string
& mediaType
, const std::string
& table
, int valueId
, const char *foreignKey
= NULL
);
1153 void AddLinksToItem(int mediaId
, const std::string
& mediaType
, const std::string
& field
, const std::vector
<std::string
>& values
);
1154 void UpdateLinksToItem(int mediaId
, const std::string
& mediaType
, const std::string
& field
, const std::vector
<std::string
>& values
);
1155 void AddActorLinksToItem(int mediaId
, const std::string
& mediaType
, const std::string
& field
, const std::vector
<std::string
>& values
);
1156 void UpdateActorLinksToItem(int mediaId
, const std::string
& mediaType
, const std::string
& field
, const std::vector
<std::string
>& values
);
1158 void AddCast(int mediaId
, const char *mediaType
, const std::vector
<SActorInfo
> &cast
);
1160 CVideoInfoTag
GetDetailsForMovie(std::unique_ptr
<dbiplus::Dataset
> &pDS
, int getDetails
= VideoDbDetailsNone
);
1161 CVideoInfoTag
GetDetailsForMovie(const dbiplus::sql_record
* const record
, int getDetails
= VideoDbDetailsNone
);
1162 CVideoInfoTag
GetDetailsForTvShow(std::unique_ptr
<dbiplus::Dataset
> &pDS
, int getDetails
= VideoDbDetailsNone
, CFileItem
* item
= NULL
);
1163 CVideoInfoTag
GetDetailsForTvShow(const dbiplus::sql_record
* const record
, int getDetails
= VideoDbDetailsNone
, CFileItem
* item
= NULL
);
1164 CVideoInfoTag
GetBasicDetailsForEpisode(std::unique_ptr
<dbiplus::Dataset
> &pDS
);
1165 CVideoInfoTag
GetBasicDetailsForEpisode(const dbiplus::sql_record
* const record
);
1166 CVideoInfoTag
GetDetailsForEpisode(std::unique_ptr
<dbiplus::Dataset
> &pDS
, int getDetails
= VideoDbDetailsNone
);
1167 CVideoInfoTag
GetDetailsForEpisode(const dbiplus::sql_record
* const record
, int getDetails
= VideoDbDetailsNone
);
1168 CVideoInfoTag
GetDetailsForMusicVideo(std::unique_ptr
<dbiplus::Dataset
> &pDS
, int getDetails
= VideoDbDetailsNone
);
1169 CVideoInfoTag
GetDetailsForMusicVideo(const dbiplus::sql_record
* const record
, int getDetails
= VideoDbDetailsNone
);
1170 bool GetPeopleNav(const std::string
& strBaseDir
,
1171 CFileItemList
& items
,
1173 VideoDbContentType idContent
= VideoDbContentType::UNKNOWN
,
1174 const Filter
& filter
= Filter(),
1175 bool countOnly
= false);
1176 bool GetNavCommon(const std::string
& strBaseDir
,
1177 CFileItemList
& items
,
1179 VideoDbContentType idContent
= VideoDbContentType::UNKNOWN
,
1180 const Filter
& filter
= Filter(),
1181 bool countOnly
= false);
1182 void GetCast(int media_id
, const std::string
&media_type
, std::vector
<SActorInfo
> &cast
);
1183 void GetTags(int media_id
, const std::string
&media_type
, std::vector
<std::string
> &tags
);
1184 void GetRatings(int media_id
, const std::string
&media_type
, RatingMap
&ratings
);
1185 void GetUniqueIDs(int media_id
, const std::string
&media_type
, CVideoInfoTag
& details
);
1187 void GetDetailsFromDB(std::unique_ptr
<dbiplus::Dataset
> &pDS
, int min
, int max
, const SDbTableOffsets
*offsets
, CVideoInfoTag
&details
, int idxOffset
= 2);
1188 void GetDetailsFromDB(const dbiplus::sql_record
* const record
, int min
, int max
, const SDbTableOffsets
*offsets
, CVideoInfoTag
&details
, int idxOffset
= 2);
1189 std::string
GetValueString(const CVideoInfoTag
&details
, int min
, int max
, const SDbTableOffsets
*offsets
) const;
1192 void CreateTables() override
;
1193 void CreateAnalytics() override
;
1194 void UpdateTables(int version
) override
;
1195 void CreateLinkIndex(const char *table
);
1196 void CreateForeignLinkIndex(const char *table
, const char *foreignkey
);
1198 /*! \brief (Re)Create the generic database views for movies, tvshows,
1199 episodes and music videos
1201 virtual void CreateViews();
1203 /*! \brief Helper to get a database id given a query.
1204 Returns an integer, -1 if not found, and greater than 0 if found.
1205 \param query the SQL that will retrieve a database id.
1206 \return -1 if not found, else a valid database id (i.e. > 0)
1208 int GetDbId(const std::string
&query
);
1210 /*! \brief Run a query on the main dataset and return the number of rows
1211 If no rows are found we close the dataset and return 0.
1212 \param sql the sql query to run
1213 \return the number of rows, -1 for an error.
1215 int RunQuery(const std::string
&sql
);
1217 void AppendIdLinkFilter(const char* field
, const char *table
, const MediaType
& mediaType
, const char *view
, const char *viewKey
, const CUrlOptions::UrlOptions
& options
, Filter
&filter
);
1218 void AppendLinkFilter(const char* field
, const char *table
, const MediaType
& mediaType
, const char *view
, const char *viewKey
, const CUrlOptions::UrlOptions
& options
, Filter
&filter
);
1220 /*! \brief Determine whether the path is using lookup using folders
1221 \param path the path to check
1222 \param shows whether this path is from a tvshow (defaults to false)
1224 bool LookupByFolders(const std::string
&path
, bool shows
= false);
1226 /*! \brief Get the playcount for a file id
1227 \param iFileId file id to get the playcount for
1228 \return the playcount of the item, or -1 on error
1229 \sa SetPlayCount, IncrementPlayCount, GetPlayCounts
1231 int GetPlayCount(int iFileId
);
1233 /*! \brief Get the last played time of a filename and path
1234 \param iFileId file id to get the playcount for
1235 \return the last played time of the item, or an invalid CDateTime on error
1236 \sa UpdateLastPlayed
1238 CDateTime
GetLastPlayed(int iFileId
);
1240 bool GetSeasonInfo(int idSeason
, CVideoInfoTag
& details
, bool allDetails
, CFileItem
* item
);
1242 int GetMinSchemaVersion() const override
{ return 75; }
1243 int GetSchemaVersion() const override
;
1244 virtual int GetExportVersion() const { return 1; }
1245 const char* GetBaseDBName() const override
{ return "MyVideos"; }
1247 void ConstructPath(std::string
& strDest
, const std::string
& strPath
, const std::string
& strFileName
);
1248 void SplitPath(const std::string
& strFileNameAndPath
, std::string
& strPath
, std::string
& strFileName
);
1249 void InvalidatePathHash(const std::string
& strPath
);
1251 /*! \brief Get a safe filename from a given string
1252 \param dir directory to use for the file
1253 \param name movie, show name, or actor to get a safe filename for
1254 \return safe filename based on this title
1256 std::string
GetSafeFile(const std::string
&dir
, const std::string
&name
) const;
1258 std::vector
<int> CleanMediaType(const std::string
&mediaType
, const std::string
&cleanableFileIDs
,
1259 std::map
<int, bool> &pathsDeleteDecisions
, std::string
&deletedFileIDs
, bool silent
);
1261 static void AnnounceRemove(const std::string
& content
, int id
, bool scanning
= false);
1262 static void AnnounceUpdate(const std::string
& content
, int id
);
1264 static CDateTime
GetDateAdded(const std::string
& filename
, CDateTime dateAdded
= CDateTime());
1266 bool FillMovieItem(std::unique_ptr
<dbiplus::Dataset
>& dataset
, int movieId
, CFileItem
& item
);