Documentation
¶
Index ¶
- Variables
- type Classification
- type FilesParams
- type Manager
- type SeriesAdder
- type Service
- func (s *Service) AbortInflight(ctx context.Context) (uint32, error)
- func (s *Service) Cancel(ctx context.Context, id uint32) error
- func (s *Service) Commit(ctx context.Context, id uint32) error
- func (s *Service) Delete(ctx context.Context, id uint32) error
- func (s *Service) Files(ctx context.Context, p FilesParams) ([]*ent.ImportScanFile, uint32, error)
- func (s *Service) Get(ctx context.Context, id uint32) (*ent.ImportScan, error)
- func (s *Service) GetFile(ctx context.Context, scanID, fileID uint32) (*ent.ImportScanFile, error)
- func (s *Service) List(ctx context.Context, page, limit uint16) ([]*ent.ImportScan, uint32, error)
- func (s *Service) StartScan(ctx context.Context, p StartScanParams) (*ent.ImportScan, error)
- func (s *Service) UpdateFileDecision(ctx context.Context, scanID, fileID uint32, ...) (*ent.ImportScanFile, error)
- type StartScanParams
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidPath = errors.New( "source path invalid (not absolute, doesn't exist, or not a directory)", ) ErrPathOutsideLibrary = errors.New( "source path is outside library_path (in_place mode requires inside, rename mode requires outside)", ) ErrScanRunning = errors.New("another scan is already active") ErrScanNotFound = errors.New("scan not found") ErrScanNotReviewable = errors.New("scan is not in awaiting_review state") ErrScanNotCancellable = errors.New("scan is not in a cancellable state") ErrScanNotDeletable = errors.New("scan must be cancelled before delete") )
Functions ¶
This section is empty.
Types ¶
type Classification ¶
type Classification struct {
Kind entimportscanfile.Classification
Candidates []schema.ScannedCandidate
TMDBID uint32
ExistingMovieID uint32
}
Classification holds the matcher's decision for a single scanned file.
func Classify ¶
func Classify( parsed library.ParseResult, hits []metadata.MovieResult, alreadyAdded map[uint32]uint32, ) Classification
Classify decides how a parsed filename + TMDB hits + existing-library lookup fall into one of the four buckets. Existing-row collision wins over confirmed or ambiguous because attaching to an existing row beats creating a duplicate.
type FilesParams ¶
type FilesParams struct {
ScanID uint32
Classification entimportscanfile.Classification // empty = all
Query string
Page uint16
Limit uint16
}
FilesParams is the input for Manager.Files.
type Manager ¶
type Manager interface {
StartScan(ctx context.Context, p StartScanParams) (*ent.ImportScan, error)
Get(ctx context.Context, id uint32) (*ent.ImportScan, error)
List(ctx context.Context, page, limit uint16) ([]*ent.ImportScan, uint32, error)
Files(ctx context.Context, p FilesParams) ([]*ent.ImportScanFile, uint32, error)
GetFile(ctx context.Context, scanID, fileID uint32) (*ent.ImportScanFile, error)
UpdateFileDecision(
ctx context.Context,
scanID, fileID uint32,
decision entimportscanfile.Decision,
tmdbID *uint32,
) (*ent.ImportScanFile, error)
Cancel(ctx context.Context, id uint32) error
Commit(ctx context.Context, id uint32) error
Delete(ctx context.Context, id uint32) error
AbortInflight(ctx context.Context) (uint32, error)
}
Manager is the consumer-facing interface for the bulk-import service.
type SeriesAdder ¶
type SeriesAdder interface {
Add(
ctx context.Context,
tvdbID uint32,
qualityProfile string,
) (*ent.TVShow, error)
}
SeriesAdder creates a TV show (with its seasons and episodes) from a TVDB id. Satisfied by *tvshow.Service; used to adopt shows on series-scan commit.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements Manager.
func NewService ¶
func NewService( store db.Store, meta metadata.Provider, importSvc *library.ImportService, movieSvc *movie.Service, seriesAdder SeriesAdder, posters posters.Manager, libraryDir string, ) *Service
NewService constructs the bulk-import service.
func (*Service) AbortInflight ¶
AbortInflight is the boot-time helper. Called from wire.go before the HTTP server starts.
func (*Service) Files ¶
func (s *Service) Files( ctx context.Context, p FilesParams, ) ([]*ent.ImportScanFile, uint32, error)
func (*Service) StartScan ¶
func (s *Service) StartScan( ctx context.Context, p StartScanParams, ) (*ent.ImportScan, error)
StartScan validates params, creates the ImportScan row, and kicks off the scan goroutine. The goroutine uses context.WithoutCancel because the originating HTTP request ends within milliseconds; cancellation flows through DB state.
func (*Service) UpdateFileDecision ¶
func (s *Service) UpdateFileDecision( ctx context.Context, scanID, fileID uint32, decision entimportscanfile.Decision, tmdbID *uint32, ) (*ent.ImportScanFile, error)
type StartScanParams ¶
type StartScanParams struct {
SourcePath string
Mode entimportscan.Mode // in_place | rename
ImportMode entimportscan.ImportMode // optional — empty means "use library.import_mode default" (only meaningful when Mode == rename)
}
StartScanParams is the input for Service.StartScan.