From 7605eec6dab33f05bde758ea98ae9988c12843a2 Mon Sep 17 00:00:00 2001 From: dogwithakeyboard <128322708+dogwithakeyboard@users.noreply.github.com> Date: Mon, 16 Oct 2023 06:28:28 +0100 Subject: [PATCH] scene framerate filter (#4161) --- graphql/schema/types/filters.graphql | 2 ++ pkg/models/scene.go | 2 ++ pkg/sqlite/scene.go | 2 +- ui/v2.5/src/models/list-filter/scenes.ts | 1 + ui/v2.5/src/models/list-filter/types.ts | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/graphql/schema/types/filters.graphql b/graphql/schema/types/filters.graphql index f0b190264..6e3b4f038 100644 --- a/graphql/schema/types/filters.graphql +++ b/graphql/schema/types/filters.graphql @@ -225,6 +225,8 @@ input SceneFilterType { duplicated: PHashDuplicationCriterionInput "Filter by resolution" resolution: ResolutionCriterionInput + "Filter by frame rate" + framerate: IntCriterionInput "Filter by video codec" video_codec: StringCriterionInput "Filter by audio codec" diff --git a/pkg/models/scene.go b/pkg/models/scene.go index 09ac117ad..d04af929b 100644 --- a/pkg/models/scene.go +++ b/pkg/models/scene.go @@ -41,6 +41,8 @@ type SceneFilterType struct { Duplicated *PHashDuplicationCriterionInput `json:"duplicated"` // Filter by resolution Resolution *ResolutionCriterionInput `json:"resolution"` + // Filter by framerate + Framerate *IntCriterionInput `json:"framerate"` // Filter by video codec VideoCodec *StringCriterionInput `json:"video_codec"` // Filter by audio codec diff --git a/pkg/sqlite/scene.go b/pkg/sqlite/scene.go index e9f1f24dd..d898dc7ee 100644 --- a/pkg/sqlite/scene.go +++ b/pkg/sqlite/scene.go @@ -983,7 +983,7 @@ func (qb *SceneStore) makeFilter(ctx context.Context, sceneFilter *models.SceneF query.handleCriterion(ctx, floatIntCriterionHandler(sceneFilter.Duration, "video_files.duration", qb.addVideoFilesTable)) query.handleCriterion(ctx, resolutionCriterionHandler(sceneFilter.Resolution, "video_files.height", "video_files.width", qb.addVideoFilesTable)) - + query.handleCriterion(ctx, floatIntCriterionHandler(sceneFilter.Framerate, "ROUND(video_files.frame_rate)", qb.addVideoFilesTable)) query.handleCriterion(ctx, codecCriterionHandler(sceneFilter.VideoCodec, "video_files.video_codec", qb.addVideoFilesTable)) query.handleCriterion(ctx, codecCriterionHandler(sceneFilter.AudioCodec, "video_files.audio_codec", qb.addVideoFilesTable)) diff --git a/ui/v2.5/src/models/list-filter/scenes.ts b/ui/v2.5/src/models/list-filter/scenes.ts index d76adc056..db2c28875 100644 --- a/ui/v2.5/src/models/list-filter/scenes.ts +++ b/ui/v2.5/src/models/list-filter/scenes.ts @@ -72,6 +72,7 @@ const criterionOptions = [ RatingCriterionOption, createMandatoryNumberCriterionOption("o_counter"), ResolutionCriterionOption, + createMandatoryNumberCriterionOption("framerate"), createStringCriterionOption("video_codec"), createStringCriterionOption("audio_codec"), createDurationCriterionOption("duration"), diff --git a/ui/v2.5/src/models/list-filter/types.ts b/ui/v2.5/src/models/list-filter/types.ts index 59a0e81dd..bd5aa783b 100644 --- a/ui/v2.5/src/models/list-filter/types.ts +++ b/ui/v2.5/src/models/list-filter/types.ts @@ -120,6 +120,7 @@ export type CriterionType = | "o_counter" | "resolution" | "average_resolution" + | "framerate" | "video_codec" | "audio_codec" | "duration"