Prevent the media scanner from never quitting

This commit is contained in:
emeric
2019-06-13 14:29:39 +02:00
parent c288e439b3
commit 08988b17a2
6 changed files with 66 additions and 28 deletions
+12
View File
@@ -420,7 +420,10 @@ MediaScanner::scan(boost::system::error_code err)
{
for (auto& addon : _addons)
addon->preScanComplete();
}
if (_running)
{
stats.stopTime = Wt::WLocalDateTime::currentDateTime().toUTC();
{
std::unique_lock<std::mutex> lock {_statusMutex};
@@ -471,6 +474,13 @@ MediaScanner::refreshScanSettings()
addon->refreshSettings();
}
void MediaScanner::notifyInProgress(Stats& stats)
{
std::chrono::system_clock::time_point now {std::chrono::system_clock::now()};
_sigScanInProgress(stats);
_lastScanInProgressEmit = now;
}
void MediaScanner::notifyInProgressIfNeeded(Stats& stats)
{
std::chrono::system_clock::time_point now {std::chrono::system_clock::now()};
@@ -674,6 +684,8 @@ MediaScanner::scanMediaDirectory(boost::filesystem::path mediaDirectory, bool fo
itPath.increment(ec);
}
notifyInProgress(stats);
}
// Check if a file exists and is still in a media directory