From 88b1759f58ffa9c2fa12c918bd67c65085a4830b Mon Sep 17 00:00:00 2001 From: arnova Date: Tue, 2 Jul 2019 20:19:53 +0200 Subject: [PATCH] changed: Delete stream details when video info is refreshed --- xbmc/video/VideoDatabase.cpp | 2 +- xbmc/video/VideoDatabase.h | 2 +- xbmc/video/windows/GUIWindowVideoBase.cpp | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 4c314b632ec22..ddd80a267bda7 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -3621,7 +3621,7 @@ int CVideoDatabase::GetDbId(const std::string &query) void CVideoDatabase::DeleteStreamDetails(int idFile) { - m_pDS->exec(PrepareSQL("delete from streamdetails where idFile=%i", idFile)); + m_pDS->exec(PrepareSQL("DELETE FROM streamdetails WHERE idFile = %i", idFile)); } void CVideoDatabase::DeleteSet(int idSet) diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h index addc77e798e23..6297327140269 100644 --- a/xbmc/video/VideoDatabase.h +++ b/xbmc/video/VideoDatabase.h @@ -550,6 +550,7 @@ class CVideoDatabase : public CDatabase void DeleteMusicVideo(const std::string& strFilenameAndPath, bool bKeepId = false); void DeleteDetailsForTvShow(int idTvShow); void DeleteDetailsForTvShow(const std::string& strPath); + void DeleteStreamDetails(int idFile); void RemoveContentForPath(const std::string& strPath,CGUIDialogProgress *progress = NULL); void UpdateFanart(const CFileItem &item, VIDEODB_CONTENT_TYPE type); void DeleteSet(int idSet); @@ -929,7 +930,6 @@ class CVideoDatabase : public CDatabase void AddCast(int mediaId, const char *mediaType, const std::vector &cast); - void DeleteStreamDetails(int idFile); CVideoInfoTag GetDetailsForMovie(std::unique_ptr &pDS, int getDetails = VideoDbDetailsNone); CVideoInfoTag GetDetailsForMovie(const dbiplus::sql_record* const record, int getDetails = VideoDbDetailsNone); CVideoInfoTag GetDetailsForTvShow(std::unique_ptr &pDS, int getDetails = VideoDbDetailsNone, CFileItem* item = NULL); diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp index 83f3b5f91f0f0..886ea364fbe5f 100644 --- a/xbmc/video/windows/GUIWindowVideoBase.cpp +++ b/xbmc/video/windows/GUIWindowVideoBase.cpp @@ -378,6 +378,22 @@ bool CGUIWindowVideoBase::ShowIMDB(CFileItemPtr item, const ScraperPtr &info2, b item->SetPath(item->GetVideoInfoTag()->GetPath()); } } + + if (needsRefresh) + { + // Delete stream details (=media flags). This allows users to force + // a refresh of the stream details by performing a video info refresh + const int fileId = item->GetVideoInfoTag()->m_iFileId; + if (fileId > 0) + { + CVideoDatabase db; + if (db.Open()) + { + db.DeleteStreamDetails(fileId); + db.Close(); + } + } + } const std::shared_ptr profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager();