From d4ce4e8eb54af34ff6841e1db6265308c5ade439 Mon Sep 17 00:00:00 2001 From: casey langen Date: Wed, 1 Jul 2020 14:14:16 -0700 Subject: [PATCH] Indexer logging, when enabled, will now be far more verbose. --- src/core/library/Indexer.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/core/library/Indexer.cpp b/src/core/library/Indexer.cpp index 4ac52a593..39801ae0c 100644 --- a/src/core/library/Indexer.cpp +++ b/src/core/library/Indexer.cpp @@ -350,11 +350,17 @@ void Indexer::ReadMetadataFromFile( const boost::filesystem::path& file, const std::string& pathId) { + #define APPEND_LOG(x) if (logFile) { fprintf(logFile, " - ["##x"] %s\n", file.string().c_str()); } + musik::core::IndexerTrack track(0); TagStore* store = nullptr; + bool needsToBeIndexed = track.NeedsToBeIndexed(file, this->dbConnection); + /* get cached filesize, parts, size, etc */ - if (track.NeedsToBeIndexed(file, this->dbConnection)) { + if (needsToBeIndexed) { + APPEND_LOG("needs to be indexed") + bool saveToDb = false; /* read the tag from the plugin */ @@ -364,11 +370,9 @@ void Indexer::ReadMetadataFromFile( while (it != this->tagReaders.end()) { try { if ((*it)->CanRead(track.GetString("extension").c_str())) { - if (logFile) { - fprintf(logFile, " - %s\n", file.string().c_str()); - } - + APPEND_LOG("can read") if ((*it)->Read(file.string().c_str(), store)) { + APPEND_LOG("did read") saveToDb = true; break; } @@ -406,7 +410,15 @@ void Indexer::ReadMetadataFromFile( } #endif } + else { + APPEND_LOG("read failed") + } } + else { + APPEND_LOG("does not need to be indexed") + } + + #undef APPEND_LOG if (store) { store->Release();