manager

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: AGPL-3.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const APIKeySubject = "APIKey"

Variables

View Source
var ErrInvalidToken = errors.New("invalid apikey")

Functions

func DeleteGalleryFile added in v0.4.0

func DeleteGalleryFile(gallery *models.Gallery)

func DeleteGeneratedImageFiles added in v0.4.0

func DeleteGeneratedImageFiles(image *models.Image)

DeleteGeneratedImageFiles deletes generated files for the provided image.

func DeleteGeneratedSceneFiles

func DeleteGeneratedSceneFiles(scene *models.Scene, fileNamingAlgo models.HashAlgorithm)

DeleteGeneratedSceneFiles deletes generated files for the provided scene.

func DeleteImageFile added in v0.4.0

func DeleteImageFile(image *models.Image)

DeleteImageFile deletes the image file from the filesystem.

func DeleteSceneFile

func DeleteSceneFile(scene *models.Scene)

DeleteSceneFile deletes the scene video file from the filesystem.

func DeleteSceneMarkerFiles added in v0.2.0

func DeleteSceneMarkerFiles(scene *models.Scene, seconds int, fileNamingAlgo models.HashAlgorithm)

DeleteSceneMarkerFiles deletes generated files for a scene marker with the provided scene and timestamp.

func DestroyScene

func DestroyScene(scene *models.Scene, repo models.Repository) (func(), error)

DestroyScene deletes a scene and its associated relationships from the database. Returns a function to perform any post-commit actions.

func DestroySceneMarker added in v0.5.0

func DestroySceneMarker(scene *models.Scene, sceneMarker *models.SceneMarker, qb models.SceneMarkerWriter) (func(), error)

DestroySceneMarker 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 GenerateAPIKey added in v0.7.0

func GenerateAPIKey(userID string) (string, error)

func GetInstance

func GetInstance() *singleton

func GetSceneFileContainer added in v0.3.0

func GetSceneFileContainer(scene *models.Scene) (ffmpeg.Container, error)

func GetSceneStreamPaths added in v0.3.0

func GetSceneStreamPaths(scene *models.Scene, directStreamURL string, maxStreamingTranscodeSize models.StreamingResolutionEnum) ([]*models.SceneStreamEndpoint, error)

func GetUserIDFromAPIKey added in v0.7.0

func GetUserIDFromAPIKey(apiKey string) (string, error)

GetUserIDFromAPIKey validates the provided api key and returns the user ID

func HasTranscode

func HasTranscode(scene *models.Scene, fileNamingAlgo models.HashAlgorithm) bool

HasTranscode returns true if a transcoded video exists for the provided scene. It will check using the OSHash of the scene first, then fall back to the checksum.

func Initialize

func Initialize() *singleton

func KillRunningStreams

func KillRunningStreams(path string)

func MigrateHash added in v0.5.0

func MigrateHash(oldHash string, newHash string)

func RegisterStream

func RegisterStream(filepath string, w *http.ResponseWriter)

func SetSceneScreenshot

func SetSceneScreenshot(checksum string, imageData []byte) error

func ValidateModifyStudio added in v0.3.0

func ValidateModifyStudio(studio models.StudioPartial, qb models.StudioReader) error

func ValidateVideoFileNamingAlgorithm added in v0.3.0

func ValidateVideoFileNamingAlgorithm(txnManager models.TransactionManager, newValue models.HashAlgorithm) error

ValidateVideoFileNamingAlgorithm validates changing the VideoFileNamingAlgorithm configuration flag.

If setting VideoFileNamingAlgorithm to MD5, then this function will ensure that all checksum values are set on all scenes.

Likewise, if VideoFileNamingAlgorithm is set to oshash, then this function will ensure that all oshash values are set on all scenes.

func WaitAndDeregisterStream

func WaitAndDeregisterStream(filepath string, w *http.ResponseWriter, r *http.Request)

Types

type APIKeyClaims added in v0.7.0

type APIKeyClaims struct {
	UserID string `json:"uid"`
	jwt.StandardClaims
}

type CleanTask

type CleanTask struct {
	TxnManager models.TransactionManager
	Scene      *models.Scene
	Gallery    *models.Gallery
	Image      *models.Image
	// contains filtered or unexported fields
}

func (*CleanTask) Start

func (t *CleanTask) Start(wg *sync.WaitGroup, dryRun bool)

type DownloadStore added in v0.4.0

type DownloadStore struct {
	// contains filtered or unexported fields
}

DownloadStore manages single-use generated files for the UI to download.

func NewDownloadStore added in v0.4.0

func NewDownloadStore() *DownloadStore

func (*DownloadStore) RegisterFile added in v0.4.0

func (s *DownloadStore) RegisterFile(fp string, contentType string, keep bool) string

