diff --git a/approot/messages.xml b/approot/messages.xml index 2b203b94..7c8d693f 100644 --- a/approot/messages.xml +++ b/approot/messages.xml @@ -24,7 +24,7 @@ Monthly Never Media root directory -Scan complete: {1} total files, {2} additions, {3} deletions, {4} duplicates, {5} errors +Scan complete: {1} total files, {2} additions, {3} updates, {4} deletions, {5} duplicates, {6} errors Scan launched! Scan options New settings saved! diff --git a/src/database/ScanSettings.cpp b/src/database/ScanSettings.cpp index e265c956..19e251f2 100644 --- a/src/database/ScanSettings.cpp +++ b/src/database/ScanSettings.cpp @@ -80,10 +80,6 @@ ScanSettings::setClusterTypes(const std::set& clusterTypeNames) bool needRescan = false; assert(session()); - // Backup the old list - std::vector oldClusterTypes(_clusterTypes.begin(), _clusterTypes.end()); - - _clusterTypes.clear(); // Create any missing cluster type for (auto clusterTypeName : clusterTypeNames) { @@ -98,13 +94,13 @@ ScanSettings::setClusterTypes(const std::set& clusterTypeNames) } // Delete no longer existing cluster types - for (auto oldClusterType : oldClusterTypes) + for (auto clusterType : _clusterTypes) { if (std::none_of(clusterTypeNames.begin(), clusterTypeNames.end(), - [oldClusterType](const std::string& name) { return name == oldClusterType->getName(); })) + [clusterType](const std::string& name) { return name == clusterType->getName(); })) { - LMS_LOG(DB, INFO) << "Deleting cluster type " << oldClusterType->getName(); - oldClusterType.remove(); + LMS_LOG(DB, INFO) << "Deleting cluster type " << clusterType->getName(); + clusterType.remove(); needRescan = true; } } diff --git a/src/scanner/MediaScanner.cpp b/src/scanner/MediaScanner.cpp index 6e5d0f83..f2bcf716 100644 --- a/src/scanner/MediaScanner.cpp +++ b/src/scanner/MediaScanner.cpp @@ -345,6 +345,8 @@ MediaScanner::refreshScanSettings() auto scanSettings = ScanSettings::get(_db.getSession()); + LMS_LOG(DBUPDATER, INFO) << "Using scan settings version " << scanSettings->getScanVersion(); + _scanVersion = scanSettings->getScanVersion(); _startTime = scanSettings->getUpdateStartTime(); _updatePeriod = scanSettings->getUpdatePeriod(); @@ -607,21 +609,18 @@ checkFile(const boost::filesystem::path& p, boost::filesystem::path mediaDirecto if (!boost::filesystem::exists( p ) || !boost::filesystem::is_regular( p ) ) { - LMS_LOG(DBUPDATER, INFO) << "Missing file '" << p.string() << "'"; + LMS_LOG(DBUPDATER, INFO) << "Removing '" << p.string() << "': missing"; status = false; } - else + else if (!isPathInParentPath(p, mediaDirectory)) { - if (!isPathInParentPath(p, mediaDirectory)) - { - LMS_LOG(DBUPDATER, INFO) << "File '" << p.string() << "' is out of media directory '"; - status = false; - } - else if (!isFileSupported(p, extensions)) - { - LMS_LOG(DBUPDATER, INFO) << "File format no longer supported for '" << p.string() << "'"; - status = false; - } + LMS_LOG(DBUPDATER, INFO) << "Removing '" << p.string() << "': out of media directory"; + status = false; + } + else if (!isFileSupported(p, extensions)) + { + LMS_LOG(DBUPDATER, INFO) << "Removing '" << p.string() << "': file format no longer handled"; + status = false; } return status; @@ -632,7 +631,6 @@ checkFile(const boost::filesystem::path& p, boost::filesystem::path mediaDirecto LMS_LOG(DBUPDATER, ERROR) << "Caught exception while checking file '" << p.string() << "': " << e.what(); return false; } - } void diff --git a/src/ui/LmsApplication.cpp b/src/ui/LmsApplication.cpp index 1cc95977..41295e9b 100644 --- a/src/ui/LmsApplication.cpp +++ b/src/ui/LmsApplication.cpp @@ -401,6 +401,7 @@ LmsApplication::handleAuthEvent(void) notifyMsg(Wt::WString::tr("Lms.Admin.Database.scan-complete") .arg(static_cast(stats.nbFiles())) .arg(static_cast(stats.additions)) + .arg(static_cast(stats.updates)) .arg(static_cast(stats.deletions)) .arg(static_cast(stats.nbDuplicates())) .arg(static_cast(stats.nbErrors())));