From 91bec7604e04db52437cd7fc9853f6bf37dce4a5 Mon Sep 17 00:00:00 2001 From: CrystalP Date: Thu, 18 Apr 2024 09:59:15 -0400 Subject: [videodb] Remove redundant deletion of stream details when setting movie details SetStreamDetailsForFileId clears existing details unconditionnally, then adds the new ones. Added doxygen. --- xbmc/video/VideoDatabase.cpp | 9 +-------- xbmc/video/VideoDatabase.h | 5 +++++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 432135b41c..4d09ed4553 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -2623,16 +2623,9 @@ int CVideoDatabase::SetDetailsForMovie(CVideoInfoTag& details, if (idMovie < 0) idMovie = GetMovieId(filePath); - if (idMovie > -1) - { - const int idFile{GetDbId(PrepareSQL("SELECT idFile FROM movie WHERE idMovie=%i", idMovie))}; - DeleteStreamDetails(idFile); - } - else + if (idMovie == -1) { // only add a new movie if we don't already have a valid idMovie - // (DeleteMovie is called with bKeepId == true so the movie won't - // be removed from the movie table) idMovie = AddNewMovie(details); if (idMovie < 0) { diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h index 59d7dc5f9e..d5db8f459b 100644 --- a/xbmc/video/VideoDatabase.h +++ b/xbmc/video/VideoDatabase.h @@ -591,6 +591,11 @@ public: const std::map& artwork, int idMVideo = -1); int SetStreamDetailsForFile(const CStreamDetails& details, const std::string& strFileNameAndPath); + /*! + * \brief Clear any existing stream details and add the new provided details to a file. + * \param[in] details New stream details + * \param[in] idFile Identifier of the file + */ void SetStreamDetailsForFileId(const CStreamDetails& details, int idFile); bool SetSingleValue(VideoDbContentType type, int dbId, int dbField, const std::string& strValue); -- cgit v1.2.3