diff --git a/graphql/schema/types/filters.graphql b/graphql/schema/types/filters.graphql index 1ca8c1fb08d..fb6a59bce7f 100644 --- a/graphql/schema/types/filters.graphql +++ b/graphql/schema/types/filters.graphql @@ -302,6 +302,8 @@ input SceneFilterType { created_at: TimestampCriterionInput "Filter by last update time" updated_at: TimestampCriterionInput + "Filter by file size" + file_size: IntCriterionInput "Filter by related galleries that meet this criteria" galleries_filter: GalleryFilterType diff --git a/pkg/models/scene.go b/pkg/models/scene.go index 814c4a41d62..d4ff218c57a 100644 --- a/pkg/models/scene.go +++ b/pkg/models/scene.go @@ -47,6 +47,8 @@ type SceneFilterType struct { VideoCodec *StringCriterionInput `json:"video_codec"` // Filter by audio codec AudioCodec *StringCriterionInput `json:"audio_codec"` + // Filter by File Size + FileSize *IntCriterionInput `json:"file_size"` // Filter by duration (in seconds) Duration *IntCriterionInput `json:"duration"` // Filter to only include scenes which have markers. `true` or `false` diff --git a/pkg/plugin/examples/js/js.yml b/pkg/plugin/examples/js/js.yml index 25f0d56e345..4a1d96d291a 100644 --- a/pkg/plugin/examples/js/js.yml +++ b/pkg/plugin/examples/js/js.yml @@ -52,6 +52,9 @@ hooks: - Tag.Create.Post - Tag.Update.Post - Tag.Destroy.Post + - File.Destroy.Post + - File.Update.Post + - File.Create.Post defaultArgs: mode: hook diff --git a/pkg/plugin/hook/hooks.go b/pkg/plugin/hook/hooks.go index a8235b1834d..428e99cf57f 100644 --- a/pkg/plugin/hook/hooks.go +++ b/pkg/plugin/hook/hooks.go @@ -48,6 +48,10 @@ const ( TagUpdatePost TriggerEnum = "Tag.Update.Post" TagMergePost TriggerEnum = "Tag.Merge.Post" TagDestroyPost TriggerEnum = "Tag.Destroy.Post" + + FileDestroyPost TriggerEnum = "File.Destroy.Post" + FileUpdatePost TriggerEnum = "File.Update.Post" + FileCreatePost TriggerEnum = "File.Create.Post" ) var AllHookTriggerEnum = []TriggerEnum{ @@ -87,6 +91,10 @@ var AllHookTriggerEnum = []TriggerEnum{ TagUpdatePost, TagMergePost, TagDestroyPost, + + FileDestroyPost, + FileUpdatePost, + FileCreatePost, } func (e TriggerEnum) IsValid() bool { @@ -124,6 +132,10 @@ func (e TriggerEnum) IsValid() bool { StudioUpdatePost, StudioDestroyPost, + FileDestroyPost, + FileUpdatePost, + FileCreatePost, + TagCreatePost, TagUpdatePost, TagDestroyPost: diff --git a/pkg/sqlite/scene_filter.go b/pkg/sqlite/scene_filter.go index 3f2233395fa..4a53a0e95af 100644 --- a/pkg/sqlite/scene_filter.go +++ b/pkg/sqlite/scene_filter.go @@ -96,6 +96,7 @@ func (qb *sceneFilterHandler) criterionHandler() criterionHandler { qb.oCountCriterionHandler(sceneFilter.OCounter), boolCriterionHandler(sceneFilter.Organized, "scenes.organized", nil), + intCriterionHandler(sceneFilter.FileSize, "video_files.FileSize", qb.addVideoFilesTable), floatIntCriterionHandler(sceneFilter.Duration, "video_files.duration", qb.addVideoFilesTable), resolutionCriterionHandler(sceneFilter.Resolution, "video_files.height", "video_files.width", qb.addVideoFilesTable), orientationCriterionHandler(sceneFilter.Orientation, "video_files.height", "video_files.width", qb.addVideoFilesTable),