Documentation
¶
Index ¶
- func DetailNFO(detail domain.MovieDetail) nfo.Movie
- func ExportLocalMovie(embyDir, publicURL, strmToken string, record *ent.Movie, ...) (bool, error)
- func MovieArtwork(record *ent.Movie) mediaimage.Artwork
- func MovieNFO(record *ent.Movie) (nfo.Movie, error)
- func SaveMovieMetadata(ctx context.Context, tx *ent.Tx, id int, doc nfo.Movie) error
- func SnapshotMatches(record *ent.Movie, source domain.LibrarySource) bool
- func VideoFingerprint(files []pan.File) string
- type Dependencies
- type MetadataPayload
- type MetadataSource
- type MovieDirectory
- type Notifier
- type Payload
- type Service
- func (service *Service) Artwork(key string) ([]byte, error)
- func (service *Service) Close()
- func (service *Service) Directories(ctx context.Context, sess drive.Session, input MetadataPayload) ([]MovieDirectory, error)
- func (service *Service) Finished(ctx context.Context, tx *ent.Tx, job tasks.Job, result error) (tasks.Change, error)
- func (service *Service) Scrape(ctx context.Context, job tasks.Job) error
- func (service *Service) TryLockArtwork() bool
- func (service *Service) UnlockArtwork()
- type SubtitleExporter
- type SubtitleQueue
- type SubtitleTask
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetailNFO ¶
func DetailNFO(detail domain.MovieDetail) nfo.Movie
DetailNFO converts a catalogue MovieDetail into an NFO Document.
func ExportLocalMovie ¶ added in v0.1.1
func ExportLocalMovie(embyDir, publicURL, strmToken string, record *ent.Movie, images *mediaimage.Cache) (bool, error)
ExportLocalMovie repairs missing or changed outputs using saved metadata and artwork.
func MovieArtwork ¶
func MovieArtwork(record *ent.Movie) mediaimage.Artwork
MovieArtwork extracts the artwork URLs from an indexed ent.Movie record.
func SaveMovieMetadata ¶
SaveMovieMetadata updates an ent.Movie record and associates actors and tags from an NFO document.
func SnapshotMatches ¶ added in v0.1.3
func SnapshotMatches(record *ent.Movie, source domain.LibrarySource) bool
SnapshotMatches checks the exported videos and generated poster revision.
func VideoFingerprint ¶
VideoFingerprint computes a deterministic hash of a movie's video files.
Types ¶
type Dependencies ¶ added in v0.1.3
type Dependencies struct {
ExportManager *export.Manager
MediaNotifier export.MediaNotifier
Subtitles SubtitleExporter
}
type MetadataPayload ¶
type MetadataPayload struct {
Rebuild bool `json:"rebuild,omitempty"`
Source domain.LibrarySource `json:"source"`
ScanTaskID int `json:"scan_task_id"`
MovieID int `json:"movie_id"`
Code string `json:"code"`
JavDBID string `json:"javdb_id,omitempty"`
ManualCode string `json:"manual_code,omitempty"`
}
MetadataPayload describes the input for a movie scrape job.
type MetadataSource ¶ added in v0.2.0
type MetadataSource interface {
Resolve(context.Context, domain.MovieRef) (domain.MovieMetadata, error)
Fallback(context.Context, domain.MovieRef) (domain.MovieMetadata, error)
Image(context.Context, domain.ImageCandidate) (domain.Media, error)
}
MetadataSource resolves independent sources and downloads their image candidates.
type MovieDirectory ¶
MovieDirectory groups a movie's indexed videos with the current directory listing.
type Notifier ¶
type Notifier interface {
NotifyLibraryChanged()
WakePool()
}
Notifier reports committed library updates and queued follow-up work.
type Payload ¶ added in v0.2.0
type Payload struct {
MetadataPayload
MetadataReady bool `json:"metadata_ready,omitempty"`
Document nfo.Movie `json:"document"`
Artwork *mediaimage.Artwork `json:"artwork,omitempty"`
PosterVersion int `json:"poster_version,omitempty"`
Completed bool `json:"completed,omitempty"`
}
Payload holds the checkpoints of one movie scraping workflow.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages movie metadata scraping and artwork caching.
func New ¶
func New(db *ent.Client, d *drive.Drive, metadata MetadataSource, images *mediaimage.Cache, notifier Notifier, deps Dependencies) *Service
New installs dependencies before starting subtitle workers.
func (*Service) Close ¶
func (service *Service) Close()
Close releases resources and terminates background workers.
func (*Service) Directories ¶
func (service *Service) Directories(ctx context.Context, sess drive.Session, input MetadataPayload) ([]MovieDirectory, error)
Directories returns all directories containing media files for the movie.
func (*Service) Finished ¶
func (service *Service) Finished(ctx context.Context, tx *ent.Tx, job tasks.Job, result error) (tasks.Change, error)
Finished marks the movie scrape as failed inside the completion transaction when a scrape job fails. Failures change the library view; successes only advance the download workflow projection.
func (*Service) Scrape ¶
Scrape runs one recoverable movie workflow: metadata, artwork, then export.
func (*Service) TryLockArtwork ¶
TryLockArtwork attempts to acquire the artwork lock for cache maintenance.
func (*Service) UnlockArtwork ¶
func (service *Service) UnlockArtwork()
UnlockArtwork releases the artwork lock.
type SubtitleExporter ¶ added in v0.1.3
type SubtitleExporter interface {
Export(ctx context.Context, movieID int, target subtitlemeta.Target) (int, error)
}
SubtitleExporter writes a movie's subtitles beside its exported .strm file.
type SubtitleQueue ¶
type SubtitleQueue struct {
// contains filtered or unexported fields
}
SubtitleQueue is a bounded, concurrency-controlled background worker queue for subtitle processing.
func (*SubtitleQueue) Close ¶
func (q *SubtitleQueue) Close()
Close gracefully stops the worker pool and waits for active tasks to finish.
func (*SubtitleQueue) Enqueue ¶
func (q *SubtitleQueue) Enqueue(task SubtitleTask)
Enqueue adds a subtitle task to the queue if not already pending and queue has capacity.
type SubtitleTask ¶
type SubtitleTask struct {
MovieID int
Target subtitlemeta.Target
}
SubtitleTask exports the subtitles of one movie after its artwork and .strm are written.