Skip to content

Commit

Permalink
bitrate filter (#4713)
Browse files Browse the repository at this point in the history
  • Loading branch information
NodudeWasTaken authored Mar 21, 2024
1 parent 62b8ffb commit a369613
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions graphql/schema/types/filters.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions pkg/models/scene.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pkg/sqlite/scene.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
1 change: 1 addition & 0 deletions ui/v2.5/src/models/list-filter/scenes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const criterionOptions = [
ResolutionCriterionOption,
OrientationCriterionOption,
createMandatoryNumberCriterionOption("framerate"),
createMandatoryNumberCriterionOption("bitrate"),
createStringCriterionOption("video_codec"),
createStringCriterionOption("audio_codec"),
createDurationCriterionOption("duration"),
Expand Down
1 change: 1 addition & 0 deletions ui/v2.5/src/models/list-filter/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export type CriterionType =
| "resolution"
| "average_resolution"
| "framerate"
| "bitrate"
| "video_codec"
| "audio_codec"
| "duration"
Expand Down

0 comments on commit a369613

Please sign in to comment.