Documentation ¶
Index ¶
- Constants
- Variables
- func AddGallery(qb models.SceneReaderWriter, id int, galleryID int) (bool, error)
- func AddPerformer(qb models.SceneReaderWriter, id int, performerID int) (bool, error)
- func AddTag(qb models.SceneReaderWriter, id int, tagID int) (bool, error)
- func BatchProcess(ctx context.Context, reader models.SceneReader, ...) error
- func CleanCaptions(scenePath string, captions []*models.SceneCaption) (cleanedCaptions []*models.SceneCaption, changed bool)
- func Destroy(scene *models.Scene, repo models.Repository, fileDeleter *FileDeleter, ...) error
- func DestroyMarker(scene *models.Scene, sceneMarker *models.SceneMarker, ...) error
- func FileScanner(hasher file.Hasher, fileNamingAlgorithm models.HashAlgorithm, ...) file.Scanner
- func FilterFromPaths(paths []string) *models.SceneFilterType
- func GenerateCaptionCandidates(captionPath string, exts []string) []string
- func GetCaptionPath(path, lang, suffix string) string
- func GetCaptionsLangFromPath(captionPath string) string
- func GetDependentMovieIDs(sceneReader models.SceneReader, scene *models.Scene) ([]int, error)
- func GetDependentTagIDs(tags models.TagReader, markerReader models.SceneMarkerReader, ...) ([]int, error)
- func GetFunscriptPath(path string) string
- func GetSceneMarkersJSON(markerReader models.SceneMarkerReader, tagReader models.TagReader, ...) ([]jsonschema.SceneMarker, error)
- func GetSceneMoviesJSON(movieReader models.MovieReader, sceneReader models.SceneReader, ...) ([]jsonschema.SceneMovie, error)
- func GetStudioName(reader models.StudioReader, scene *models.Scene) (string, error)
- func GetTagNames(reader models.TagReader, scene *models.Scene) ([]string, error)
- func IsLangInCaptions(lang string, ext string, captions []*models.SceneCaption) bool
- func IsValidLanguage(lang string) bool
- func MigrateHash(p *paths.Paths, oldHash string, newHash string)
- func PathsFilter(paths []string) *models.SceneFilterType
- func Query(qb Queryer, sceneFilter *models.SceneFilterType, ...) ([]*models.Scene, error)
- func QueryOptions(sceneFilter *models.SceneFilterType, findFilter *models.FindFilterType, ...) models.SceneQueryOptions
- func QueryWithCount(qb Queryer, sceneFilter *models.SceneFilterType, ...) ([]*models.Scene, int, error)
- func ReadSubs(path string) (*astisub.Subtitles, error)
- func SetScreenshot(paths *paths.Paths, checksum string, imageData []byte) error
- func ToBasicJSON(reader models.SceneReader, scene *models.Scene) (*jsonschema.Scene, error)
- func UpdateChecksum(qb models.SceneWriter, id int, checksum string) (*models.Scene, error)
- func UpdateFileModTime(qb models.SceneWriter, id int, modTime models.NullSQLiteTimestamp) (*models.Scene, error)
- func UpdateFormat(qb models.SceneWriter, id int, format string) (*models.Scene, error)
- func UpdateOSHash(qb models.SceneWriter, id int, oshash string) (*models.Scene, error)
- type FileDeleter
- type Importer
- type MarkerImporter
- type PathsScreenshotSetter
- type Queryer
- type Scanner
- type ScreenshotSetter
- type UpdateSet
Constants ¶
const LangUnknown = "00"
to be used for captions without a language code in the filename ISO 639-1 uses 2 or 3 a-z chars for codes so 00 is a safe non valid choise https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
Variables ¶
var CaptionExts = []string{"vtt", "srt"} // in a case where vtt and srt files are both provided prioritize vtt file due to native support
var ErrEmptyUpdater = errors.New("no fields have been set")
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.SceneReader, sceneFilter *models.SceneFilterType, findFilter *models.FindFilterType, fn func(scene *models.Scene) error) error
func CleanCaptions ¶ added in v0.15.0
func CleanCaptions(scenePath string, captions []*models.SceneCaption) (cleanedCaptions []*models.SceneCaption, changed bool)
CleanCaptions removes non existent/accessible language codes from captions
func Destroy ¶ added in v0.12.0
func Destroy(scene *models.Scene, repo models.Repository, fileDeleter *FileDeleter, deleteGenerated, deleteFile bool) error
Destroy deletes a scene and its associated relationships from the database.
func DestroyMarker ¶ added in v0.12.0
func DestroyMarker(scene *models.Scene, sceneMarker *models.SceneMarker, qb models.SceneMarkerWriter, 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 FileScanner ¶ added in v0.11.0
func FilterFromPaths ¶ added in v0.11.0
func FilterFromPaths(paths []string) *models.SceneFilterType
FilterFromPaths creates a SceneFilterType that filters using the provided paths.
func GenerateCaptionCandidates ¶ added in v0.15.0
GenerateCaptionCandidates generates a list of filenames with exts as extensions that can associated with the caption
func GetCaptionPath ¶ added in v0.15.0
GetCaptionPath generates the path of a caption from a given file path, wanted language and caption sufffix
func GetCaptionsLangFromPath ¶ added in v0.15.0
GetCaptionsLangFromPath returns the language code from a given captions path If no valid language is present LangUknown is returned
func GetDependentMovieIDs ¶
GetDependentMovieIDs returns a slice of movie IDs that this scene references.
func GetDependentTagIDs ¶
func GetDependentTagIDs(tags models.TagReader, markerReader models.SceneMarkerReader, scene *models.Scene) ([]int, error)
GetDependentTagIDs returns a slice of unique tag IDs that this scene references.
func GetFunscriptPath ¶ added in v0.14.0
GetFunscriptPath returns the path of a file with the extension changed to .funscript
func GetSceneMarkersJSON ¶
func GetSceneMarkersJSON(markerReader models.SceneMarkerReader, tagReader models.TagReader, 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(movieReader models.MovieReader, sceneReader models.SceneReader, 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 IsLangInCaptions ¶ added in v0.15.0
func IsLangInCaptions(lang string, ext string, captions []*models.SceneCaption) bool
IsLangInCaptions returns true if lang is present in the captions
func IsValidLanguage ¶ added in v0.15.0
IsValidLanguage checks whether the given string is a valid ISO 639 language code
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(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(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(reader models.SceneReader, 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.
func UpdateChecksum ¶ added in v0.5.0
func UpdateFileModTime ¶ added in v0.5.0
func UpdateFileModTime(qb models.SceneWriter, id int, modTime models.NullSQLiteTimestamp) (*models.Scene, error)
func UpdateFormat ¶ added in v0.5.0
func UpdateOSHash ¶ added in v0.5.0
Types ¶
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 Importer ¶
type Importer struct { ReaderWriter models.SceneReaderWriter StudioWriter models.StudioReaderWriter GalleryWriter models.GalleryReaderWriter PerformerWriter models.PerformerReaderWriter MovieWriter models.MovieReaderWriter TagWriter models.TagReaderWriter Input jsonschema.Scene Path string MissingRefBehaviour models.ImportMissingRefEnum FileNamingAlgorithm models.HashAlgorithm ID int // contains filtered or unexported fields }
func (*Importer) FindExistingID ¶
func (*Importer) PostImport ¶
type MarkerImporter ¶
type MarkerImporter struct { SceneID int ReaderWriter models.SceneMarkerReaderWriter TagWriter models.TagReaderWriter Input jsonschema.SceneMarker MissingRefBehaviour models.ImportMissingRefEnum // contains filtered or unexported fields }
func (*MarkerImporter) Create ¶
func (i *MarkerImporter) Create() (*int, error)
func (*MarkerImporter) FindExistingID ¶
func (i *MarkerImporter) FindExistingID() (*int, error)
func (*MarkerImporter) Name ¶
func (i *MarkerImporter) Name() string
func (*MarkerImporter) PostImport ¶
func (i *MarkerImporter) PostImport(id int) error
func (*MarkerImporter) PreImport ¶
func (i *MarkerImporter) PreImport() error
func (*MarkerImporter) Update ¶
func (i *MarkerImporter) Update(id int) error
type PathsScreenshotSetter ¶ added in v0.11.0
type PathsScreenshotSetter struct { Paths *paths.Paths FileNamingAlgorithm models.HashAlgorithm }
func (*PathsScreenshotSetter) SetScreenshot ¶ added in v0.11.0
func (ss *PathsScreenshotSetter) SetScreenshot(scene *models.Scene, imageData []byte) error
type Queryer ¶ added in v0.11.0
type Queryer interface {
Query(options models.SceneQueryOptions) (*models.SceneQueryResult, error)
}
type Scanner ¶ added in v0.11.0
type Scanner struct { file.Scanner StripFileExtension bool UseFileMetadata bool FileNamingAlgorithm models.HashAlgorithm CaseSensitiveFs bool TxnManager models.TransactionManager Paths *paths.Paths Screenshotter screenshotter VideoFileCreator videoFileCreator PluginCache *plugin.Cache MutexManager *utils.MutexManager }
func (*Scanner) ScanExisting ¶ added in v0.11.0
type ScreenshotSetter ¶ added in v0.11.0
type UpdateSet ¶ added in v0.11.0
type UpdateSet struct { ID int Partial models.ScenePartial // Not set if nil. Set to []int{} to clear existing PerformerIDs []int // Not set if nil. Set to []int{} to clear existing TagIDs []int // Not set if nil. Set to []int{} to clear existing StashIDs []models.StashID // 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(qb models.SceneWriter, 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.