diff --git a/src/database/Session.cpp b/src/database/Session.cpp index 71f8dbe6..5a3572ba 100644 --- a/src/database/Session.cpp +++ b/src/database/Session.cpp @@ -39,7 +39,7 @@ namespace Database { -#define LMS_DATABASE_VERSION 8 +#define LMS_DATABASE_VERSION 9 using Version = std::size_t; @@ -119,6 +119,12 @@ Session::doDatabaseMigrationIfNeeded() _session.execute("DROP TABLE similarity_settings_feature"); _session.execute("ALTER TABLE scan_settings ADD similarity_engine_type INTEGER NOT NULL DEFAULT(" + std::to_string(static_cast(ScanSettings::SimilarityEngineType::Clusters)) + ")"); } + else if (version == 8) + { + // Better cover handling, need to rescan the whole files + // Just increment the scan version of the settings to make the next scheduled scan rescan everything + ScanSettings::get(*this).modify()->incScanVersion(); + } else { LMS_LOG(DB, ERROR) << "Database version " << version << " cannot be handled using migration"; @@ -126,9 +132,9 @@ Session::doDatabaseMigrationIfNeeded() } ++version; - } - VersionInfo::get(*this).modify()->setVersion(LMS_DATABASE_VERSION); + VersionInfo::get(*this).modify()->setVersion(LMS_DATABASE_VERSION); + } } Session::Session(Db& db) diff --git a/src/metadata/TagLibParser.cpp b/src/metadata/TagLibParser.cpp index 67af8b1e..a2151c27 100644 --- a/src/metadata/TagLibParser.cpp +++ b/src/metadata/TagLibParser.cpp @@ -19,12 +19,13 @@ #include "TagLibParser.hpp" +#include +#include #include +#include +#include #include #include -#include -#include -#include #include "utils/Logger.hpp" #include "utils/Utils.hpp" @@ -179,14 +180,14 @@ TagLibParser::parse(const std::filesystem::path& p, bool debug) // Not that good embedded pictures handling // WMA - if (TagLib::ASF::File *asfFile {dynamic_cast(f.file())}) + if (TagLib::ASF::File* asfFile {dynamic_cast(f.file())}) { - const TagLib::ASF::Tag* tag {static_cast(asfFile->tag())}; + const TagLib::ASF::Tag* tag {asfFile->tag()}; if (tag && tag->attributeListMap().contains("WM/Picture")) track.hasCover = true; } // MP3 - else if (TagLib::MPEG::File *mp3File {dynamic_cast(f.file())}) + else if (TagLib::MPEG::File* mp3File {dynamic_cast(f.file())}) { if (mp3File->ID3v2Tag()) { @@ -194,6 +195,12 @@ TagLibParser::parse(const std::filesystem::path& p, bool debug) track.hasCover = true; } } + // FLAC + else if (TagLib::FLAC::File* flacFile {dynamic_cast(f.file())}) + { + if (!flacFile->pictureList().isEmpty()) + track.hasCover = true; + } if (f.tag()) {