Added a way to filter multiple image types

This commit is contained in:
emeric
2025-06-15 14:41:58 +02:00
parent dd57275858
commit 9629a8cc97
4 changed files with 22 additions and 9 deletions
+14 -3
View File
@@ -41,7 +41,7 @@ namespace lms::db
if (params.track.isValid()
|| params.release.isValid()
|| params.trackList.isValid()
|| params.imageType.has_value()
|| !params.imageTypes.empty()
|| params.sortMethod == TrackEmbeddedImageSortMethod::MediaTypeThenFrontTypeThenSizeDescDesc
|| params.sortMethod == TrackEmbeddedImageSortMethod::FrontTypeThenSizeDesc)
{
@@ -62,8 +62,19 @@ namespace lms::db
query.where("t_l_e.tracklist_id = ?").bind(params.trackList);
}
if (params.imageType.has_value())
query.where("t_e_i_l.type = ?").bind(params.imageType.value());
if (!params.imageTypes.empty())
{
std::string clause{ "t_e_i_l.type IN (" };
for (const auto& type : params.imageTypes)
{
if (clause.back() != '(')
clause += ",";
clause += "?";
query.bind(type);
}
clause += ")";
query.where(clause);
}
}
switch (params.sortMethod)