Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed: let the video info scanner handle the database cleanup (clos…

…es #10527)
  • Loading branch information...
commit ddb0d8303b137d4f7541e60a1d9344f9678f65fc 1 parent ae2ecf1
vdrfan authored
View
8 xbmc/Application.cpp
@@ -5464,6 +5464,14 @@ void CApplication::StopMusicScan()
m_musicInfoScanner->Stop();
}
+void CApplication::StartVideoCleanup()
+{
+ if (m_videoInfoScanner->IsScanning())
+ return;
+
+ m_videoInfoScanner->CleanDatabase();
+}
+
void CApplication::StartVideoScan(const CStdString &strDirectory, bool scanAll)
{
if (m_videoInfoScanner->IsScanning())
View
2  xbmc/Application.h
@@ -224,6 +224,8 @@ class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMs
bool IsMusicScanning() const;
bool IsVideoScanning() const;
+ void StartVideoCleanup();
+
void StartVideoScan(const CStdString &path, bool scanAll = false);
void StartMusicScan(const CStdString &path);
void StartMusicAlbumScan(const CStdString& strDirectory, bool refresh=false);
View
9 xbmc/interfaces/Builtins.cpp
@@ -1233,14 +1233,9 @@ int CBuiltins::Execute(const CStdString& execString)
if (!params.size() || params[0].Equals("video"))
{
if (!g_application.IsVideoScanning())
- {
- CVideoDatabase videodatabase;
- videodatabase.Open();
- videodatabase.CleanDatabase();
- videodatabase.Close();
- }
+ g_application.StartVideoCleanup();
else
- CLog::Log(LOGERROR, "XBMC.CleanLibrary is not possible while scanning for media info");
+ CLog::Log(LOGERROR, "XBMC.CleanLibrary is not possible while scanning or cleaning");
}
else if (params[0].Equals("music"))
{
View
7 xbmc/settings/GUIWindowSettingsCategory.cpp
@@ -1088,12 +1088,7 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC
else if (strSetting.Equals("videolibrary.cleanup"))
{
if (CGUIDialogYesNo::ShowAndGetInput(313, 333, 0, 0))
- {
- CVideoDatabase videodatabase;
- videodatabase.Open();
- videodatabase.CleanDatabase();
- videodatabase.Close();
- }
+ g_application.StartVideoCleanup();
}
else if (strSetting.Equals("videolibrary.export"))
CBuiltins::Execute("exportlibrary(video)");
View
11 xbmc/video/VideoInfoScanner.cpp
@@ -114,7 +114,7 @@ namespace VIDEO
if (!bCancelled)
{
if (m_bClean)
- m_database.CleanDatabase(m_pObserver,&m_pathsToClean);
+ CleanDatabase(m_pObserver,&m_pathsToClean);
else
{
if (m_pObserver)
@@ -177,6 +177,15 @@ namespace VIDEO
StopThread();
}
+ void CVideoInfoScanner::CleanDatabase(IVideoInfoScannerObserver* pObserver /*= NULL */, const set<int>* paths /*= NULL */)
+ {
+ m_bRunning = true;
+ m_database.Open();
+ m_database.CleanDatabase(pObserver, paths);
+ m_database.Close();
+ m_bRunning = false;
+ }
+
void CVideoInfoScanner::SetObserver(IVideoInfoScannerObserver* pObserver)
{
m_pObserver = pObserver;
View
1  xbmc/video/VideoInfoScanner.h
@@ -88,6 +88,7 @@ namespace VIDEO
*/
void Start(const CStdString& strDirectory, bool scanAll = false);
bool IsScanning();
+ void CleanDatabase(IVideoInfoScannerObserver* pObserver=NULL, const std::set<int>* paths=NULL);
void Stop();
void SetObserver(IVideoInfoScannerObserver* pObserver);
Please sign in to comment.
Something went wrong with that request. Please try again.