aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmarshallnz <jcmarsha@gmail.com>2011-05-29 13:53:42 -0700
committerjmarshallnz <jcmarsha@gmail.com>2011-05-29 13:53:42 -0700
commitd532ea527fe9f5f25b08e42471b7931c10856ded (patch)
tree9a876776526fa342b7d8296c59017f3926cd535d
parentd692e0279bb2964f9853bab92419d17f104c4d39 (diff)
parent691f252ca360aa599c7c47a7691c881cc76ebcc6 (diff)
Merge pull request #116 from IronTetsubo/master
Some path entries were left in the videodb on clean - fixes #11465
-rw-r--r--xbmc/video/VideoDatabase.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp
index 4eb0111302..a97cb36d3e 100644
--- a/xbmc/video/VideoDatabase.cpp
+++ b/xbmc/video/VideoDatabase.cpp
@@ -6387,6 +6387,16 @@ void CVideoDatabase::CleanDatabase(IVideoInfoScannerObserver* pObserver, const v
}
m_pDS->close();
+ // Add any files that don't have a valid idPath entry to the filesToDelete list.
+ sql = "select files.idFile from files where idPath not in (select idPath from path)";
+ m_pDS->exec(sql.c_str());
+ while (!m_pDS->eof())
+ {
+ filesToDelete += m_pDS->fv("files.idFile").get_asString() + ",";
+ m_pDS->next();
+ }
+ m_pDS->close();
+
if ( ! filesToDelete.IsEmpty() )
{
filesToDelete.TrimRight(",");
@@ -6525,6 +6535,7 @@ void CVideoDatabase::CleanDatabase(IVideoInfoScannerObserver* pObserver, const v
strIds.Format("%s %i,",strIds.Mid(0),m_pDS->fv("path.idPath").get_asInt()); // mid since we cannot format the same string
m_pDS->next();
}
+ m_pDS->close();
if (!strIds.IsEmpty())
{
strIds.TrimLeft(" ");
@@ -6534,6 +6545,8 @@ void CVideoDatabase::CleanDatabase(IVideoInfoScannerObserver* pObserver, const v
sql = PrepareSQL("delete from tvshowlinkpath where idPath in (%s)",strIds.c_str());
m_pDS->exec(sql.c_str());
}
+ sql = "delete from tvshowlinkpath where idPath not in (select idPath from path)";
+ m_pDS->exec(sql.c_str());
CLog::Log(LOGDEBUG, "%s: Cleaning tvshow table", __FUNCTION__);
sql = "delete from tvshow where idShow not in (select idShow from tvshowlinkpath)";