diff options
author | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2022-11-09 22:41:28 +0100 |
---|---|---|
committer | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2022-11-11 13:11:48 +0100 |
commit | abd13ba784a261751aed550c5ad67188c8abe14f (patch) | |
tree | 904d10af142b5080cb414e83be21f58cb62bd2ae | |
parent | 04f1417532fd43a2c8f87f7fd001f6a23421961c (diff) |
[video] CVideoDatabase: Add method GetSeasonInfo(int, CVideoInfoTag&, CfileItem*), add member CFileItem* to method GetSetInfo(int, CVideoInfoTag&), add member GetDetailsByTypeAndId(CFileItem&, VideoDbContentType, int).
-rw-r--r-- | xbmc/video/VideoDatabase.cpp | 37 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.h | 6 |
2 files changed, 37 insertions, 6 deletions
diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index d832c72e3f..eb5285b402 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -2138,6 +2138,19 @@ bool CVideoDatabase::GetTvShowInfo(const std::string& strPath, CVideoInfoTag& de bool CVideoDatabase::GetSeasonInfo(int idSeason, CVideoInfoTag& details, bool allDetails /* = true */) { + return GetSeasonInfo(idSeason, details, allDetails, nullptr); +} + +bool CVideoDatabase::GetSeasonInfo(int idSeason, CVideoInfoTag& details, CFileItem* item) +{ + return GetSeasonInfo(idSeason, details, true, item); +} + +bool CVideoDatabase::GetSeasonInfo(int idSeason, + CVideoInfoTag& details, + bool allDetails, + CFileItem* item) +{ if (idSeason < 0) return false; @@ -2175,6 +2188,8 @@ bool CVideoDatabase::GetSeasonInfo(int idSeason, CVideoInfoTag& details, bool al if (season->HasVideoInfoTag() && season->GetVideoInfoTag()->m_iDbId == idSeason && season->GetVideoInfoTag()->m_iIdShow == idShow) { details = *season->GetVideoInfoTag(); + if (item) + *item = *season; return true; } } @@ -2283,7 +2298,7 @@ bool CVideoDatabase::GetMusicVideoInfo(const std::string& strFilenameAndPath, CV return false; } -bool CVideoDatabase::GetSetInfo(int idSet, CVideoInfoTag& details) +bool CVideoDatabase::GetSetInfo(int idSet, CVideoInfoTag& details, CFileItem* item /* = nullptr */) { try { @@ -2299,6 +2314,8 @@ bool CVideoDatabase::GetSetInfo(int idSet, CVideoInfoTag& details) return false; details = *(items[0]->GetVideoInfoTag()); + if (item) + *item = *items[0]; return !details.IsEmpty(); } catch (...) @@ -3822,7 +3839,7 @@ void CVideoDatabase::GetDetailsFromDB(const dbiplus::sql_record* const record, i } } -CVideoInfoTag CVideoDatabase::GetDetailsByTypeAndId(VideoDbContentType type, int id) +bool CVideoDatabase::GetDetailsByTypeAndId(CFileItem& item, VideoDbContentType type, int id) { CVideoInfoTag details; details.Reset(); @@ -3833,7 +3850,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsByTypeAndId(VideoDbContentType type, int GetMovieInfo("", details, id); break; case VideoDbContentType::TVSHOWS: - GetTvShowInfo("", details, id); + GetTvShowInfo("", details, id, &item); break; case VideoDbContentType::EPISODES: GetEpisodeInfo("", details, id); @@ -3842,10 +3859,20 @@ CVideoInfoTag CVideoDatabase::GetDetailsByTypeAndId(VideoDbContentType type, int GetMusicVideoInfo("", details, id); break; default: - break; + return false; } - return details; + item.SetFromVideoInfoTag(details); + return true; +} + +CVideoInfoTag CVideoDatabase::GetDetailsByTypeAndId(VideoDbContentType type, int id) +{ + CFileItem item; + if (GetDetailsByTypeAndId(item, type, id)) + return CVideoInfoTag(*item.GetVideoInfoTag()); + + return {}; } bool CVideoDatabase::GetStreamDetails(CFileItem& item) diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h index 690450a0c9..6c7344567b 100644 --- a/xbmc/video/VideoDatabase.h +++ b/xbmc/video/VideoDatabase.h @@ -513,11 +513,12 @@ public: bool LoadVideoInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int getDetails = VideoDbDetailsAll); bool GetMovieInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idMovie = -1, int getDetails = VideoDbDetailsAll); bool GetTvShowInfo(const std::string& strPath, CVideoInfoTag& details, int idTvShow = -1, CFileItem* item = NULL, int getDetails = VideoDbDetailsAll); + bool GetSeasonInfo(int idSeason, CVideoInfoTag& details, CFileItem* item); bool GetSeasonInfo(int idSeason, CVideoInfoTag& details, bool allDetails = true); bool GetEpisodeBasicInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idEpisode = -1); bool GetEpisodeInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idEpisode = -1, int getDetails = VideoDbDetailsAll); bool GetMusicVideoInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idMVideo = -1, int getDetails = VideoDbDetailsAll); - bool GetSetInfo(int idSet, CVideoInfoTag& details); + bool GetSetInfo(int idSet, CVideoInfoTag& details, CFileItem* item = nullptr); bool GetFileInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idFile = -1); int GetPathId(const std::string& strPath); @@ -653,6 +654,7 @@ public: bool GetResumePoint(CVideoInfoTag& tag); bool GetStreamDetails(CFileItem& item); bool GetStreamDetails(CVideoInfoTag& tag) const; + bool GetDetailsByTypeAndId(CFileItem& item, VideoDbContentType type, int id); CVideoInfoTag GetDetailsByTypeAndId(VideoDbContentType type, int id); // scraper settings @@ -1115,6 +1117,8 @@ private: */ CDateTime GetLastPlayed(int iFileId); + bool GetSeasonInfo(int idSeason, CVideoInfoTag& details, bool allDetails, CFileItem* item); + int GetMinSchemaVersion() const override { return 75; } int GetSchemaVersion() const override; virtual int GetExportVersion() const { return 1; } |