Documentation ¶
Index ¶
- Variables
- func AddGallery(ctx context.Context, qb models.SceneUpdater, o *models.Scene, galleryID int) error
- func AddPerformer(ctx context.Context, qb models.SceneUpdater, o *models.Scene, performerID int) error
- func AddTag(ctx context.Context, qb models.SceneUpdater, o *models.Scene, tagID int) error
- func BatchProcess(ctx context.Context, reader models.SceneQueryer, ...) error
- func CountByStudioID(ctx context.Context, r models.SceneQueryer, id int, depth *int) (int, error)
- func CountByTagID(ctx context.Context, r models.SceneQueryer, id int, depth *int) (int, 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 TagFinder, markerReader models.SceneMarkerFinder, ...) ([]int, error)
- func GetHash(f models.File, hashAlgorithm models.HashAlgorithm) string
- func GetSceneMarkersJSON(ctx context.Context, markerReader models.SceneMarkerFinder, ...) ([]jsonschema.SceneMarker, error)
- func GetSceneMoviesJSON(ctx context.Context, movieReader models.MovieGetter, scene *models.Scene) ([]jsonschema.SceneMovie, error)
- func GetStudioName(ctx context.Context, reader models.StudioGetter, scene *models.Scene) (string, error)
- func GetTagNames(ctx context.Context, reader TagFinder, scene *models.Scene) ([]string, error)
- func MarkerCountByTagID(ctx context.Context, r models.SceneMarkerQueryer, id int, depth *int) (int, error)
- func MigrateHash(p *paths.Paths, oldHash string, newHash string)
- func PathsFilter(paths []string) *models.SceneFilterType
- func Query(ctx context.Context, qb models.SceneQueryer, ...) ([]*models.Scene, error)
- func QueryOptions(sceneFilter *models.SceneFilterType, findFilter *models.FindFilterType, ...) models.SceneQueryOptions
- func QueryWithCount(ctx context.Context, qb models.SceneQueryer, ...) ([]*models.Scene, int, error)
- func ToBasicJSON(ctx context.Context, reader CoverGetter, scene *models.Scene) (*jsonschema.Scene, error)
- type Config
- type CoverGetter
- type FileDeleter
- type FilenameParser
- type FilenameParserRepository
- type HashFinderCoverUpdater
- 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 ImporterReaderWriter
- type MarkerCreatorUpdater
- 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 MigrateSceneScreenshotsInput
- type MovieNameFinder
- type PerformerNamesFinder
- type ScanCreatorUpdater
- type ScanGenerator
- type ScanHandler
- type ScreenshotMigrator
- type Service
- func (s *Service) AssignFile(ctx context.Context, sceneID int, fileID models.FileID) error
- func (s *Service) Create(ctx context.Context, input *models.Scene, fileIDs []models.FileID, ...) (*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
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 BatchProcess(ctx context.Context, reader models.SceneQueryer, sceneFilter *models.SceneFilterType, findFilter *models.FindFilterType, fn func(scene *models.Scene) error) error
func CountByStudioID ¶ added in v0.22.0
func CountByTagID ¶ added in v0.22.0
func DestroyMarker ¶ added in v0.12.0
func DestroyMarker(ctx context.Context, scene *models.Scene, sceneMarker *models.SceneMarker, qb models.SceneMarkerDestroyer, 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 TagFinder, markerReader models.SceneMarkerFinder, 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 models.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 models.SceneMarkerFinder, tagReader TagFinder, 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 models.MovieGetter, 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 ¶
func GetStudioName(ctx context.Context, reader models.StudioGetter, scene *models.Scene) (string, error)
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 MarkerCountByTagID ¶ added in v0.22.0
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 models.SceneQueryer, 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 models.SceneQueryer, sceneFilter *models.SceneFilterType, findFilter *models.FindFilterType) ([]*models.Scene, int, error)
QueryWithCount queries for scenes, returning the scene objects and the total count.
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 CoverGetter ¶ added in v0.17.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 FilenameParser ¶ added in v0.22.0
type FilenameParser struct { Pattern string ParserInput models.SceneParserInput Filter *models.FindFilterType // contains filtered or unexported fields }
func NewFilenameParser ¶ added in v0.22.0
func NewFilenameParser(filter *models.FindFilterType, config models.SceneParserInput) *FilenameParser
func (*FilenameParser) Parse ¶ added in v0.22.0
func (p *FilenameParser) Parse(ctx context.Context, repo FilenameParserRepository) ([]*models.SceneParserResult, int, error)
type FilenameParserRepository ¶ added in v0.22.0
type FilenameParserRepository struct { Scene models.SceneQueryer Performer PerformerNamesFinder Studio models.StudioQueryer Movie MovieNameFinder Tag models.TagQueryer }
type HashFinderCoverUpdater ¶ added in v0.20.0
type HashFinderCoverUpdater interface { FindByChecksum(ctx context.Context, checksum string) ([]*models.Scene, error) FindByOSHash(ctx context.Context, oshash string) ([]*models.Scene, error) HasCover(ctx context.Context, sceneID int) (bool, error) UpdateCover(ctx context.Context, sceneID int, cover []byte) error }
type Importer ¶
type Importer struct { ReaderWriter ImporterReaderWriter FileFinder models.FileFinder StudioWriter models.StudioFinderCreator GalleryFinder models.GalleryFinder PerformerWriter models.PerformerFinderCreator MovieWriter models.MovieFinderCreator TagWriter models.TagFinderCreator Input jsonschema.Scene MissingRefBehaviour models.ImportMissingRefEnum FileNamingAlgorithm models.HashAlgorithm ID int // contains filtered or unexported fields }
func (*Importer) FindExistingID ¶
type ImporterReaderWriter ¶ added in v0.23.0
type MarkerCreatorUpdater ¶ added in v0.17.0
type MarkerCreatorUpdater interface { models.SceneMarkerCreatorUpdater FindBySceneID(ctx context.Context, sceneID int) ([]*models.SceneMarker, error) }
type MarkerImporter ¶
type MarkerImporter struct { SceneID int ReaderWriter MarkerCreatorUpdater TagWriter models.TagFinderCreator 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 MigrateSceneScreenshotsInput ¶ added in v0.20.0
type MovieNameFinder ¶ added in v0.22.0
type PerformerNamesFinder ¶ added in v0.22.0
type ScanCreatorUpdater ¶ added in v0.23.0
type ScanCreatorUpdater interface { FindByFileID(ctx context.Context, fileID models.FileID) ([]*models.Scene, error) FindByFingerprints(ctx context.Context, fp []models.Fingerprint) ([]*models.Scene, error) GetFiles(ctx context.Context, relatedID int) ([]*models.VideoFile, error) Create(ctx context.Context, newScene *models.Scene, fileIDs []models.FileID) error UpdatePartial(ctx context.Context, id int, updatedScene models.ScenePartial) (*models.Scene, error) AddFileID(ctx context.Context, id int, fileID models.FileID) error }
type ScanGenerator ¶ added in v0.17.0
type ScanHandler ¶ added in v0.17.0
type ScanHandler struct { CreatorUpdater ScanCreatorUpdater ScanGenerator ScanGenerator CaptionUpdater video.CaptionUpdater PluginCache *plugin.Cache FileNamingAlgorithm models.HashAlgorithm Paths *paths.Paths }
type ScreenshotMigrator ¶ added in v0.20.0
type ScreenshotMigrator struct { Options MigrateSceneScreenshotsInput SceneUpdater HashFinderCoverUpdater TxnManager txn.Manager }
func (*ScreenshotMigrator) MigrateScreenshots ¶ added in v0.20.0
func (m *ScreenshotMigrator) MigrateScreenshots(ctx context.Context, screenshotPath string) error
type Service ¶ added in v0.17.0
type Service struct { File models.FileReaderWriter Repository models.SceneReaderWriter MarkerRepository models.SceneMarkerReaderWriter 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
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.