From 0e2bd125a8f2a2d1e2551fcfe4fa7dd6277199c7 Mon Sep 17 00:00:00 2001 From: HappyAxolotl <95097933+HappyAxolotl@users.noreply.github.com> Date: Fri, 27 Jan 2023 01:38:32 +0100 Subject: [PATCH] add fields director and code to stash-box SceneDraftInput (#3335) --- .../stashbox/graphql/generated_client.go | 422 +++++++++--------- .../stashbox/graphql/generated_models.go | 6 +- pkg/scraper/stashbox/graphql/override.go | 2 + pkg/scraper/stashbox/stash_box.go | 6 + 4 files changed, 222 insertions(+), 214 deletions(-) diff --git a/pkg/scraper/stashbox/graphql/generated_client.go b/pkg/scraper/stashbox/graphql/generated_client.go index cc30ab136..9861769a8 100644 --- a/pkg/scraper/stashbox/graphql/generated_client.go +++ b/pkg/scraper/stashbox/graphql/generated_client.go @@ -239,48 +239,11 @@ const FindSceneByFingerprintDocument = `query FindSceneByFingerprint ($fingerpri ... SceneFragment } } -fragment MeasurementsFragment on Measurements { - band_size - cup_size - waist - hip -} -fragment SceneFragment on Scene { +fragment ImageFragment on Image { id - title - code - details - director - duration - date - urls { - ... URLFragment - } - images { - ... ImageFragment - } - studio { - ... StudioFragment - } - tags { - ... TagFragment - } - performers { - ... PerformerAppearanceFragment - } - fingerprints { - ... FingerprintFragment - } -} -fragment StudioFragment on Studio { - name - id - urls { - ... URLFragment - } - images { - ... ImageFragment - } + url + width + height } fragment PerformerFragment on Performer { id @@ -316,10 +279,53 @@ fragment PerformerFragment on Performer { ... BodyModificationFragment } } +fragment SceneFragment on Scene { + id + title + code + details + director + duration + date + urls { + ... URLFragment + } + images { + ... ImageFragment + } + studio { + ... StudioFragment + } + tags { + ... TagFragment + } + performers { + ... PerformerAppearanceFragment + } + fingerprints { + ... FingerprintFragment + } +} +fragment URLFragment on URL { + url + type +} +fragment PerformerAppearanceFragment on PerformerAppearance { + as + performer { + ... PerformerFragment + } +} fragment FuzzyDateFragment on FuzzyDate { date accuracy } +fragment MeasurementsFragment on Measurements { + band_size + cup_size + waist + hip +} fragment BodyModificationFragment on BodyModification { location description @@ -329,26 +335,20 @@ fragment FingerprintFragment on Fingerprint { hash duration } -fragment URLFragment on URL { - url - type -} -fragment ImageFragment on Image { +fragment StudioFragment on Studio { + name id - url - width - height + urls { + ... URLFragment + } + images { + ... ImageFragment + } } fragment TagFragment on Tag { name id } -fragment PerformerAppearanceFragment on PerformerAppearance { - as - performer { - ... PerformerFragment - } -} ` func (c *Client) FindSceneByFingerprint(ctx context.Context, fingerprint FingerprintQueryInput, httpRequestOptions ...client.HTTPRequestOption) (*FindSceneByFingerprint, error) { @@ -369,26 +369,6 @@ const FindScenesByFullFingerprintsDocument = `query FindScenesByFullFingerprints ... SceneFragment } } -fragment URLFragment on URL { - url - type -} -fragment ImageFragment on Image { - id - url - width - height -} -fragment StudioFragment on Studio { - name - id - urls { - ... URLFragment - } - images { - ... ImageFragment - } -} fragment PerformerFragment on Performer { id name @@ -423,9 +403,15 @@ fragment PerformerFragment on Performer { ... BodyModificationFragment } } -fragment BodyModificationFragment on BodyModification { - location - description +fragment FuzzyDateFragment on FuzzyDate { + date + accuracy +} +fragment MeasurementsFragment on Measurements { + band_size + cup_size + waist + hip } fragment SceneFragment on Scene { id @@ -454,31 +440,45 @@ fragment SceneFragment on Scene { ... FingerprintFragment } } -fragment PerformerAppearanceFragment on PerformerAppearance { - as - performer { - ... PerformerFragment - } +fragment URLFragment on URL { + url + type } -fragment FuzzyDateFragment on FuzzyDate { - date - accuracy +fragment ImageFragment on Image { + id + url + width + height } -fragment MeasurementsFragment on Measurements { - band_size - cup_size - waist - hip +fragment BodyModificationFragment on BodyModification { + location + description } fragment FingerprintFragment on Fingerprint { algorithm hash duration } +fragment StudioFragment on Studio { + name + id + urls { + ... URLFragment + } + images { + ... ImageFragment + } +} fragment TagFragment on Tag { name id } +fragment PerformerAppearanceFragment on PerformerAppearance { + as + performer { + ... PerformerFragment + } +} ` func (c *Client) FindScenesByFullFingerprints(ctx context.Context, fingerprints []*FingerprintQueryInput, httpRequestOptions ...client.HTTPRequestOption) (*FindScenesByFullFingerprints, error) { @@ -499,12 +499,6 @@ const FindScenesBySceneFingerprintsDocument = `query FindScenesBySceneFingerprin ... SceneFragment } } -fragment ImageFragment on Image { - id - url - width - height -} fragment StudioFragment on Studio { name id @@ -515,12 +509,6 @@ fragment StudioFragment on Studio { ... ImageFragment } } -fragment PerformerAppearanceFragment on PerformerAppearance { - as - performer { - ... PerformerFragment - } -} fragment FuzzyDateFragment on FuzzyDate { date accuracy @@ -534,9 +522,17 @@ fragment URLFragment on URL { url type } -fragment TagFragment on Tag { - name +fragment ImageFragment on Image { id + url + width + height +} +fragment PerformerAppearanceFragment on PerformerAppearance { + as + performer { + ... PerformerFragment + } } fragment PerformerFragment on Performer { id @@ -609,6 +605,10 @@ fragment SceneFragment on Scene { ... FingerprintFragment } } +fragment TagFragment on Tag { + name + id +} ` func (c *Client) FindScenesBySceneFingerprints(ctx context.Context, fingerprints [][]*FingerprintQueryInput, httpRequestOptions ...client.HTTPRequestOption) (*FindScenesBySceneFingerprints, error) { @@ -629,21 +629,6 @@ const SearchSceneDocument = `query SearchScene ($term: String!) { ... SceneFragment } } -fragment MeasurementsFragment on Measurements { - band_size - cup_size - waist - hip -} -fragment BodyModificationFragment on BodyModification { - location - description -} -fragment FingerprintFragment on Fingerprint { - algorithm - hash - duration -} fragment SceneFragment on Scene { id title @@ -675,12 +660,42 @@ fragment URLFragment on URL { url type } +fragment TagFragment on Tag { + name + id +} +fragment FuzzyDateFragment on FuzzyDate { + date + accuracy +} +fragment MeasurementsFragment on Measurements { + band_size + cup_size + waist + hip +} fragment ImageFragment on Image { id url width height } +fragment StudioFragment on Studio { + name + id + urls { + ... URLFragment + } + images { + ... ImageFragment + } +} +fragment PerformerAppearanceFragment on PerformerAppearance { + as + performer { + ... PerformerFragment + } +} fragment PerformerFragment on Performer { id name @@ -715,29 +730,14 @@ fragment PerformerFragment on Performer { ... BodyModificationFragment } } -fragment FuzzyDateFragment on FuzzyDate { - date - accuracy +fragment BodyModificationFragment on BodyModification { + location + description } -fragment StudioFragment on Studio { - name - id - urls { - ... URLFragment - } - images { - ... ImageFragment - } -} -fragment TagFragment on Tag { - name - id -} -fragment PerformerAppearanceFragment on PerformerAppearance { - as - performer { - ... PerformerFragment - } +fragment FingerprintFragment on Fingerprint { + algorithm + hash + duration } ` @@ -759,12 +759,6 @@ const SearchPerformerDocument = `query SearchPerformer ($term: String!) { ... PerformerFragment } } -fragment ImageFragment on Image { - id - url - width - height -} fragment FuzzyDateFragment on FuzzyDate { date accuracy @@ -817,6 +811,12 @@ fragment URLFragment on URL { url type } +fragment ImageFragment on Image { + id + url + width + height +} ` func (c *Client) SearchPerformer(ctx context.Context, term string, httpRequestOptions ...client.HTTPRequestOption) (*SearchPerformer, error) { @@ -915,6 +915,69 @@ const FindSceneByIDDocument = `query FindSceneByID ($id: ID!) { ... SceneFragment } } +fragment FingerprintFragment on Fingerprint { + algorithm + hash + duration +} +fragment URLFragment on URL { + url + type +} +fragment PerformerAppearanceFragment on PerformerAppearance { + as + performer { + ... PerformerFragment + } +} +fragment MeasurementsFragment on Measurements { + band_size + cup_size + waist + hip +} +fragment TagFragment on Tag { + name + id +} +fragment PerformerFragment on Performer { + id + name + disambiguation + aliases + gender + merged_ids + urls { + ... URLFragment + } + images { + ... ImageFragment + } + birthdate { + ... FuzzyDateFragment + } + ethnicity + country + eye_color + hair_color + height + measurements { + ... MeasurementsFragment + } + breast_type + career_start_year + career_end_year + tattoos { + ... BodyModificationFragment + } + piercings { + ... BodyModificationFragment + } +} +fragment FuzzyDateFragment on FuzzyDate { + date + accuracy +} fragment BodyModificationFragment on BodyModification { location description @@ -962,69 +1025,6 @@ fragment StudioFragment on Studio { ... ImageFragment } } -fragment FuzzyDateFragment on FuzzyDate { - date - accuracy -} -fragment MeasurementsFragment on Measurements { - band_size - cup_size - waist - hip -} -fragment URLFragment on URL { - url - type -} -fragment TagFragment on Tag { - name - id -} -fragment PerformerAppearanceFragment on PerformerAppearance { - as - performer { - ... PerformerFragment - } -} -fragment PerformerFragment on Performer { - id - name - disambiguation - aliases - gender - merged_ids - urls { - ... URLFragment - } - images { - ... ImageFragment - } - birthdate { - ... FuzzyDateFragment - } - ethnicity - country - eye_color - hair_color - height - measurements { - ... MeasurementsFragment - } - breast_type - career_start_year - career_end_year - tattoos { - ... BodyModificationFragment - } - piercings { - ... BodyModificationFragment - } -} -fragment FingerprintFragment on Fingerprint { - algorithm - hash - duration -} ` func (c *Client) FindSceneByID(ctx context.Context, id string, httpRequestOptions ...client.HTTPRequestOption) (*FindSceneByID, error) { diff --git a/pkg/scraper/stashbox/graphql/generated_models.go b/pkg/scraper/stashbox/graphql/generated_models.go index 6bb572edb..6b3e09565 100644 --- a/pkg/scraper/stashbox/graphql/generated_models.go +++ b/pkg/scraper/stashbox/graphql/generated_models.go @@ -88,9 +88,9 @@ type DraftEntity struct { ID *string `json:"id,omitempty"` } -func (DraftEntity) IsSceneDraftTag() {} -func (DraftEntity) IsSceneDraftStudio() {} func (DraftEntity) IsSceneDraftPerformer() {} +func (DraftEntity) IsSceneDraftStudio() {} +func (DraftEntity) IsSceneDraftTag() {} type DraftEntityInput struct { Name string `json:"name"` @@ -339,8 +339,8 @@ type Performer struct { Updated time.Time `json:"updated"` } -func (Performer) IsEditTarget() {} func (Performer) IsSceneDraftPerformer() {} +func (Performer) IsEditTarget() {} type PerformerAppearance struct { Performer *Performer `json:"performer,omitempty"` diff --git a/pkg/scraper/stashbox/graphql/override.go b/pkg/scraper/stashbox/graphql/override.go index d80b74307..f9b0a2146 100644 --- a/pkg/scraper/stashbox/graphql/override.go +++ b/pkg/scraper/stashbox/graphql/override.go @@ -7,7 +7,9 @@ import "github.com/99designs/gqlgen/graphql" type SceneDraftInput struct { ID *string `json:"id,omitempty"` Title *string `json:"title,omitempty"` + Code *string `json:"code,omitempty"` Details *string `json:"details,omitempty"` + Director *string `json:"director,omitempty"` URL *string `json:"url,omitempty"` Date *string `json:"date,omitempty"` Studio *DraftEntityInput `json:"studio,omitempty"` diff --git a/pkg/scraper/stashbox/stash_box.go b/pkg/scraper/stashbox/stash_box.go index 4a5b8712b..35935650e 100644 --- a/pkg/scraper/stashbox/stash_box.go +++ b/pkg/scraper/stashbox/stash_box.go @@ -807,9 +807,15 @@ func (c Client) SubmitSceneDraft(ctx context.Context, scene *models.Scene, endpo if scene.Title != "" { draft.Title = &scene.Title } + if scene.Code != "" { + draft.Code = &scene.Code + } if scene.Details != "" { draft.Details = &scene.Details } + if scene.Director != "" { + draft.Director = &scene.Director + } if scene.URL != "" && len(strings.TrimSpace(scene.URL)) > 0 { url := strings.TrimSpace(scene.URL) draft.URL = &url