diff --git a/graphql/schema/types/filters.graphql b/graphql/schema/types/filters.graphql index 9b23fec7a..ff06980cf 100644 --- a/graphql/schema/types/filters.graphql +++ b/graphql/schema/types/filters.graphql @@ -231,6 +231,8 @@ input SceneFilterType { orientation: OrientationCriterionInput "Filter by frame rate" framerate: IntCriterionInput + "Filter by bit rate" + bitrate: 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 bd58d24ed..4b1f2a01b 100644 --- a/pkg/models/scene.go +++ b/pkg/models/scene.go @@ -43,6 +43,8 @@ type SceneFilterType struct { Orientation *OrientationCriterionInput `json:"orientation"` // Filter by framerate Framerate *IntCriterionInput `json:"framerate"` + // Filter by bitrate + Bitrate *IntCriterionInput `json:"bitrate"` // 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 2a9af6ebf..4e3c4c8a9 100644 --- a/pkg/sqlite/scene.go +++ b/pkg/sqlite/scene.go @@ -957,6 +957,7 @@ func (qb *SceneStore) makeFilter(ctx context.Context, sceneFilter *models.SceneF query.handleCriterion(ctx, resolutionCriterionHandler(sceneFilter.Resolution, "video_files.height", "video_files.width", qb.addVideoFilesTable)) query.handleCriterion(ctx, orientationCriterionHandler(sceneFilter.Orientation, "video_files.height", "video_files.width", qb.addVideoFilesTable)) query.handleCriterion(ctx, floatIntCriterionHandler(sceneFilter.Framerate, "ROUND(video_files.frame_rate)", qb.addVideoFilesTable)) + query.handleCriterion(ctx, intCriterionHandler(sceneFilter.Bitrate, "video_files.bit_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 1c007aa8f..568a23b41 100644 --- a/ui/v2.5/src/models/list-filter/scenes.ts +++ b/ui/v2.5/src/models/list-filter/scenes.ts @@ -82,6 +82,7 @@ const criterionOptions = [ ResolutionCriterionOption, OrientationCriterionOption, createMandatoryNumberCriterionOption("framerate"), + createMandatoryNumberCriterionOption("bitrate"), 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 ff9a95085..b859b16f8 100644 --- a/ui/v2.5/src/models/list-filter/types.ts +++ b/ui/v2.5/src/models/list-filter/types.ts @@ -131,6 +131,7 @@ export type CriterionType = | "resolution" | "average_resolution" | "framerate" + | "bitrate" | "video_codec" | "audio_codec" | "duration"