Documentation ¶
Index ¶
- Variables
- func AddGallery(ctx context.Context, qb PartialUpdater, o *models.Scene, galleryID int) error
- func AddPerformer(ctx context.Context, qb PartialUpdater, o *models.Scene, performerID int) error
- func AddTag(ctx context.Context, qb PartialUpdater, o *models.Scene, tagID int) error
- func BatchProcess(ctx context.Context, reader Queryer, sceneFilter *models.SceneFilterType, ...) error
- func DestroyMarker(ctx context.Context, scene *models.Scene, sceneMarker *models.SceneMarker, ...) error
- func FilterFromPaths(paths []string) *models.SceneFilterType
- func GetDependentMovieIDs(ctx context.Context, scene *models.Scene) ([]int, error)
- func GetDependentTagIDs(ctx context.Context, tags MarkerTagFinder, markerReader MarkerFinder, ...) ([]int, error)
- func GetHash(f file.File, hashAlgorithm models.HashAlgorithm) string
- func GetSceneMarkersJSON(ctx context.Context, markerReader MarkerFinder, tagReader MarkerTagFinder, ...) ([]jsonschema.SceneMarker, error)
- func GetSceneMoviesJSON(ctx context.Context, movieReader MovieFinder, scene *models.Scene) ([]jsonschema.SceneMovie, error)
- func GetStudioName(ctx context.Context, reader studio.Finder, scene *models.Scene) (string, error)
- func GetTagNames(ctx context.Context, reader TagFinder, scene *models.Scene) ([]string, error)
- func MigrateHash(p *paths.Paths, oldHash string, newHash string)
- func PathsFilter(paths []string) *models.SceneFilterType
- func Query(ctx context.Context, qb Queryer, sceneFilter *models.SceneFilterType, ...) ([]*models.Scene, error)
- func QueryOptions(sceneFilter *models.SceneFilterType, findFilter *models.FindFilterType, ...) models.SceneQueryOptions
- func QueryWithCount(ctx context.Context, qb Queryer, sceneFilter *models.SceneFilterType, ...) ([]*models.Scene, int, error)
- func SetScreenshot(paths *paths.Paths, checksum string, imageData []byte) error
- func ToBasicJSON(ctx context.Context, reader CoverGetter, scene *models.Scene) (*jsonschema.Scene, error)
- type Config
- type CoverGenerator
- type CoverGetter
- type CoverUpdater
- type Creator
- type CreatorUpdater
- type Destroyer
- type FileAssigner
- type FileDeleter
- type FinderByFile
- type FullCreatorUpdater
- type IDFinder
- type Importer
- func (i *Importer) Create(ctx context.Context) (*int, error)
- func (i *Importer) FindExistingID(ctx context.Context) (*int, error)
- func (i *Importer) Name() string
- func (i *Importer) PostImport(ctx context.Context, id int) error
- func (i *Importer) PreImport(ctx context.Context) error
- func (i *Importer) Update(ctx context.Context, id int) error
- type MarkerCreatorUpdater
- type MarkerDestroyer
- type MarkerFinder
- type MarkerImporter
- func (i *MarkerImporter) Create(ctx context.Context) (*int, error)
- func (i *MarkerImporter) FindExistingID(ctx context.Context) (*int, error)
- func (i *MarkerImporter) Name() string
- func (i *MarkerImporter) PostImport(ctx context.Context, id int) error
- func (i *MarkerImporter) PreImport(ctx context.Context) error
- func (i *MarkerImporter) Update(ctx context.Context, id int) error
- type MarkerRepository
- type MarkerTagFinder
- type MovieFinder
- type PartialUpdater
- type PathsCoverSetter
- type Queryer
- type Repository
- type ScanGenerator
- type ScanHandler
- type ScreenshotSetter
- type Service
- func (s *Service) AssignFile(ctx context.Context, sceneID int, fileID file.ID) error
- func (s *Service) Create(ctx context.Context, input *models.Scene, fileIDs []file.ID, coverImage []byte) (*models.Scene, error)
- func (s *Service) Destroy(ctx context.Context, scene *models.Scene, fileDeleter *FileDeleter, ...) error
- func (s *Service) Merge(ctx context.Context, sourceIDs []int, destinationID int, ...) error
- type TagFinder
- type UpdateSet
- type Updater
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyUpdater = errors.New("no fields have been set")
var (
ErrNotVideoFile = errors.New("not a video file")
)
Functions ¶
func AddGallery ¶ added in v0.5.0
func AddPerformer ¶ added in v0.5.0
func BatchProcess ¶ added in v0.11.0
func DestroyMarker ¶ added in v0.12.0
func DestroyMarker(ctx context.Context, scene *models.Scene, sceneMarker *models.SceneMarker, qb MarkerDestroyer, fileDeleter *FileDeleter) error
DestroyMarker deletes the scene marker from the database and returns a function that removes the generated files, to be executed after the transaction is successfully committed.
func FilterFromPaths ¶ added in v0.11.0
func FilterFromPaths(paths []string) *models.SceneFilterType
FilterFromPaths creates a SceneFilterType that filters using the provided paths.
func GetDependentMovieIDs ¶
GetDependentMovieIDs returns a slice of movie IDs that this scene references.
func GetDependentTagIDs ¶
func GetDependentTagIDs(ctx context.Context, tags MarkerTagFinder, markerReader MarkerFinder, scene *models.Scene) ([]int, error)
GetDependentTagIDs returns a slice of unique tag IDs that this scene references.
func GetHash ¶ added in v0.17.0
func GetHash(f file.File, hashAlgorithm models.HashAlgorithm) string
GetHash returns the hash of the file, based on the hash algorithm provided. If hash algorithm is MD5, then Checksum is returned. Otherwise, OSHash is returned.
func GetSceneMarkersJSON ¶
func GetSceneMarkersJSON(ctx context.Context, markerReader MarkerFinder, tagReader MarkerTagFinder, scene *models.Scene) ([]jsonschema.SceneMarker, error)
GetSceneMarkersJSON returns a slice of SceneMarker JSON representation objects corresponding to the provided scene's markers.
func GetSceneMoviesJSON ¶
func GetSceneMoviesJSON(ctx context.Context, movieReader MovieFinder, scene *models.Scene) ([]jsonschema.SceneMovie, error)
GetSceneMoviesJSON returns a slice of SceneMovie JSON representation objects corresponding to the provided scene's scene movie relationships.
func GetStudioName ¶
GetStudioName returns the name of the provided scene's studio. It returns an empty string if there is no studio assigned to the scene.
func GetTagNames ¶
GetTagNames returns a slice of tag names corresponding to the provided scene's tags.
func MigrateHash ¶ added in v0.11.0
func PathsFilter ¶ added in v0.12.0
func PathsFilter(paths []string) *models.SceneFilterType
func Query ¶ added in v0.11.0
func Query(ctx context.Context, qb Queryer, sceneFilter *models.SceneFilterType, findFilter *models.FindFilterType) ([]*models.Scene, error)
Query queries for scenes using the provided filters.
func QueryOptions ¶ added in v0.11.0
func QueryOptions(sceneFilter *models.SceneFilterType, findFilter *models.FindFilterType, count bool) models.SceneQueryOptions
QueryOptions returns a SceneQueryOptions populated with the provided filters.
func QueryWithCount ¶ added in v0.11.0
func QueryWithCount(ctx context.Context, qb Queryer, sceneFilter *models.SceneFilterType, findFilter *models.FindFilterType) ([]*models.Scene, int, error)
QueryWithCount queries for scenes, returning the scene objects and the total count.
func SetScreenshot ¶ added in v0.11.0
func ToBasicJSON ¶
func ToBasicJSON(ctx context.Context, reader CoverGetter, scene *models.Scene) (*jsonschema.Scene, error)
ToBasicJSON converts a scene object into its JSON object equivalent. It does not convert the relationships to other objects, with the exception of cover image.
Types ¶
type Config ¶ added in v0.18.0
type Config interface {
GetVideoFileNamingAlgorithm() models.HashAlgorithm
}
type CoverGenerator ¶ added in v0.17.0
type CoverGetter ¶ added in v0.17.0
type CoverUpdater ¶ added in v0.18.0
type CreatorUpdater ¶ added in v0.17.0
type CreatorUpdater interface { FindByFileID(ctx context.Context, fileID file.ID) ([]*models.Scene, error) FindByFingerprints(ctx context.Context, fp []file.Fingerprint) ([]*models.Scene, error) Creator UpdatePartial(ctx context.Context, id int, updatedScene models.ScenePartial) (*models.Scene, error) AddFileID(ctx context.Context, id int, fileID file.ID) error models.VideoFileLoader }
type FileAssigner ¶ added in v0.18.0
type FileDeleter ¶ added in v0.12.0
FileDeleter is an extension of file.Deleter that handles deletion of scene files.
func (*FileDeleter) MarkGeneratedFiles ¶ added in v0.12.0
func (d *FileDeleter) MarkGeneratedFiles(scene *models.Scene) error
MarkGeneratedFiles marks for deletion the generated files for the provided scene.
func (*FileDeleter) MarkMarkerFiles ¶ added in v0.12.0
func (d *FileDeleter) MarkMarkerFiles(scene *models.Scene, seconds int) error
MarkMarkerFiles deletes generated files for a scene marker with the provided scene and timestamp.
type FinderByFile ¶ added in v0.17.0
type FullCreatorUpdater ¶ added in v0.17.0
type Importer ¶
type Importer struct { ReaderWriter FullCreatorUpdater FileFinder file.Getter StudioWriter studio.NameFinderCreator GalleryFinder gallery.Finder PerformerWriter performer.NameFinderCreator MovieWriter movie.NameFinderCreator TagWriter tag.NameFinderCreator Input jsonschema.Scene MissingRefBehaviour models.ImportMissingRefEnum FileNamingAlgorithm models.HashAlgorithm ID int // contains filtered or unexported fields }
func (*Importer) FindExistingID ¶
type MarkerCreatorUpdater ¶ added in v0.17.0
type MarkerCreatorUpdater interface { Create(ctx context.Context, newSceneMarker models.SceneMarker) (*models.SceneMarker, error) Update(ctx context.Context, updatedSceneMarker models.SceneMarker) (*models.SceneMarker, error) FindBySceneID(ctx context.Context, sceneID int) ([]*models.SceneMarker, error) UpdateTags(ctx context.Context, markerID int, tagIDs []int) error }
type MarkerDestroyer ¶ added in v0.17.0
type MarkerFinder ¶ added in v0.17.0
type MarkerImporter ¶
type MarkerImporter struct { SceneID int ReaderWriter MarkerCreatorUpdater TagWriter tag.NameFinderCreator Input jsonschema.SceneMarker MissingRefBehaviour models.ImportMissingRefEnum // contains filtered or unexported fields }
func (*MarkerImporter) FindExistingID ¶
func (i *MarkerImporter) FindExistingID(ctx context.Context) (*int, error)
func (*MarkerImporter) Name ¶
func (i *MarkerImporter) Name() string
func (*MarkerImporter) PostImport ¶
func (i *MarkerImporter) PostImport(ctx context.Context, id int) error
type MarkerRepository ¶ added in v0.18.0
type MarkerRepository interface { MarkerFinder MarkerDestroyer Update(ctx context.Context, updatedObject models.SceneMarker) (*models.SceneMarker, error) }
type MarkerTagFinder ¶ added in v0.17.0
type MovieFinder ¶ added in v0.17.0
type PartialUpdater ¶ added in v0.17.0
type PathsCoverSetter ¶ added in v0.17.0
type PathsCoverSetter struct { Paths *paths.Paths FileNamingAlgorithm models.HashAlgorithm }
func (*PathsCoverSetter) SetScreenshot ¶ added in v0.17.0
func (ss *PathsCoverSetter) SetScreenshot(scene *models.Scene, imageData []byte) error
type Queryer ¶ added in v0.11.0
type Queryer interface {
Query(ctx context.Context, options models.SceneQueryOptions) (*models.SceneQueryResult, error)
}
type Repository ¶ added in v0.17.0
type Repository interface { IDFinder FinderByFile Creator PartialUpdater Destroyer models.VideoFileLoader FileAssigner CoverUpdater models.SceneReader }
type ScanGenerator ¶ added in v0.17.0
type ScanHandler ¶ added in v0.17.0
type ScanHandler struct { CreatorUpdater CreatorUpdater CoverGenerator CoverGenerator ScanGenerator ScanGenerator CaptionUpdater video.CaptionUpdater PluginCache *plugin.Cache FileNamingAlgorithm models.HashAlgorithm Paths *paths.Paths }
type ScreenshotSetter ¶ added in v0.11.0
type Service ¶ added in v0.17.0
type Service struct { File file.Store Repository Repository MarkerRepository MarkerRepository PluginCache *plugin.Cache Paths *paths.Paths Config Config }
func (*Service) AssignFile ¶ added in v0.18.0
type UpdateSet ¶ added in v0.11.0
type UpdateSet struct { ID int Partial models.ScenePartial // Not set if nil. Set to []byte{} to clear existing CoverImage []byte }
UpdateSet is used to update a scene and its relationships.
func (*UpdateSet) Update ¶ added in v0.11.0
func (u *UpdateSet) Update(ctx context.Context, qb Updater, screenshotSetter ScreenshotSetter) (*models.Scene, error)
Update updates a scene by updating the fields in the Partial field, then updates non-nil relationships. Returns an error if there is no work to be done.
func (UpdateSet) UpdateInput ¶ added in v0.11.0
func (u UpdateSet) UpdateInput() models.SceneUpdateInput
UpdateInput converts the UpdateSet into SceneUpdateInput for hook firing purposes.