FR: Sort Scenes and Images by Resolution (#6441)

This commit is contained in:
Gykes 2026-01-04 21:36:21 -08:00 committed by GitHub
parent 09ba41b2bb
commit 956af44a29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 1 deletions

View File

@ -942,6 +942,7 @@ var imageSortOptions = sortOptions{
"performer_count",
"random",
"rating",
"resolution",
"tag_count",
"title",
"updated_at",
@ -1001,6 +1002,14 @@ func (qb *ImageStore) setImageSortAndPagination(q *queryBuilder, findFilter *mod
case "mod_time", "filesize":
addFilesJoin()
sortClause = getSort(sort, direction, "files")
case "resolution":
addFilesJoin()
q.addJoins(join{
sort: true,
table: imageFileTable,
onClause: "images_files.file_id = image_files.file_id",
})
sortClause = " ORDER BY MIN(image_files.width, image_files.height) " + direction
case "title":
addFilesJoin()
addFolderJoin()

View File

@ -1138,6 +1138,7 @@ var sceneSortOptions = sortOptions{
"perceptual_similarity",
"random",
"rating",
"resolution",
"studio",
"tag_count",
"title",
@ -1236,6 +1237,9 @@ func (qb *SceneStore) setSceneSort(query *queryBuilder, findFilter *models.FindF
sort = "frame_rate"
addVideoFileTable()
query.sortAndPagination += getSort(sort, direction, videoFileTable)
case "resolution":
addVideoFileTable()
query.sortAndPagination += fmt.Sprintf(" ORDER BY MIN(%s.width, %s.height) %s", videoFileTable, videoFileTable, getSortDirection(direction))
case "filesize":
addFileTable()
query.sortAndPagination += getSort(sort, direction, fileTable)

View File

@ -25,7 +25,13 @@ import { GalleriesCriterionOption } from "./criteria/galleries";
const defaultSortBy = "path";
const sortByOptions = ["filesize", "file_count", "date", ...MediaSortByOptions]
const sortByOptions = [
"filesize",
"file_count",
"date",
"resolution",
...MediaSortByOptions,
]
.map(ListFilterOptions.createSortBy)
.concat([
{

View File

@ -44,6 +44,7 @@ const sortByOptions = [
"filesize",
"duration",
"framerate",
"resolution",
"bitrate",
"last_played_at",
"resume_time",