Support embedded covers in flac files. fixes #18
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
namespace Database {
|
namespace Database {
|
||||||
|
|
||||||
#define LMS_DATABASE_VERSION 8
|
#define LMS_DATABASE_VERSION 9
|
||||||
|
|
||||||
using Version = std::size_t;
|
using Version = std::size_t;
|
||||||
|
|
||||||
@@ -119,6 +119,12 @@ Session::doDatabaseMigrationIfNeeded()
|
|||||||
_session.execute("DROP TABLE similarity_settings_feature");
|
_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<int>(ScanSettings::SimilarityEngineType::Clusters)) + ")");
|
_session.execute("ALTER TABLE scan_settings ADD similarity_engine_type INTEGER NOT NULL DEFAULT(" + std::to_string(static_cast<int>(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
|
else
|
||||||
{
|
{
|
||||||
LMS_LOG(DB, ERROR) << "Database version " << version << " cannot be handled using migration";
|
LMS_LOG(DB, ERROR) << "Database version " << version << " cannot be handled using migration";
|
||||||
@@ -126,9 +132,9 @@ Session::doDatabaseMigrationIfNeeded()
|
|||||||
}
|
}
|
||||||
|
|
||||||
++version;
|
++version;
|
||||||
}
|
|
||||||
|
|
||||||
VersionInfo::get(*this).modify()->setVersion(LMS_DATABASE_VERSION);
|
VersionInfo::get(*this).modify()->setVersion(LMS_DATABASE_VERSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Session::Session(Db& db)
|
Session::Session(Db& db)
|
||||||
|
|||||||
@@ -19,12 +19,13 @@
|
|||||||
|
|
||||||
#include "TagLibParser.hpp"
|
#include "TagLibParser.hpp"
|
||||||
|
|
||||||
|
#include <taglib/asffile.h>
|
||||||
|
#include <taglib/id3v2tag.h>
|
||||||
#include <taglib/fileref.h>
|
#include <taglib/fileref.h>
|
||||||
|
#include <taglib/flacfile.h>
|
||||||
|
#include <taglib/mpegfile.h>
|
||||||
#include <taglib/tag.h>
|
#include <taglib/tag.h>
|
||||||
#include <taglib/tpropertymap.h>
|
#include <taglib/tpropertymap.h>
|
||||||
#include <taglib/asffile.h>
|
|
||||||
#include <taglib/mpegfile.h>
|
|
||||||
#include <taglib/id3v2tag.h>
|
|
||||||
|
|
||||||
#include "utils/Logger.hpp"
|
#include "utils/Logger.hpp"
|
||||||
#include "utils/Utils.hpp"
|
#include "utils/Utils.hpp"
|
||||||
@@ -179,14 +180,14 @@ TagLibParser::parse(const std::filesystem::path& p, bool debug)
|
|||||||
// Not that good embedded pictures handling
|
// Not that good embedded pictures handling
|
||||||
|
|
||||||
// WMA
|
// WMA
|
||||||
if (TagLib::ASF::File *asfFile {dynamic_cast<TagLib::ASF::File*>(f.file())})
|
if (TagLib::ASF::File* asfFile {dynamic_cast<TagLib::ASF::File*>(f.file())})
|
||||||
{
|
{
|
||||||
const TagLib::ASF::Tag* tag {static_cast<TagLib::ASF::Tag*>(asfFile->tag())};
|
const TagLib::ASF::Tag* tag {asfFile->tag()};
|
||||||
if (tag && tag->attributeListMap().contains("WM/Picture"))
|
if (tag && tag->attributeListMap().contains("WM/Picture"))
|
||||||
track.hasCover = true;
|
track.hasCover = true;
|
||||||
}
|
}
|
||||||
// MP3
|
// MP3
|
||||||
else if (TagLib::MPEG::File *mp3File {dynamic_cast<TagLib::MPEG::File*>(f.file())})
|
else if (TagLib::MPEG::File* mp3File {dynamic_cast<TagLib::MPEG::File*>(f.file())})
|
||||||
{
|
{
|
||||||
if (mp3File->ID3v2Tag())
|
if (mp3File->ID3v2Tag())
|
||||||
{
|
{
|
||||||
@@ -194,6 +195,12 @@ TagLibParser::parse(const std::filesystem::path& p, bool debug)
|
|||||||
track.hasCover = true;
|
track.hasCover = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// FLAC
|
||||||
|
else if (TagLib::FLAC::File* flacFile {dynamic_cast<TagLib::FLAC::File*>(f.file())})
|
||||||
|
{
|
||||||
|
if (!flacFile->pictureList().isEmpty())
|
||||||
|
track.hasCover = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (f.tag())
|
if (f.tag())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user