Changed the way album covers are associated, fixes #503

This commit is contained in:
emeric
2024-09-29 16:21:46 +02:00
parent 4e1b422e31
commit 3f6177cedd
31 changed files with 502 additions and 231 deletions
@@ -20,7 +20,6 @@
#pragma once
#include <filesystem>
#include <map>
#include <vector>
#include "database/Types.hpp"
@@ -59,14 +58,11 @@ namespace lms::cover
std::shared_ptr<image::IEncodedImage> getFromTrack(db::Session& dbSession, db::TrackId trackId, image::ImageSize width, bool allowReleaseFallback);
std::unique_ptr<image::IEncodedImage> getFromAvMediaFile(const av::IAudioFile& input, image::ImageSize width) const;
std::unique_ptr<image::IEncodedImage> getFromCoverFile(const std::filesystem::path& p, image::ImageSize width) const;
std::unique_ptr<image::IEncodedImage> getFromImageFile(const std::filesystem::path& p, image::ImageSize width) const;
std::unique_ptr<image::IEncodedImage> getFromTrack(const std::filesystem::path& path, image::ImageSize width) const;
std::multimap<std::string, std::filesystem::path> getCoverPaths(const std::filesystem::path& directoryPath) const;
std::unique_ptr<image::IEncodedImage> getFromDirectory(const std::filesystem::path& directory, image::ImageSize width, const std::vector<std::string>& preferredFileNames, bool allowPickRandom) const;
std::unique_ptr<image::IEncodedImage> getFromSameNamedFile(const std::filesystem::path& filePath, image::ImageSize width) const;
bool checkCoverFile(const std::filesystem::path& filePath) const;
bool checkImageFile(const std::filesystem::path& filePath) const;
db::Db& _db;
@@ -74,8 +70,6 @@ namespace lms::cover
std::shared_ptr<image::IEncodedImage> _defaultCover;
static inline const std::vector<std::filesystem::path> _fileExtensions{ ".jpg", ".jpeg", ".png", ".bmp" }; // TODO parametrize
const std::size_t _maxFileSize;
const std::vector<std::string> _preferredFileNames;
unsigned _jpegQuality;
};