mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Show duration and filesize in results (#1776)
* Add new query interface * Refactor query builder * Change Query interface * Return duration and filesize in scene query * Adjust UI for scene metadata * Introduce new image query interface * Change image Query interface * Add megapixels and size to image query * Update image UI Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
1b411e3f43
commit
4dd56c3d82
@@ -6,6 +6,36 @@ import (
|
||||
"github.com/stashapp/stash/pkg/models"
|
||||
)
|
||||
|
||||
type Queryer interface {
|
||||
Query(options models.ImageQueryOptions) (*models.ImageQueryResult, error)
|
||||
}
|
||||
|
||||
// QueryOptions returns a ImageQueryResult populated with the provided filters.
|
||||
func QueryOptions(imageFilter *models.ImageFilterType, findFilter *models.FindFilterType, count bool) models.ImageQueryOptions {
|
||||
return models.ImageQueryOptions{
|
||||
QueryOptions: models.QueryOptions{
|
||||
FindFilter: findFilter,
|
||||
Count: count,
|
||||
},
|
||||
ImageFilter: imageFilter,
|
||||
}
|
||||
}
|
||||
|
||||
// Query queries for images using the provided filters.
|
||||
func Query(qb Queryer, imageFilter *models.ImageFilterType, findFilter *models.FindFilterType) ([]*models.Image, error) {
|
||||
result, err := qb.Query(QueryOptions(imageFilter, findFilter, false))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
images, err := result.Resolve()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return images, nil
|
||||
}
|
||||
|
||||
func CountByPerformerID(r models.ImageReader, id int) (int, error) {
|
||||
filter := &models.ImageFilterType{
|
||||
Performers: &models.MultiCriterionInput{
|
||||
|
||||
Reference in New Issue
Block a user