From ca92052ad16df9b18d58994de9fd4084354f1291 Mon Sep 17 00:00:00 2001 From: casey langen Date: Sun, 2 Feb 2020 17:04:56 -0800 Subject: [PATCH] Actually maybe for real fix indexer track count events? --- src/core/library/Indexer.cpp | 9 +++------ src/core_c_demo/main.c | 6 +----- src/musikcube/app/layout/MainLayout.cpp | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/core/library/Indexer.cpp b/src/core/library/Indexer.cpp index dcef2ce9e..dc766f0b9 100644 --- a/src/core/library/Indexer.cpp +++ b/src/core/library/Indexer.cpp @@ -404,7 +404,6 @@ void Indexer::ReadMetadataFromFile( INC(track, "album_artist", i); INC(track, "album", i); track.Save(this->dbConnection, this->libraryPath); - this->filesSaved++; } #endif } @@ -429,7 +428,7 @@ inline void Indexer::IncrementTracksScanned(size_t delta) { if (this->incrementalUrisScanned > TRANSACTION_INTERVAL) { this->trackTransaction->CommitAndRestart(); - this->Progress(this->incrementalUrisScanned); + this->Progress(this->totalUrisScanned); this->incrementalUrisScanned = 0; } } @@ -623,9 +622,8 @@ void Indexer::ThreadLoop() { this->dbConnection.Close(); - this->Progress(this->incrementalUrisScanned); - if (!this->Bail()) { + this->Progress(this->totalUrisScanned); this->Finished(this->totalUrisScanned); } @@ -1038,8 +1036,7 @@ void Indexer::CommitProgress(IIndexerSource* source, unsigned updatedTracks) { } if (updatedTracks) { - std::unique_lock lock(IndexerTrack::sharedWriteMutex); - this->Progress((int) updatedTracks); + this->IncrementTracksScanned(updatedTracks); } } diff --git a/src/core_c_demo/main.c b/src/core_c_demo/main.c index c76ce8e36..dafbe9338 100644 --- a/src/core_c_demo/main.c +++ b/src/core_c_demo/main.c @@ -36,16 +36,12 @@ static void sleep_for(const char* tag, int seconds) { } } -static int total_indexer_updated_count = 0; - static void indexer_started_callback(mcsdk_svc_indexer in) { - total_indexer_updated_count = 0; printf("[indexer_started_callback]\n"); } static void indexer_progress_callback(mcsdk_svc_indexer in, int updated_count) { - total_indexer_updated_count += updated_count; - printf("[indexer_progress_callback] %d\n", total_indexer_updated_count); + printf("[indexer_progress_callback] %d\n", updated_count); } static void indexer_finished_callback(mcsdk_svc_indexer in, int total_updated_count) { diff --git a/src/musikcube/app/layout/MainLayout.cpp b/src/musikcube/app/layout/MainLayout.cpp index 9ab96dc05..f05fedd84 100755 --- a/src/musikcube/app/layout/MainLayout.cpp +++ b/src/musikcube/app/layout/MainLayout.cpp @@ -212,7 +212,7 @@ void MainLayout::ProcessMessage(musik::core::runtime::IMessage &message) { this->Layout(); } else if (type == message::IndexerProgress) { - this->syncUpdateCount += (int)message.UserData1(); + this->syncUpdateCount == (int) message.UserData1(); updateSyncingText(this->syncing.get(), this->syncUpdateCount); if (!syncing->IsVisible()) {