func (*DownloadStore) Serve added in v0.4.0

func (s *DownloadStore) Serve(hash string, w http.ResponseWriter, r *http.Request)

type ExportTask

type ExportTask struct {
	Mappings *jsonschema.Mappings

	DownloadHash string
	// contains filtered or unexported fields
}

func CreateExportTask added in v0.4.0

func CreateExportTask(a models.HashAlgorithm, input models.ExportObjectsInput) *ExportTask

func (*ExportTask) ExportGalleries

func (t *ExportTask) ExportGalleries(workers int, repo models.ReaderRepository)

func (*ExportTask) ExportImages added in v0.4.0

func (t *ExportTask) ExportImages(workers int, repo models.ReaderRepository)

func (*ExportTask) ExportMovies added in v0.2.0

func (t *ExportTask) ExportMovies(workers int, repo models.ReaderRepository)

func (*ExportTask) ExportPerformers

func (t *ExportTask) ExportPerformers(workers int, repo models.ReaderRepository)

func (*ExportTask) ExportScenes

func (t *ExportTask) ExportScenes(workers int, repo models.ReaderRepository)

func (*ExportTask) ExportScrapedItems

func (t *ExportTask) ExportScrapedItems(repo models.ReaderRepository)

func (*ExportTask) ExportStudios

func (t *ExportTask) ExportStudios(workers int, repo models.ReaderRepository)

func (*ExportTask) ExportTags added in v0.3.0

func (t *ExportTask) ExportTags(workers int, repo models.ReaderRepository)

func (*ExportTask) Start

func (t *ExportTask) Start(wg *sync.WaitGroup)

type GenerateMarkersTask

type GenerateMarkersTask struct {
	TxnManager models.TransactionManager
	Scene      *models.Scene
	Marker     *models.SceneMarker
	Overwrite  bool
	// contains filtered or unexported fields
}

func (*GenerateMarkersTask) Start

type GeneratePhashTask added in v0.7.0

type GeneratePhashTask struct {
	Scene models.Scene
	// contains filtered or unexported fields
}

func (*GeneratePhashTask) Start added in v0.7.0

type GeneratePreviewTask

type GeneratePreviewTask struct {
	Scene        models.Scene
	ImagePreview bool

	Options models.GeneratePreviewOptionsInput

	Overwrite bool
	// contains filtered or unexported fields
}

func (*GeneratePreviewTask) Start

type GenerateScreenshotTask added in v0.2.0

type GenerateScreenshotTask struct {
	Scene        models.Scene
	ScreenshotAt *float64
	// contains filtered or unexported fields
}

func (*GenerateScreenshotTask) Start added in v0.2.0

func (t *GenerateScreenshotTask) Start(wg *sync.WaitGroup)

type GenerateSpriteTask

type GenerateSpriteTask struct {
	Scene     models.Scene
	Overwrite bool
	// contains filtered or unexported fields
}

func (*GenerateSpriteTask) Start

type GenerateTranscodeTask

type GenerateTranscodeTask struct {
	Scene     models.Scene
	Overwrite bool
	// contains filtered or unexported fields
}

func (*GenerateTranscodeTask) Start

type GeneratorInfo

type GeneratorInfo struct {
	ChunkCount     int
	FrameRate      float64
	NumberOfFrames int

	// NthFrame used for sprite generation
	NthFrame int

	ChunkDuration float64
	ExcludeStart  string
	ExcludeEnd    string

	VideoFile ffmpeg.VideoFile

	Audio bool // used for preview generation
}

type ImportTask

type ImportTask struct {
	BaseDir             string
	TmpZip              string
	Reset               bool
	DuplicateBehaviour  models.ImportDuplicateEnum
	MissingRefBehaviour models.ImportMissingRefEnum
	// contains filtered or unexported fields
}

func CreateImportTask added in v0.4.0

func CreateImportTask(a models.HashAlgorithm, input models.ImportObjectsInput) (*ImportTask, error)

func (*ImportTask) GetDescription added in v0.8.0

func (t *ImportTask) GetDescription() string

func (*ImportTask) ImportGalleries

func (t *ImportTask) ImportGalleries(ctx context.Context)

func (*ImportTask) ImportImages added in v0.4.0

func (t *ImportTask) ImportImages(ctx context.Context)

func (*ImportTask) ImportMovies added in v0.2.0

func (t *ImportTask) ImportMovies(ctx context.Context)

func (*ImportTask) ImportPerformers

func (t *ImportTask) ImportPerformers(ctx context.Context)

func (*ImportTask) ImportScenes

func (t *ImportTask) ImportScenes(ctx context.Context)

func (*ImportTask) ImportScrapedItems

func (t *ImportTask) ImportScrapedItems(ctx context.Context)

func (*ImportTask) ImportStudio added in v0.3.0

func (t *ImportTask) ImportStudio(studioJSON *jsonschema.Studio, pendingParent map[string][]*jsonschema.Studio, readerWriter models.StudioReaderWriter) error

func (*ImportTask) ImportStudios

func (t *ImportTask) ImportStudios(ctx context.Context)

func (*ImportTask) ImportTags

func (t *ImportTask) ImportTags(ctx context.Context)

func (*ImportTask) Start

func (t *ImportTask) Start(wg *sync.WaitGroup)

type MigrateHashTask added in v0.3.0

type MigrateHashTask struct {
	Scene *models.Scene
	// contains filtered or unexported fields
}

MigrateHashTask renames generated files between oshash and MD5 based on the value of the fileNamingAlgorithm flag.

func (*MigrateHashTask) Start added in v0.3.0

func (t *MigrateHashTask) Start(wg *sync.WaitGroup)

Start starts the task.

type PhashGenerator added in v0.7.0

type PhashGenerator struct {
	Info *GeneratorInfo

	VideoChecksum string
	Columns       int
	Rows          int
}

func NewPhashGenerator added in v0.7.0

func NewPhashGenerator(videoFile ffmpeg.VideoFile, checksum string) (*PhashGenerator, error)

func (*PhashGenerator) Generate added in v0.7.0

func (g *PhashGenerator) Generate() (*uint64, error)

type PreviewGenerator

type PreviewGenerator struct {
	Info *GeneratorInfo

	VideoChecksum   string
	VideoFilename   string
	ImageFilename   string
	OutputDirectory string

	GenerateVideo bool
	GenerateImage bool

	PreviewPreset string

	Overwrite bool
}

func NewPreviewGenerator

func NewPreviewGenerator(videoFile ffmpeg.VideoFile, videoChecksum string, videoFilename string, imageFilename string, outputDirectory string, generateVideo bool, generateImage bool, previewPreset string) (*PreviewGenerator, error)

func (*PreviewGenerator) Generate

func (g *PreviewGenerator) Generate() error

type ScanJob added in v0.8.0

type ScanJob struct {
	// contains filtered or unexported fields
}

func (*ScanJob) Execute added in v0.8.0

func (j *ScanJob) Execute(ctx context.Context, progress *job.Progress)

type ScanTask

type ScanTask struct {
	TxnManager         models.TransactionManager
	FilePath           string
	UseFileMetadata    bool
	StripFileExtension bool

	GenerateSprite       bool
	GeneratePhash        bool
	GeneratePreview      bool
	GenerateImagePreview bool

	CaseSensitiveFs bool
	// contains filtered or unexported fields
}

func (*ScanTask) Start

func (t *ScanTask) Start(wg *sizedwaitgroup.SizedWaitGroup)

type SceneFilenameParser

type SceneFilenameParser struct {
	Pattern     string
	ParserInput models.SceneParserInput
	Filter      *models.FindFilterType
	// contains filtered or unexported fields
}

func NewSceneFilenameParser

func NewSceneFilenameParser(filter *models.FindFilterType, config models.SceneParserInput) *SceneFilenameParser

func (*SceneFilenameParser) Parse

type SceneServer added in v0.8.0

type SceneServer struct {
	TXNManager models.TransactionManager
}

func (*SceneServer) ServeScreenshot added in v0.8.0

func (s *SceneServer) ServeScreenshot(scene *models.Scene, w http.ResponseWriter, r *http.Request)

func (*SceneServer) StreamSceneDirect added in v0.8.0

func (s *SceneServer) StreamSceneDirect(scene *models.Scene, w http.ResponseWriter, r *http.Request)

type SpriteGenerator

type SpriteGenerator struct {
	Info *GeneratorInfo

	VideoChecksum   string
	ImageOutputPath string
	VTTOutputPath   string
	Rows            int
	Columns         int

	Overwrite bool
}

func NewSpriteGenerator

func NewSpriteGenerator(videoFile ffmpeg.VideoFile, videoChecksum string, imageOutputPath string, vttOutputPath string, rows int, cols int) (*SpriteGenerator, error)

func (*SpriteGenerator) Generate

func (g *SpriteGenerator) Generate() error

type StashBoxPerformerTagTask added in v0.7.0

type StashBoxPerformerTagTask struct {
	// contains filtered or unexported fields
}

func (*StashBoxPerformerTagTask) Description added in v0.8.0

func (t *StashBoxPerformerTagTask) Description() string

func (*StashBoxPerformerTagTask) Start added in v0.7.0

func (t *StashBoxPerformerTagTask) Start(wg *sync.WaitGroup)

type Task

type Task interface {
	Start(wg *sync.WaitGroup)
	GetDescription() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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