Subsonic API: getCoverArt: serve raw image if size is not provided

This commit is contained in:
emeric
2024-12-07 18:27:01 +01:00
parent 350e213529
commit def4d8c3e3
25 changed files with 305 additions and 372 deletions
@@ -20,6 +20,7 @@
#pragma once
#include <atomic>
#include <optional>
#include <shared_mutex>
#include <unordered_map>
#include <variant>
@@ -40,7 +41,7 @@ namespace lms::cover
{
using VariantType = std::variant<db::ArtistId, db::ReleaseId, db::TrackId>;
VariantType id;
std::size_t size;
std::optional<std::size_t> size;
bool operator==(const EntryDesc& other) const = default;
};
@@ -60,7 +61,8 @@ namespace lms::cover
{
std::size_t operator()(const EntryDesc& entry) const
{
return std::hash<EntryDesc::VariantType>{}(entry.id) ^ std::hash<std::size_t>{}(entry.size);
assert(entry.size); // should not cache unresized images
return std::hash<EntryDesc::VariantType>{}(entry.id) ^ std::hash<std::size_t>{}(*entry.size);
}
};