Merge branch 'scanner-shutdown' into db-locks
This commit is contained in:
@@ -26,30 +26,32 @@
|
||||
|
||||
namespace Scanner
|
||||
{
|
||||
void
|
||||
ScanStepCheckDuplicatedDbFiles::process(ScanContext& context)
|
||||
{
|
||||
using namespace Database;
|
||||
void ScanStepCheckDuplicatedDbFiles::process(ScanContext& context)
|
||||
{
|
||||
using namespace Database;
|
||||
|
||||
if (_abortScan)
|
||||
return;
|
||||
if (_abortScan)
|
||||
return;
|
||||
|
||||
Session& session {_db.getTLSSession()};
|
||||
auto transaction {session.createReadTransaction()};
|
||||
|
||||
const RangeResults<TrackId> tracks = Track::findIdsTrackMBIDDuplicates(session);
|
||||
for (const TrackId trackId : tracks.results)
|
||||
{
|
||||
const Track::pointer track {Track::find(session, trackId)};
|
||||
if (auto trackMBID {track->getTrackMBID()})
|
||||
{
|
||||
LMS_LOG(DBUPDATER, INFO) << "Found duplicated track MBID [" << trackMBID->getAsString() << "], file: " << track->getPath().string() << " - " << track->getName();
|
||||
context.stats.duplicates.emplace_back(ScanDuplicate {track->getId(), DuplicateReason::SameTrackMBID});
|
||||
context.currentStepStats.processedElems++;
|
||||
_progressCallback(context.currentStepStats);
|
||||
}
|
||||
}
|
||||
const RangeResults<TrackId> tracks = Track::findIdsTrackMBIDDuplicates(session);
|
||||
for (const TrackId trackId : tracks.results)
|
||||
{
|
||||
if (_abortScan)
|
||||
break;
|
||||
|
||||
LMS_LOG(DBUPDATER, DEBUG) << "Found " << context.currentStepStats.processedElems << " duplicated audio files";
|
||||
}
|
||||
const Track::pointer track{ Track::find(session, trackId) };
|
||||
if (auto trackMBID{ track->getTrackMBID() })
|
||||
{
|
||||
LMS_LOG(DBUPDATER, INFO) << "Found duplicated track MBID [" << trackMBID->getAsString() << "], file: " << track->getPath().string() << " - " << track->getName();
|
||||
context.stats.duplicates.emplace_back(ScanDuplicate{ track->getId(), DuplicateReason::SameTrackMBID });
|
||||
context.currentStepStats.processedElems++;
|
||||
_progressCallback(context.currentStepStats);
|
||||
}
|
||||
}
|
||||
|
||||
LMS_LOG(DBUPDATER, DEBUG) << "Found " << context.currentStepStats.processedElems << " duplicated audio files";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user