mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Image improvements (#847)
* Fix image performer filtering * Add performer images tab * Add studio images tab * Rename interface * Add tag images tab * Add path filtering for images * Show image stats on stats page * Fix incorrect scan counts after timeout * Add gallery filters * Relax scene gallery selector
This commit is contained in:
@@ -203,6 +203,8 @@ func (qb *GalleryQueryBuilder) Query(galleryFilter *GalleryFilterType, findFilte
|
||||
}
|
||||
|
||||
query.handleStringCriterionInput(galleryFilter.Path, "galleries.path")
|
||||
query.handleIntCriterionInput(galleryFilter.Rating, "galleries.rating")
|
||||
qb.handleAverageResolutionFilter(&query, galleryFilter.AverageResolution)
|
||||
|
||||
if isMissingFilter := galleryFilter.IsMissing; isMissingFilter != nil && *isMissingFilter != "" {
|
||||
switch *isMissingFilter {
|
||||
@@ -265,6 +267,48 @@ func (qb *GalleryQueryBuilder) Query(galleryFilter *GalleryFilterType, findFilte
|
||||
return galleries, countResult
|
||||
}
|
||||
|
||||
func (qb *GalleryQueryBuilder) handleAverageResolutionFilter(query *queryBuilder, resolutionFilter *ResolutionEnum) {
|
||||
if resolutionFilter == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if resolution := resolutionFilter.String(); resolutionFilter.IsValid() {
|
||||
var low int
|
||||
var high int
|
||||
|
||||
switch resolution {
|
||||
case "LOW":
|
||||
high = 480
|
||||
case "STANDARD":
|
||||
low = 480
|
||||
high = 720
|
||||
case "STANDARD_HD":
|
||||
low = 720
|
||||
high = 1080
|
||||
case "FULL_HD":
|
||||
low = 1080
|
||||
high = 2160
|
||||
case "FOUR_K":
|
||||
low = 2160
|
||||
}
|
||||
|
||||
havingClause := ""
|
||||
if low != 0 {
|
||||
havingClause = "avg(images.height) >= " + strconv.Itoa(low)
|
||||
}
|
||||
if high != 0 {
|
||||
if havingClause != "" {
|
||||
havingClause += " AND "
|
||||
}
|
||||
havingClause += "avg(images.height) < " + strconv.Itoa(high)
|
||||
}
|
||||
|
||||
if havingClause != "" {
|
||||
query.addHaving(havingClause)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (qb *GalleryQueryBuilder) getGallerySort(findFilter *FindFilterType) string {
|
||||
var sort string
|
||||
var direction string
|
||||
|
||||
Reference in New Issue
Block a user