diff options
author | Matthias Kortstiege <mkortstiege@kodi.tv> | 2015-01-13 09:55:57 +0100 |
---|---|---|
committer | Matthias Kortstiege <mkortstiege@kodi.tv> | 2015-01-14 09:12:03 +0100 |
commit | d9e7849ca1414aa8d15aa33849da4de1a67df2a7 (patch) | |
tree | 739409bf673c988a073d72e1a14e4ad180eecf55 | |
parent | 483ceb982738ee68be41ba93d4a3d6f20479ff14 (diff) |
[videodatabase] path hash is not invalidated when removing tv shows or episodes from library
-rw-r--r-- | xbmc/video/VideoDatabase.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index d59cc2f792..00107bac2f 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -2935,6 +2935,9 @@ void CVideoDatabase::DeleteTvShow(int idTvShow, bool bKeepId /* = false */) BeginTransaction(); + set<int> paths; + GetPathsForTvShow(idTvShow, paths); + std::string strSQL=PrepareSQL("SELECT episode.idEpisode FROM episode WHERE episode.idShow=%i",idTvShow); m_pDS2->query(strSQL.c_str()); while (!m_pDS2->eof()) @@ -2954,9 +2957,6 @@ void CVideoDatabase::DeleteTvShow(int idTvShow, bool bKeepId /* = false */) strSQL=PrepareSQL("delete from tvshow where idShow=%i", idTvShow); m_pDS->exec(strSQL.c_str()); - // TODO: why do we invalidate the path hash here?? - set<int> paths; - GetPathsForTvShow(idTvShow, paths); for (set<int>::const_iterator i = paths.begin(); i != paths.end(); ++i) { std::string path = GetSingleValue(PrepareSQL("SELECT strPath FROM path WHERE idPath=%i", *i)); @@ -3039,6 +3039,11 @@ void CVideoDatabase::DeleteEpisode(int idEpisode, bool bKeepId /* = false */) // the ancilliary tables are still purged if (!bKeepId) { + int idFile = GetDbId(PrepareSQL("SELECT idFile FROM episode WHERE idEpisode=%i", idEpisode)); + std::string path = GetSingleValue(PrepareSQL("SELECT strPath FROM path JOIN files ON files.idPath=path.idPath WHERE files.idFile=%i", idFile)); + if (!path.empty()) + InvalidatePathHash(path); + std::string strSQL = PrepareSQL("delete from episode where idEpisode=%i", idEpisode); m_pDS->exec(strSQL.c_str()); } |