Documentation
¶
Index ¶
- func DownloadMediaFiles(movies map[string]*models.Movie, matches []matcher.MatchResult, ...) (int, error)
- func GenerateNFOs(movies map[string]*models.Movie, matches []matcher.MatchResult, ...) (int, error)
- func RunWithConfig(loadConfig ConfigLoader, fn ConfigFunc) func(*cobra.Command, []string) error
- func RunWithDeps(loadConfig ConfigLoader, newDeps DependencyFactory, ...) func(*cobra.Command, []string) error
- func ScanAndMatch(sourcePath string, recursive bool, fileScanner *scanner.Scanner, ...) ([]matcher.MatchResult, *scanner.ScanResult, error)
- func ScrapeMetadata(matches []matcher.MatchResult, movieRepo *database.MovieRepository, ...) (map[string]*models.Movie, int, int, error)
- type ConfigFunc
- type ConfigLoader
- type Dependencies
- type DependenciesInterface
- type DependenciesOptions
- type DependencyFactory
- type MediaDownloader
- type OverrideApplier
- type RunFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadMediaFiles ¶
func DownloadMediaFiles( movies map[string]*models.Movie, matches []matcher.MatchResult, mediaDownloader MediaDownloader, fileOrganizer *organizer.Organizer, downloadCover bool, downloadExtrafanart bool, moveToFolder bool, destPath string, forceUpdate bool, dryRun bool, ) (int, error)
DownloadMediaFiles downloads covers, posters, screenshots, and trailers. Returns the count of files downloaded and any error.
func GenerateNFOs ¶
func GenerateNFOs( movies map[string]*models.Movie, matches []matcher.MatchResult, nfoGenerator *nfo.Generator, fileOrganizer *organizer.Organizer, nfoEnabled bool, moveToFolder bool, perFileNFO bool, destPath string, forceUpdate bool, dryRun bool, ) (int, error)
GenerateNFOs generates NFO files for the given movies. Returns the count of NFOs generated and any error.
func RunWithConfig ¶
func RunWithConfig( loadConfig ConfigLoader, fn ConfigFunc, ) func(*cobra.Command, []string) error
RunWithConfig wraps a command that only needs config
func RunWithDeps ¶
func RunWithDeps( loadConfig ConfigLoader, newDeps DependencyFactory, applyOverrides OverrideApplier, fn RunFunc, ) func(*cobra.Command, []string) error
RunWithDeps wraps a command function with dependency injection This is the factory that creates the actual wrapper
func ScanAndMatch ¶
func ScanAndMatch( sourcePath string, recursive bool, fileScanner *scanner.Scanner, fileMatcher *matcher.Matcher, ) ([]matcher.MatchResult, *scanner.ScanResult, error)
ScanAndMatch scans files and extracts JAV IDs. Returns matched results, scan result, and error.
func ScrapeMetadata ¶
func ScrapeMetadata( matches []matcher.MatchResult, movieRepo *database.MovieRepository, registry *models.ScraperRegistry, agg *aggregator.Aggregator, scraperPriority []string, forceRefresh bool, ) (map[string]*models.Movie, int, int, error)
ScrapeMetadata scrapes and aggregates metadata with caching support. Returns movies map, scrapedCount, cachedCount, and error.
Types ¶
type ConfigFunc ¶
ConfigFunc is a function that only needs config
type ConfigLoader ¶
ConfigLoader is a function that loads configuration
type Dependencies ¶
type Dependencies struct {
Config *config.Config
DB *database.DB
ScraperRegistry *models.ScraperRegistry
}
Dependencies contains all external dependencies that CLI commands need. This struct enables dependency injection for testing. Implements DependenciesInterface.
func NewDependencies ¶
func NewDependencies(cfg *config.Config) (*Dependencies, error)
NewDependencies creates a new Dependencies instance from a config. It initializes the database connection and scraper registry. This is the production constructor - for testable constructor see NewDependenciesWithOptions.
func NewDependenciesWithOptions ¶
func NewDependenciesWithOptions(cfg *config.Config, opts *DependenciesOptions) (*Dependencies, error)
NewDependenciesWithOptions creates a new Dependencies instance with optional dependency injection. If opts is nil or opts fields are nil, real implementations are created. If opts fields are non-nil, injected dependencies are used (for testing). Added in Epic 6 Story 6.1 to enable testable CLI commands.
func (*Dependencies) Close ¶
func (d *Dependencies) Close() error
Close closes all resources held by the Dependencies (implements DependenciesInterface). Should be called when done using the Dependencies.
func (*Dependencies) GetConfig ¶
func (d *Dependencies) GetConfig() *config.Config
GetConfig returns the config from dependencies (implements DependenciesInterface).
func (*Dependencies) GetDB ¶
func (d *Dependencies) GetDB() *database.DB
GetDB returns the database from dependencies (implements DependenciesInterface).
func (*Dependencies) GetScraperRegistry ¶
func (d *Dependencies) GetScraperRegistry() *models.ScraperRegistry
GetScraperRegistry returns the scraper registry from dependencies (implements DependenciesInterface).
type DependenciesInterface ¶
type DependenciesInterface interface {
GetConfig() *config.Config
GetDB() *database.DB
GetScraperRegistry() *models.ScraperRegistry
Close() error
}
DependenciesInterface abstracts Dependencies for test injection. Allows CLI commands to accept either real Dependencies or test mocks. Added in Epic 6 Story 6.1 to enable dependency injection for testability.
type DependenciesOptions ¶
type DependenciesOptions struct {
DB *database.DB // Optional: injected database (for tests)
ScraperRegistry *models.ScraperRegistry // Optional: injected registry (for tests)
}
DependenciesOptions allows optional dependency injection for testing. Fields left nil will be initialized with real implementations. Added in Epic 6 Story 6.1 to support testable CLI commands.
type DependencyFactory ¶
type DependencyFactory func(*config.Config) (*Dependencies, error)
DependencyFactory creates dependencies from config
type MediaDownloader ¶
type MediaDownloader interface {
DownloadAll(movie *models.Movie, destDir string, multipart *downloader.MultipartInfo) ([]downloader.DownloadResult, error)
}
MediaDownloader defines the interface for downloading media files. This interface allows for easier testing by enabling mock implementations.
type OverrideApplier ¶
OverrideApplier applies command-specific overrides to config