identify

package
v0.20.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type FieldOptions added in v0.17.0

type FieldOptions struct {
	Field    string        `json:"field"`
	Strategy FieldStrategy `json:"strategy"`
	// creates missing objects if needed - only applicable for performers, tags and studios
	CreateMissing *bool `json:"createMissing"`
}

type FieldStrategy added in v0.17.0

type FieldStrategy string
const (
	// Never sets the field value
	FieldStrategyIgnore FieldStrategy = "IGNORE"
	// For multi-value fields, merge with existing.
	// For single-value fields, ignore if already set
	FieldStrategyMerge FieldStrategy = "MERGE"
	// Always replaces the value if a value is found.
	//   For multi-value fields, any existing values are removed and replaced with the
	//   scraped values.
	FieldStrategyOverwrite FieldStrategy = "OVERWRITE"
)

func (FieldStrategy) IsValid added in v0.17.0

func (e FieldStrategy) IsValid() bool

func (FieldStrategy) MarshalGQL added in v0.17.0

func (e FieldStrategy) MarshalGQL(w io.Writer)

func (FieldStrategy) String added in v0.17.0

func (e FieldStrategy) String() string

func (*FieldStrategy) UnmarshalGQL added in v0.17.0

func (e *FieldStrategy) UnmarshalGQL(v interface{}) error

type MetadataOptions added in v0.17.0

type MetadataOptions struct {
	// any fields missing from here are defaulted to MERGE and createMissing false
	FieldOptions []*FieldOptions `json:"fieldOptions"`
	// defaults to true if not provided
	SetCoverImage *bool `json:"setCoverImage"`
	SetOrganized  *bool `json:"setOrganized"`
	// defaults to true if not provided
	IncludeMalePerformers *bool `json:"includeMalePerformers"`
}

type Options added in v0.17.0

type Options struct {
	// An ordered list of sources to identify items with. Only the first source that finds a match is used.
	Sources []*Source `json:"sources"`
	// Options defined here override the configured defaults
	Options *MetadataOptions `json:"options"`
	// scene ids to identify
	SceneIDs []string `json:"sceneIDs"`
	// paths of scenes to identify - ignored if scene ids are set
	Paths []string `json:"paths"`
}

type PerformerCreator added in v0.17.0

type PerformerCreator interface {
	Create(ctx context.Context, newPerformer *models.Performer) error
}

type SceneIdentifier

type SceneIdentifier struct {
	SceneReaderUpdater SceneReaderUpdater
	StudioCreator      StudioCreator
	PerformerCreator   PerformerCreator
	TagCreator         TagCreator

	DefaultOptions              *MetadataOptions
	Sources                     []ScraperSource
	SceneUpdatePostHookExecutor SceneUpdatePostHookExecutor
}

func (*SceneIdentifier) Identify

func (t *SceneIdentifier) Identify(ctx context.Context, txnManager txn.Manager, scene *models.Scene) error

type SceneReaderUpdater added in v0.17.0

type SceneReaderUpdater interface {
	GetCover(ctx context.Context, sceneID int) ([]byte, error)
	scene.Updater
	models.PerformerIDLoader
	models.TagIDLoader
	models.StashIDLoader
}

type SceneScraper

type SceneScraper interface {
	ScrapeScene(ctx context.Context, sceneID int) (*scraper.ScrapedScene, error)
}

type SceneUpdatePostHookExecutor

type SceneUpdatePostHookExecutor interface {
	ExecuteSceneUpdatePostHooks(ctx context.Context, input models.SceneUpdateInput, inputFields []string)
}

type ScraperSource

type ScraperSource struct {
	Name       string
	Options    *MetadataOptions
	Scraper    SceneScraper
	RemoteSite string
}

type Source added in v0.17.0

type Source struct {
	Source *scraper.Source `json:"source"`
	// Options defined for a source override the defaults
	Options *MetadataOptions `json:"options"`
}

type StudioCreator added in v0.17.0

type StudioCreator interface {
	Create(ctx context.Context, newStudio models.Studio) (*models.Studio, error)
	UpdateStashIDs(ctx context.Context, studioID int, stashIDs []models.StashID) error
}

type TagCreator added in v0.17.0

type TagCreator interface {
	Create(ctx context.Context, newTag models.Tag) (*models.Tag, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL