More details for scan error reports #676
This commit is contained in:
@@ -30,8 +30,8 @@
|
||||
#include "database/Session.hpp"
|
||||
#include "database/Track.hpp"
|
||||
#include "database/TrackLyrics.hpp"
|
||||
#include "scanners/IFileScanner.hpp"
|
||||
|
||||
#include "ScanContext.hpp"
|
||||
#include "ScannerSettings.hpp"
|
||||
|
||||
namespace lms::scanner
|
||||
@@ -62,22 +62,15 @@ namespace lms::scanner
|
||||
}
|
||||
LMS_LOG(DBUPDATER, DEBUG, context.currentStepStats.totalElems << " files to be checked...");
|
||||
|
||||
std::vector<std::filesystem::path> supportedFileExtensions;
|
||||
for (IFileScanner* scanner : _fileScanners)
|
||||
{
|
||||
for (const std::filesystem::path& extension : scanner->getSupportedExtensions())
|
||||
supportedFileExtensions.emplace_back(extension);
|
||||
}
|
||||
|
||||
checkForRemovedFiles<db::Track>(context, supportedFileExtensions);
|
||||
checkForRemovedFiles<db::Image>(context, supportedFileExtensions);
|
||||
checkForRemovedFiles<db::TrackLyrics>(context, supportedFileExtensions);
|
||||
checkForRemovedFiles<db::PlayListFile>(context, supportedFileExtensions);
|
||||
checkForRemovedFiles<db::ArtistInfo>(context, supportedFileExtensions);
|
||||
checkForRemovedFiles<db::Track>(context);
|
||||
checkForRemovedFiles<db::Image>(context);
|
||||
checkForRemovedFiles<db::TrackLyrics>(context);
|
||||
checkForRemovedFiles<db::PlayListFile>(context);
|
||||
checkForRemovedFiles<db::ArtistInfo>(context);
|
||||
}
|
||||
|
||||
template<typename Object>
|
||||
void ScanStepCheckForRemovedFiles::checkForRemovedFiles(ScanContext& context, std::span<const std::filesystem::path> supportedFileExtensions)
|
||||
void ScanStepCheckForRemovedFiles::checkForRemovedFiles(ScanContext& context)
|
||||
{
|
||||
using namespace db;
|
||||
|
||||
@@ -110,7 +103,7 @@ namespace lms::scanner
|
||||
return;
|
||||
}
|
||||
|
||||
if (!checkFile(object->getAbsoluteFilePath(), supportedFileExtensions))
|
||||
if (!checkFile(object->getAbsoluteFilePath()))
|
||||
objectsToRemove.push_back(object);
|
||||
|
||||
context.currentStepStats.processedElems++;
|
||||
@@ -132,7 +125,7 @@ namespace lms::scanner
|
||||
}
|
||||
}
|
||||
|
||||
bool ScanStepCheckForRemovedFiles::checkFile(const std::filesystem::path& p, std::span<const std::filesystem::path> allowedExtensions)
|
||||
bool ScanStepCheckForRemovedFiles::checkFile(const std::filesystem::path& p)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -140,7 +133,7 @@ namespace lms::scanner
|
||||
// and still belongs to a media directory
|
||||
if (!std::filesystem::exists(p) || !std::filesystem::is_regular_file(p))
|
||||
{
|
||||
LMS_LOG(DBUPDATER, DEBUG, "Removing '" << p.string() << "': missing");
|
||||
LMS_LOG(DBUPDATER, DEBUG, "Removing " << p << ": missing");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -149,13 +142,13 @@ namespace lms::scanner
|
||||
return core::pathUtils::isPathInRootPath(p, libraryInfo.rootDirectory, &excludeDirFileName);
|
||||
}))
|
||||
{
|
||||
LMS_LOG(DBUPDATER, DEBUG, "Removing '" << p.string() << "': out of media directory");
|
||||
LMS_LOG(DBUPDATER, DEBUG, "Removing " << p << ": out of media directory");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!core::pathUtils::hasFileAnyExtension(p, allowedExtensions))
|
||||
if (!selectFileScanner(p))
|
||||
{
|
||||
LMS_LOG(DBUPDATER, DEBUG, "Removing '" << p.string() << "': file format no longer handled");
|
||||
LMS_LOG(DBUPDATER, DEBUG, "Removing " << p.string() << ": file format no longer handled");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user