mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-08 14:26:37 +08:00
fix media workflows and download organization
This commit is contained in:
@@ -27,11 +27,12 @@ import (
|
||||
|
||||
// OrganizerService moves/renames files into library structures.
|
||||
type OrganizerService struct {
|
||||
cfg *config.Config
|
||||
log *zap.Logger
|
||||
repo *repository.Container
|
||||
probe *FFprobeService // optional; used for 洗版 resolution comparison
|
||||
scraper *ScraperService // optional; used to identify metadata before rename
|
||||
cfg *config.Config
|
||||
log *zap.Logger
|
||||
repo *repository.Container
|
||||
probe *FFprobeService // optional; used for 洗版 resolution comparison
|
||||
scraper *ScraperService // optional; used to identify metadata before rename
|
||||
activeDownloadPaths func(context.Context) []string
|
||||
}
|
||||
|
||||
// NewOrganizerService is the constructor.
|
||||
@@ -48,6 +49,23 @@ func (o *OrganizerService) SetProbe(p *FFprobeService) { o.probe = p }
|
||||
// metadata before it decides the final folder and filename.
|
||||
func (o *OrganizerService) SetScraper(s *ScraperService) { o.scraper = s }
|
||||
|
||||
// SetActiveDownloadPathProvider wires a live downloader snapshot. Directory
|
||||
// organize must never move/copy files that still belong to an unfinished
|
||||
// torrent, regardless of which UI switch triggered the organize operation.
|
||||
func (o *OrganizerService) SetActiveDownloadPathProvider(provider func(context.Context) []string) {
|
||||
o.activeDownloadPaths = provider
|
||||
}
|
||||
|
||||
func (o *OrganizerService) SetActiveDownloadProvider(provider func(context.Context) []QBitTorrent) {
|
||||
if provider == nil {
|
||||
o.activeDownloadPaths = nil
|
||||
return
|
||||
}
|
||||
o.activeDownloadPaths = func(ctx context.Context) []string {
|
||||
return activeDownloadPathCandidates(provider(ctx), nil)
|
||||
}
|
||||
}
|
||||
|
||||
// OrganizeMedia moves a single media file into the target library directory.
|
||||
// It auto-detects whether the media is a movie or TV episode based on the
|
||||
// parsed season/episode numbers and builds the destination path accordingly.
|
||||
|
||||
Reference in New Issue
Block a user