Factorized some container/codec handling code + removed the no longer needed transcode output formats mka and webm

This commit is contained in:
emeric
2025-11-30 18:48:04 +01:00
parent c3cd30f248
commit d834f34683
65 changed files with 1424 additions and 1003 deletions
+11 -2
View File
@@ -40,6 +40,7 @@
#include "SqlQuery.hpp"
#include "Utils.hpp"
#include "detail/Types.hpp"
#include "traits/EnumSetTraits.hpp"
#include "traits/IdTypeTraits.hpp"
#include "traits/PartialDateTimeTraits.hpp"
@@ -679,12 +680,20 @@ namespace lms::db
return utils::fetchQuerySingleResult(session()->query<int>("SELECT COALESCE(AVG(t.bitrate), 0) FROM track t").where("release_id = ?").bind(getId()).where("bitrate > 0"));
}
std::vector<CodecType> Release::getCodecs() const
std::vector<core::media::CodecType> Release::getCodecs() const
{
assert(session());
// Get the codec ordered by frequency
return utils::fetchQueryResults(session()->query<CodecType>("SELECT t.codec FROM track t").where("release_id = ?").bind(getId()).groupBy("t.codec").orderBy("COUNT(t.id) DESC"));
auto query{ session()->query<detail::CodecType>("SELECT t.codec FROM track t").where("release_id = ?").bind(getId()).groupBy("t.codec").orderBy("COUNT(t.id) DESC") };
std::vector<core::media::CodecType> res;
utils::forEachQueryResult(query, [&](detail::CodecType codec) {
if (const auto mediaCodecType{ detail::getMediaCodecType(codec) })
res.push_back(*mediaCodecType);
});
return res;
}
std::vector<Artist::pointer> Release::getArtists(TrackArtistLinkType linkType) const