diff options
author | ksooo <3226626+ksooo@users.noreply.github.com> | 2023-12-27 22:54:37 +0100 |
---|---|---|
committer | ksooo <3226626+ksooo@users.noreply.github.com> | 2023-12-28 21:41:16 +0100 |
commit | 77a70c2024ec2fdf481aad6f76c4b73c542a884f (patch) | |
tree | 6e2bfbd40d274c7a5597677993e8ee98c6c7935c | |
parent | 90c2a2f7e23895e4e3484763b82511f5f744ddd3 (diff) |
[video] Video versions/extras: Change version/extra type selection dialog to show only the types for the respective asset type.
-rw-r--r-- | xbmc/video/VideoDatabase.cpp | 9 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.h | 4 | ||||
-rw-r--r-- | xbmc/video/dialogs/GUIDialogVideoManager.cpp | 7 | ||||
-rw-r--r-- | xbmc/video/dialogs/GUIDialogVideoManager.h | 2 | ||||
-rw-r--r-- | xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp | 4 |
5 files changed, 16 insertions, 10 deletions
diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index b10785f742..a722eb1739 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -12385,7 +12385,9 @@ bool CVideoDatabase::GetVideoVersionsNav(const std::string& strBaseDir, return false; } -bool CVideoDatabase::GetVideoVersionTypes(VideoDbContentType idContent, CFileItemList& items) +bool CVideoDatabase::GetVideoVersionTypes(VideoDbContentType idContent, + VideoAssetType assetType, + CFileItemList& items) { if (!m_pDB || !m_pDS) return false; @@ -12402,8 +12404,9 @@ bool CVideoDatabase::GetVideoVersionTypes(VideoDbContentType idContent, CFileIte try { m_pDS->query( - PrepareSQL("SELECT name, id FROM videoversiontype WHERE name != '' and owner IN (%i, %i)", - VideoAssetTypeOwner::SYSTEM, VideoAssetTypeOwner::USER)); + PrepareSQL("SELECT name, id FROM videoversiontype WHERE name != '' AND itemType = %i " + "AND owner IN (%i, %i)", + assetType, VideoAssetTypeOwner::SYSTEM, VideoAssetTypeOwner::USER)); while (!m_pDS->eof()) { diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h index d985cda163..e2de635a1a 100644 --- a/xbmc/video/VideoDatabase.h +++ b/xbmc/video/VideoDatabase.h @@ -1025,7 +1025,9 @@ public: CFileItem& item); void RemoveVideoVersion(int dbId); bool IsDefaultVideoVersion(int idFile); - bool GetVideoVersionTypes(VideoDbContentType idContent, CFileItemList& items); + bool GetVideoVersionTypes(VideoDbContentType idContent, + VideoAssetType asset, + CFileItemList& items); void SetVideoVersionDefaultArt(int dbId, int idFrom, VideoDbContentType type); void InitializeVideoVersionTypeTable(int schemaVersion); void UpdateVideoVersionTypeTable(); diff --git a/xbmc/video/dialogs/GUIDialogVideoManager.cpp b/xbmc/video/dialogs/GUIDialogVideoManager.cpp index bd4f0a8001..7d12fb429e 100644 --- a/xbmc/video/dialogs/GUIDialogVideoManager.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoManager.cpp @@ -310,7 +310,7 @@ void CGUIDialogVideoManager::Remove() void CGUIDialogVideoManager::Rename() { - const int idAsset{ChooseVideoAsset(m_videoAsset)}; + const int idAsset{ChooseVideoAsset(m_videoAsset, GetVideoAssetType())}; if (idAsset != -1) { //! @todo db refactor: should not be version, but asset @@ -338,7 +338,8 @@ void CGUIDialogVideoManager::SetSelectedVideoAsset(const std::shared_ptr<CFileIt UpdateControls(); } -int CGUIDialogVideoManager::ChooseVideoAsset(const std::shared_ptr<CFileItem>& item) +int CGUIDialogVideoManager::ChooseVideoAsset(const std::shared_ptr<CFileItem>& item, + VideoAssetType assetType) { if (!item || !item->HasVideoInfoTag()) return -1; @@ -364,7 +365,7 @@ int CGUIDialogVideoManager::ChooseVideoAsset(const std::shared_ptr<CFileItem>& i //! @todo db refactor: should not be version, but asset CFileItemList list; - videodb.GetVideoVersionTypes(itemType, list); + videodb.GetVideoVersionTypes(itemType, assetType, list); int assetId{-1}; while (true) diff --git a/xbmc/video/dialogs/GUIDialogVideoManager.h b/xbmc/video/dialogs/GUIDialogVideoManager.h index deaca666da..e2c2ffebd2 100644 --- a/xbmc/video/dialogs/GUIDialogVideoManager.h +++ b/xbmc/video/dialogs/GUIDialogVideoManager.h @@ -50,7 +50,7 @@ protected: void UpdateControls(); - static int ChooseVideoAsset(const std::shared_ptr<CFileItem>& item); + static int ChooseVideoAsset(const std::shared_ptr<CFileItem>& item, VideoAssetType assetType); CVideoDatabase m_database; std::shared_ptr<CFileItem> m_videoAsset; diff --git a/xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp b/xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp index e8d20a5867..c897dcc6c0 100644 --- a/xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoManagerVersions.cpp @@ -265,7 +265,7 @@ void CGUIDialogVideoManagerVersions::AddVideoVersion() CURL::GetRedacted(item.GetPath())); } - const int idNewVideoVersion{ChooseVideoAsset(m_videoAsset)}; + const int idNewVideoVersion{ChooseVideoAsset(m_videoAsset, VideoAssetType::VERSION)}; if (idNewVideoVersion != -1) m_database.AddPrimaryVideoVersion(itemType, dbId, idNewVideoVersion, item); @@ -409,7 +409,7 @@ bool CGUIDialogVideoManagerVersions::ChooseVideoAndConvertToVideoVersion( return false; // choose a video version for the video - const int idVideoVersion{ChooseVideoAsset(selectedItem)}; + const int idVideoVersion{ChooseVideoAsset(selectedItem, VideoAssetType::VERSION)}; if (idVideoVersion < 0) return false; |