Documentation
¶
Index ¶
- Constants
- func ApplyEnvironmentOverrides(cfg *Config)
- func ApplyScrapeFlagOverrides(cmd *cobra.Command, cfg *Config)
- func ApplyUmask(perm os.FileMode) os.FileMode
- func AutoDiscoverBrowserBinary() string
- func EmbeddedConfigBytes() []byte
- func GetBrowserBinaryPath(cfg BrowserConfig) string
- func GetEmbeddedConfig() string
- func GetOperationMode(mode string) types.OperationMode
- func MigrateToCurrent(cfg *Config) error
- func Normalize(cfg *Config) bool
- func Prepare(cfg *Config) (bool, error)
- func RegisterMigration(m Migration)
- func ResetMigrations()
- func ResolveScraperUserAgent(userAgent string) string
- func Save(cfg *Config, path string) error
- func SetMigrationContext(ctx MigrationContext)
- func ValidateCommonSettings(scraperName string, sc *ScraperSettings) error
- type APIConfig
- type ActressDatabaseConfig
- type AnthropicTranslationConfig
- type BaseScraperConfig
- type BrowserConfig
- type CompletenessConfig
- type CompletenessTierConfig
- type CompletenessTierDefinition
- type Config
- type ConfigValidator
- type DatabaseConfig
- type DeepLTranslationConfig
- type FlareSolverrConfig
- type GenreReplacementConfig
- type GoogleTranslationConfig
- type LegacyMigration
- type LoggingConfig
- type MatchingConfig
- type MediaInfoConfig
- type MetadataConfig
- type Migration
- type MigrationContext
- type NFOConfig
- type OpenAICompatibleTranslationConfig
- type OpenAITranslationConfig
- type OutputConfig
- type PerformanceConfig
- type PriorityConfig
- func (p *PriorityConfig) GetFieldPriority(fieldKey string) []string
- func (p PriorityConfig) MarshalJSON() ([]byte, error)
- func (p PriorityConfig) MarshalYAML() (interface{}, error)
- func (p *PriorityConfig) UnmarshalJSON(data []byte) error
- func (p *PriorityConfig) UnmarshalYAML(node *yaml.Node) error
- type ProxyConfig
- type ProxyProfile
- type RateLimitConfig
- type ScraperCommonConfig
- type ScraperProxyMode
- type ScraperSettings
- func (s *ScraperSettings) DeepCopy() *ScraperSettings
- func (sc *ScraperSettings) GetBaseURL() string
- func (s *ScraperSettings) MarshalJSON() ([]byte, error)
- func (s *ScraperSettings) MarshalYAML() (interface{}, error)
- func (s *ScraperSettings) SetScrapeActress(value bool)
- func (s *ScraperSettings) ShouldScrapeActress(globalDefault bool) bool
- func (s *ScraperSettings) ShouldUseBrowser(globalEnabled bool) bool
- func (s *ScraperSettings) ToScraperSettings() *ScraperSettings
- type ScraperSettingsAdapter
- type ScrapersConfig
- type SecurityConfig
- type ServerConfig
- type SystemConfig
- type TagDatabaseConfig
- type TranslationConfig
- type TranslationFieldsConfig
- type UserAgentString
- type WebUIConfig
- type WordReplacementConfig
Constants ¶
const ( CurrentConfigVersion = 3 DirPerm = configutil.DirPerm DirPermTemp = configutil.DirPermTemp FilePerm = configutil.FilePerm DefaultUserAgent = "Javinizer (+https://github.com/javinizer/Javinizer)" DefaultTempDir = "data/temp" )
const RedactedValue = "•••••"
Variables ¶
This section is empty.
Functions ¶
func ApplyEnvironmentOverrides ¶
func ApplyEnvironmentOverrides(cfg *Config)
ApplyEnvironmentOverrides applies environment variable overrides to config
func ApplyScrapeFlagOverrides ¶
ApplyScrapeFlagOverrides applies CLI flag overrides to config
func AutoDiscoverBrowserBinary ¶
func AutoDiscoverBrowserBinary() string
AutoDiscoverBrowserBinary attempts to find Chrome/Chromium binary path. Returns empty string if not found.
func EmbeddedConfigBytes ¶
func EmbeddedConfigBytes() []byte
EmbeddedConfigBytes returns the raw embedded config bytes. Use this when you need the byte slice directly (e.g., for YAML parsing).
func GetBrowserBinaryPath ¶
func GetBrowserBinaryPath(cfg BrowserConfig) string
GetBrowserBinaryPath returns the browser binary path, auto-discovering if needed.
func GetEmbeddedConfig ¶
func GetEmbeddedConfig() string
GetEmbeddedConfig returns the embedded config.yaml.example content as a string. This is used when generating new config files to ensure Docker and non-Docker deployments produce identical commented configurations.
func GetOperationMode ¶
func GetOperationMode(mode string) types.OperationMode
func MigrateToCurrent ¶
func Prepare ¶
Prepare runs compatibility migrations, normalization, and strict validation. Returns true when config data was changed during preparation.
func RegisterMigration ¶
func RegisterMigration(m Migration)
func ResetMigrations ¶
func ResetMigrations()
func ResolveScraperUserAgent ¶
ResolveScraperUserAgent resolves the effective User-Agent for a scraper. If the scraper-specific userAgent is non-empty, it is used; otherwise DefaultScraperUserAgent is returned.
func SetMigrationContext ¶
func SetMigrationContext(ctx MigrationContext)
func ValidateCommonSettings ¶
func ValidateCommonSettings(scraperName string, sc *ScraperSettings) error
Types ¶
type APIConfig ¶
type APIConfig struct {
Security SecurityConfig `yaml:"security" json:"security"`
}
APIConfig holds API-specific configuration
type ActressDatabaseConfig ¶
type ActressDatabaseConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"` // Enable actress image lookup from database
AutoAdd bool `yaml:"auto_add" json:"auto_add"` // Automatically add new actresses to database
ConvertAlias bool `yaml:"convert_alias" json:"convert_alias"` // Convert actress names using alias database
}
ActressDatabaseConfig holds actress image database configuration
type AnthropicTranslationConfig ¶
type AnthropicTranslationConfig struct {
BaseURL string `yaml:"base_url" json:"base_url"` // e.g., https://api.anthropic.com
APIKey string `yaml:"api_key" json:"api_key"` // Required
Model string `yaml:"model" json:"model"` // e.g., claude-sonnet-4-20250514
}
AnthropicTranslationConfig holds Anthropic (Claude) translation settings.
type BaseScraperConfig ¶
type BaseScraperConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
RequestDelay int `yaml:"request_delay" json:"request_delay"`
MaxRetries int `yaml:"max_retries" json:"max_retries"`
UserAgent string `yaml:"user_agent" json:"user_agent"`
Proxy *ProxyConfig `yaml:"proxy,omitempty" json:"proxy,omitempty"`
DownloadProxy *ProxyConfig `yaml:"download_proxy,omitempty" json:"download_proxy,omitempty"`
Priority int `yaml:"priority" json:"priority"`
FlareSolverr FlareSolverrConfig `yaml:"flaresolverr" json:"flaresolverr"`
RespectRetryAfter bool `yaml:"respect_retry_after" json:"respect_retry_after"`
}
func (BaseScraperConfig) GetDownloadProxy ¶
func (c BaseScraperConfig) GetDownloadProxy() any
func (BaseScraperConfig) GetMaxRetries ¶
func (c BaseScraperConfig) GetMaxRetries() int
func (BaseScraperConfig) GetProxy ¶
func (c BaseScraperConfig) GetProxy() any
func (BaseScraperConfig) GetRequestDelay ¶
func (c BaseScraperConfig) GetRequestDelay() int
func (BaseScraperConfig) GetUserAgent ¶
func (c BaseScraperConfig) GetUserAgent() string
func (BaseScraperConfig) IsEnabled ¶
func (c BaseScraperConfig) IsEnabled() bool
type BrowserConfig ¶
type BrowserConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"` // Master kill-switch (default: false)
BinaryPath string `yaml:"binary_path" json:"binary_path"` // Chrome/Chromium path (auto-discovered if empty)
Timeout int `yaml:"timeout" json:"timeout"` // Operation timeout in seconds (default: 30)
MaxRetries int `yaml:"max_retries" json:"max_retries"` // Retry attempts (default: 3)
Headless bool `yaml:"headless" json:"headless"` // Run headless (default: true)
StealthMode bool `yaml:"stealth_mode" json:"stealth_mode"` // Anti-detection measures (default: true)
WindowWidth int `yaml:"window_width" json:"window_width"` // Viewport width (default: 1920)
WindowHeight int `yaml:"window_height" json:"window_height"` // Viewport height (default: 1080)
SlowMo int `yaml:"slow_mo" json:"slow_mo"` // Slow motion delay ms (default: 0)
BlockImages bool `yaml:"block_images" json:"block_images"` // Block images for speed (default: true)
BlockCSS bool `yaml:"block_css" json:"block_css"` // Block CSS for speed (default: false)
UserAgent string `yaml:"user_agent" json:"user_agent"` // Override UA (empty = use scraper's)
DebugVisible bool `yaml:"debug_visible" json:"debug_visible"` // Show browser window for debugging (default: false)
}
BrowserConfig holds global browser automation settings. Per-scraper overrides are configured via ScrapersConfig.Overrides with use_browser field.
type CompletenessConfig ¶
type CompletenessConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Tiers CompletenessTierConfig `yaml:"tiers" json:"tiers"`
}
CompletenessConfig holds completeness scoring configuration
func (CompletenessConfig) MarshalJSON ¶
func (cc CompletenessConfig) MarshalJSON() ([]byte, error)
MarshalJSON serializes CompletenessConfig with proper snake_case keys
type CompletenessTierConfig ¶
type CompletenessTierConfig struct {
Essential CompletenessTierDefinition `yaml:"essential" json:"essential"`
Important CompletenessTierDefinition `yaml:"important" json:"important"`
NiceToHave CompletenessTierDefinition `yaml:"nice_to_have" json:"nice_to_have"`
}
CompletenessTierConfig holds tier definitions for completeness scoring
type CompletenessTierDefinition ¶
type CompletenessTierDefinition struct {
Weight int `yaml:"weight" json:"weight"` // Percentage weight (0-100, must sum to 100 across tiers)
Fields []string `yaml:"fields" json:"fields"` // Movie field names assigned to this tier
}
CompletenessTierDefinition defines a single tier's weight and assigned fields
type Config ¶
type Config struct {
ConfigVersion int `yaml:"config_version" json:"config_version"`
Server ServerConfig `yaml:"server" json:"server"`
API APIConfig `yaml:"api" json:"api"`
System SystemConfig `yaml:"system" json:"system"`
Scrapers ScrapersConfig `yaml:"scrapers" json:"scrapers"`
Metadata MetadataConfig `yaml:"metadata" json:"metadata"`
Matching MatchingConfig `yaml:"file_matching" json:"file_matching"`
Output OutputConfig `yaml:"output" json:"output"`
Database DatabaseConfig `yaml:"database" json:"database"`
Logging LoggingConfig `yaml:"logging" json:"logging"`
Performance PerformanceConfig `yaml:"performance" json:"performance"`
MediaInfo MediaInfoConfig `yaml:"mediainfo" json:"mediainfo"`
WebUI WebUIConfig `yaml:"webui" json:"webui"`
}
Config represents the application configuration
func LoadOrCreate ¶
LoadOrCreate loads config from file or creates it with defaults. When creating a new file, it uses the embedded config.yaml.example to preserve all comments and documentation, ensuring Docker and non-Docker deployments generate identical commented configurations.
func (*Config) MarshalYAML ¶
MarshalYAML keeps Config marshaling explicit and ensures ScrapersConfig custom marshaling is always applied.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML delegates to yaml.v3 node decoding and lets field-level unmarshalers (e.g. ScrapersConfig) handle their own logic.
type ConfigValidator ¶
type ConfigValidator interface {
ValidateConfig(*ScraperSettings) error
}
ConfigValidator is implemented by flat per-scraper config structs. Each scraper config validates its scraper-specific fields via ValidateConfig(). CONF-03, CONF-04: Enables interface-based dispatch without hardcoded scraper-name branches.
type DatabaseConfig ¶
type DatabaseConfig struct {
Type string `yaml:"type" json:"type"` // sqlite (currently only supported backend)
DSN string `yaml:"dsn" json:"dsn"` // Data Source Name
LogLevel string `yaml:"log_level" json:"log_level"` // Database query logging: silent, error, warn, info (default: silent)
}
DatabaseConfig holds database configuration
type DeepLTranslationConfig ¶
type DeepLTranslationConfig struct {
Mode string `yaml:"mode" json:"mode"` // free or pro
BaseURL string `yaml:"base_url" json:"base_url"` // Optional override (defaults to mode-specific endpoint)
APIKey string `yaml:"api_key" json:"api_key"` // DeepL API key
}
DeepLTranslationConfig holds DeepL provider settings.
type FlareSolverrConfig ¶
type FlareSolverrConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"` // Enable FlareSolverr for bypassing Cloudflare
URL string `yaml:"url" json:"url"` // FlareSolverr endpoint (default: http://localhost:8191/v1)
Timeout int `yaml:"timeout" json:"timeout"` // Request timeout in seconds (default: 30)
MaxRetries int `yaml:"max_retries" json:"max_retries"` // Max retry attempts for FlareSolverr calls (default: 3)
SessionTTL int `yaml:"session_ttl" json:"session_ttl"` // Session TTL in seconds (default: 300)
}
FlareSolverrConfig holds FlareSolverr configuration for bypassing Cloudflare
type GenreReplacementConfig ¶
type GenreReplacementConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"` // Enable genre replacement from database
AutoAdd bool `yaml:"auto_add" json:"auto_add"` // Automatically add new genres to database (identity mapping)
}
GenreReplacementConfig holds genre replacement/normalization configuration
type GoogleTranslationConfig ¶
type GoogleTranslationConfig struct {
Mode string `yaml:"mode" json:"mode"` // free or paid
BaseURL string `yaml:"base_url" json:"base_url"` // Optional override
APIKey string `yaml:"api_key" json:"api_key"` // Required for paid mode
}
GoogleTranslationConfig holds Google Translate provider settings.
type LegacyMigration ¶
type LegacyMigration struct{}
func NewLegacyMigration ¶
func NewLegacyMigration() *LegacyMigration
func (*LegacyMigration) Description ¶
func (m *LegacyMigration) Description() string
func (*LegacyMigration) FromVersions ¶
func (m *LegacyMigration) FromVersions() []int
func (*LegacyMigration) Migrate ¶
func (m *LegacyMigration) Migrate(cfg *Config) error
func (*LegacyMigration) ToVersion ¶
func (m *LegacyMigration) ToVersion() int
type LoggingConfig ¶
type LoggingConfig struct {
Level string `yaml:"level" json:"level"` // debug, info, warn, error
Format string `yaml:"format" json:"format"` // json, text
Output string `yaml:"output" json:"output"` // stdout, file path
MaxSizeMB int `yaml:"max_size_mb" json:"max_size_mb"` // Max size in MB before rotation (0 = no rotation)
MaxBackups int `yaml:"max_backups" json:"max_backups"` // Max number of old log files to keep (0 = unlimited)
MaxAgeDays int `yaml:"max_age_days" json:"max_age_days"` // Max age in days to keep log files (0 = no limit)
Compress bool `yaml:"compress" json:"compress"` // Compress rotated files
}
LoggingConfig holds logging configuration
type MatchingConfig ¶
type MatchingConfig struct {
Extensions []string `yaml:"extensions" json:"extensions"`
MinSizeMB int `yaml:"min_size_mb" json:"min_size_mb"`
ExcludePatterns []string `yaml:"exclude_patterns" json:"exclude_patterns"`
RegexEnabled bool `yaml:"regex_enabled" json:"regex_enabled"`
RegexPattern string `yaml:"regex_pattern" json:"regex_pattern"`
}
MatchingConfig holds file matching configuration
type MediaInfoConfig ¶
type MediaInfoConfig struct {
CLIEnabled bool `yaml:"cli_enabled" json:"cli_enabled"` // Enable MediaInfo CLI fallback (default: false)
CLIPath string `yaml:"cli_path" json:"cli_path"` // Path to mediainfo binary (default: "mediainfo")
CLITimeout int `yaml:"cli_timeout" json:"cli_timeout"` // Timeout in seconds for CLI execution (default: 30)
}
MediaInfoConfig holds MediaInfo functionality configuration
type MetadataConfig ¶
type MetadataConfig struct {
Priority PriorityConfig `yaml:"priority" json:"priority"`
ActressDatabase ActressDatabaseConfig `yaml:"actress_database" json:"actress_database"` // Actress image database (SQLite-backed)
GenreReplacement GenreReplacementConfig `yaml:"genre_replacement" json:"genre_replacement"` // Genre replacement/normalization (SQLite-backed)
WordReplacement WordReplacementConfig `yaml:"word_replacement" json:"word_replacement"` // Word uncensor/text replacement (SQLite-backed)
TagDatabase TagDatabaseConfig `yaml:"tag_database" json:"tag_database"` // Per-movie tag database (SQLite-backed)
Translation TranslationConfig `yaml:"translation" json:"translation"` // Metadata translation pipeline
IgnoreGenres []string `yaml:"ignore_genres" json:"ignore_genres"`
RequiredFields []string `yaml:"required_fields" json:"required_fields"`
NFO NFOConfig `yaml:"nfo" json:"nfo"`
Completeness CompletenessConfig `yaml:"completeness" json:"completeness"` // Completeness scoring configuration
}
MetadataConfig holds metadata aggregation settings
type MigrationContext ¶
func GetMigrationContext ¶
func GetMigrationContext() MigrationContext
type NFOConfig ¶
type NFOConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
DisplayTitle string `yaml:"display_title" json:"display_title"`
FilenameTemplate string `yaml:"filename_template" json:"filename_template"`
FirstNameOrder bool `yaml:"first_name_order" json:"first_name_order"`
ActressLanguageJA bool `yaml:"actress_language_ja" json:"actress_language_ja"`
PerFile bool `yaml:"per_file" json:"per_file"` // Create separate NFO for each multi-part file
UnknownActressMode string `yaml:"unknown_actress_mode" json:"unknown_actress_mode"` // skip (default) or fallback
UnknownActressText string `yaml:"unknown_actress_text" json:"unknown_actress_text"` // Text for fallback mode
ActressAsTag bool `yaml:"actress_as_tag" json:"actress_as_tag"`
AddGenericRole bool `yaml:"add_generic_role" json:"add_generic_role"` // Add generic "Actress" role to all actresses
AltNameRole bool `yaml:"alt_name_role" json:"alt_name_role"` // Use alternate name (Japanese) in role field
IncludeOriginalPath bool `yaml:"include_originalpath" json:"include_originalpath"` // Include source filename in NFO
IncludeStreamDetails bool `yaml:"include_stream_details" json:"include_stream_details"`
IncludeFanart bool `yaml:"include_fanart" json:"include_fanart"`
IncludeTrailer bool `yaml:"include_trailer" json:"include_trailer"`
RatingSource string `yaml:"rating_source" json:"rating_source"`
Tag []string `yaml:"tag" json:"tag"`
Tagline string `yaml:"tagline" json:"tagline"`
Credits []string `yaml:"credits" json:"credits"`
}
NFOConfig holds NFO generation settings
func (*NFOConfig) IsUnknownActressFallback ¶
type OpenAICompatibleTranslationConfig ¶
type OpenAICompatibleTranslationConfig struct {
BaseURL string `yaml:"base_url" json:"base_url"` // e.g., http://localhost:11434/v1
APIKey string `yaml:"api_key" json:"api_key"` // Optional for local endpoints
Model string `yaml:"model" json:"model"` // e.g., llama3.1
EnableThinking *bool `yaml:"enable_thinking" json:"enable_thinking,omitempty"` // Toggle reasoning/thinking when supported by the backend
BackendType string `yaml:"backend_type,omitempty" json:"backend_type,omitempty" swaggerignore:"true"`
}
OpenAICompatibleTranslationConfig holds settings for self-hosted or third-party OpenAI-compatible translation endpoints (Ollama, vLLM, LM Studio, OpenRouter, etc.).
func (OpenAICompatibleTranslationConfig) EffectiveEnableThinking ¶
func (oc OpenAICompatibleTranslationConfig) EffectiveEnableThinking() bool
func (OpenAICompatibleTranslationConfig) NormalizedBackendType ¶
func (oc OpenAICompatibleTranslationConfig) NormalizedBackendType() string
type OpenAITranslationConfig ¶
type OpenAITranslationConfig struct {
BaseURL string `yaml:"base_url" json:"base_url"` // OpenAI-compatible base URL (e.g., https://api.openai.com/v1)
APIKey string `yaml:"api_key" json:"api_key"` // API key for the provider
Model string `yaml:"model" json:"model"` // Model name (e.g., gpt-4o-mini)
}
OpenAITranslationConfig holds OpenAI-compatible API settings.
type OutputConfig ¶
type OutputConfig struct {
FolderFormat string `yaml:"folder_format" json:"folder_format"`
FileFormat string `yaml:"file_format" json:"file_format"`
SubfolderFormat []string `yaml:"subfolder_format" json:"subfolder_format"`
Delimiter string `yaml:"delimiter" json:"delimiter"`
MaxTitleLength int `yaml:"max_title_length" json:"max_title_length"`
MaxPathLength int `yaml:"max_path_length" json:"max_path_length"`
MoveSubtitles bool `yaml:"move_subtitles" json:"move_subtitles"`
SubtitleExtensions []string `yaml:"subtitle_extensions" json:"subtitle_extensions"`
OperationMode types.OperationMode `yaml:"operation_mode" json:"operation_mode"`
RenameFile bool `yaml:"rename_file" json:"rename_file"` // Rename files using file_format template (default: true)
AllowRevert bool `yaml:"allow_revert" json:"allow_revert"` // Enable revert operations (default: false — opt-in for safety)
GroupActress bool `yaml:"group_actress" json:"group_actress"` // Replace multiple actresses with "@Group" in templates (default: false)
PosterFormat string `yaml:"poster_format" json:"poster_format"`
FanartFormat string `yaml:"fanart_format" json:"fanart_format"`
TrailerFormat string `yaml:"trailer_format" json:"trailer_format"`
ScreenshotFormat string `yaml:"screenshot_format" json:"screenshot_format"`
ScreenshotFolder string `yaml:"screenshot_folder" json:"screenshot_folder"`
ScreenshotPadding int `yaml:"screenshot_padding" json:"screenshot_padding"`
ActressFolder string `yaml:"actress_folder" json:"actress_folder"`
ActressFormat string `yaml:"actress_format" json:"actress_format"`
DownloadCover bool `yaml:"download_cover" json:"download_cover"`
DownloadPoster bool `yaml:"download_poster" json:"download_poster"`
DownloadExtrafanart bool `yaml:"download_extrafanart" json:"download_extrafanart"`
DownloadTrailer bool `yaml:"download_trailer" json:"download_trailer"`
DownloadActress bool `yaml:"download_actress" json:"download_actress"`
DownloadTimeout int `yaml:"download_timeout" json:"download_timeout"` // Timeout in seconds for HTTP downloads (default: 60)
DownloadProxy ProxyConfig `yaml:"download_proxy" json:"download_proxy"` // Separate proxy for downloads (optional)
}
OutputConfig holds output/organization settings
func (*OutputConfig) GetOperationMode ¶
func (o *OutputConfig) GetOperationMode() types.OperationMode
type PerformanceConfig ¶
type PerformanceConfig struct {
MaxWorkers int `yaml:"max_workers" json:"max_workers"` // Maximum concurrent workers (default: 5)
WorkerTimeout int `yaml:"worker_timeout" json:"worker_timeout"` // Timeout per task in seconds (default: 300)
BufferSize int `yaml:"buffer_size" json:"buffer_size"` // Channel buffer size (default: 100)
UpdateInterval int `yaml:"update_interval" json:"update_interval"` // UI update interval in milliseconds (default: 100)
}
PerformanceConfig holds performance and concurrency settings
type PriorityConfig ¶
type PriorityConfig struct {
// Priority is the global scraper execution order.
// If empty, derived from registered scraper priorities at initialization.
// If set, used directly for all metadata fields that lack a Fields override.
Priority []string `yaml:"priority" json:"priority"`
// Fields holds per-metadata-field scraper priority overrides.
// Keys are snake_case field names matching the API (e.g. "title", "actress", "cover_url").
// An empty or nil slice for a field means "use global priority".
Fields map[string][]string `yaml:"-" json:"-"`
}
PriorityConfig defines scraper priority for metadata aggregation. Supports both a global priority list and per-field overrides. When marshaled, per-field entries appear as top-level keys in the priority object:
priority: id: [r18dev, dmm] title: [dmm, r18dev]
The Priority field is the global default; Fields overrides per metadata field.
func (*PriorityConfig) GetFieldPriority ¶
func (p *PriorityConfig) GetFieldPriority(fieldKey string) []string
GetFieldPriority returns the priority list for a specific metadata field. If the field has no override (or the override is empty), it falls back to the global Priority list. Returns nil if neither is set.
func (PriorityConfig) MarshalJSON ¶
func (p PriorityConfig) MarshalJSON() ([]byte, error)
MarshalJSON serializes PriorityConfig as a flat JSON object. The "priority" key holds the global list; per-field keys hold overrides.
func (PriorityConfig) MarshalYAML ¶
func (p PriorityConfig) MarshalYAML() (interface{}, error)
MarshalYAML serializes PriorityConfig as a flat YAML mapping.
func (*PriorityConfig) UnmarshalJSON ¶
func (p *PriorityConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes PriorityConfig from a flat JSON object. The "priority" key populates the global list; all other array-valued keys populate Fields.
func (*PriorityConfig) UnmarshalYAML ¶
func (p *PriorityConfig) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML deserializes PriorityConfig from a YAML mapping node.
type ProxyConfig ¶
type ProxyConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"` // Enable proxy for HTTP requests
Profile string `yaml:"profile,omitempty" json:"profile,omitempty"` // Named profile to use (for scraper-specific overrides)
DefaultProfile string `yaml:"default_profile,omitempty" json:"default_profile,omitempty"` // Default profile name (for global scrapers.proxy)
Profiles map[string]ProxyProfile `yaml:"profiles,omitempty" json:"profiles,omitempty"` // Named proxy profiles (global scrapers.proxy)
}
ProxyConfig holds HTTP/SOCKS5 proxy configuration All proxy settings are managed through profiles (scrapers.proxy.profiles). Use Profile field to reference a named profile for scraper-specific overrides.
func ProxyAsConfig ¶
func ProxyAsConfig(p any) *ProxyConfig
func (*ProxyConfig) UnmarshalYAML ¶
func (p *ProxyConfig) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML implements custom YAML unmarshaling for ProxyConfig. It validates that no legacy proxy fields (url, username, password, use_main_proxy) are present at the YAML level, then decodes into the struct.
type ProxyProfile ¶
type ProxyProfile struct {
URL string `yaml:"url" json:"url"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"password"`
}
ProxyProfile holds reusable proxy connection settings.
func ResolveGlobalProxy ¶
func ResolveGlobalProxy(global ProxyConfig) *ProxyProfile
ResolveGlobalProxy returns the effective global proxy profile, including the selected default profile when configured. Returns empty profile if proxy is disabled.
func ResolveScraperProxy ¶
func ResolveScraperProxy(global ProxyConfig, scraperOverride *ProxyConfig) *ProxyProfile
ResolveScraperProxy returns the effective proxy profile for a scraper based on the three proxy modes: direct (no proxy), inherit (use global default), or specific (use named profile with optional credential inheritance).
Mode resolution follows this priority: 1. If global proxy is disabled → direct mode for all scrapers 2. If scraper override is disabled → direct mode for this scraper 3. If scraper override enabled with profile → specific mode (profile + inherit missing creds) 4. If scraper override enabled without profile → inherit mode (use global default) 5. If no scraper override → inherit mode (use global default)
Note: FlareSolverr is handled separately via ScraperSettings.FlareSolverr and ScrapersConfig.FlareSolverr (global), not via ProxyConfig.
type RateLimitConfig ¶
type RateLimitConfig struct {
RequestsPerMinute int `yaml:"requests_per_minute" json:"requests_per_minute"`
}
type ScraperCommonConfig ¶
type ScraperCommonConfig struct {
Enabled bool `yaml:"enabled"`
RequestDelay int `yaml:"request_delay"`
MaxRetries int `yaml:"max_retries"`
UserAgent UserAgentString `yaml:"user_agent"`
Proxy *ProxyConfig `yaml:"proxy,omitempty"`
DownloadProxy *ProxyConfig `yaml:"download_proxy,omitempty"`
}
ScraperCommonConfig holds common scraper configuration fields used by ScraperConfigInterface. Embed this struct in all scraper-specific configs with `yaml:",inline"` to automatically satisfy the interface without boilerplate wrapper methods.
func (ScraperCommonConfig) GetDownloadProxy ¶
func (c ScraperCommonConfig) GetDownloadProxy() any
GetDownloadProxy implements ScraperConfigInterface.
func (ScraperCommonConfig) GetMaxRetries ¶
func (c ScraperCommonConfig) GetMaxRetries() int
GetMaxRetries implements ScraperConfigInterface.
func (ScraperCommonConfig) GetProxy ¶
func (c ScraperCommonConfig) GetProxy() any
GetProxy implements ScraperConfigInterface.
func (ScraperCommonConfig) GetRequestDelay ¶
func (c ScraperCommonConfig) GetRequestDelay() int
GetRequestDelay implements ScraperConfigInterface.
func (ScraperCommonConfig) GetUserAgent ¶
func (c ScraperCommonConfig) GetUserAgent() string
GetUserAgent implements ScraperConfigInterface.
func (ScraperCommonConfig) IsEnabled ¶
func (c ScraperCommonConfig) IsEnabled() bool
IsEnabled implements ScraperConfigInterface.
type ScraperProxyMode ¶
type ScraperProxyMode string
ScraperProxyMode represents how a scraper should use proxy
const ( ScraperProxyModeDirect ScraperProxyMode = "direct" ScraperProxyModeInherit ScraperProxyMode = "inherit" ScraperProxyModeSpecific ScraperProxyMode = "specific" )
func ResolveScraperProxyMode ¶
func ResolveScraperProxyMode(global ProxyConfig, scraperOverride *ProxyConfig) ScraperProxyMode
ResolveScraperProxyMode determines the effective proxy mode for a scraper.
Logic:
- If global proxy disabled → Direct (circuit breaker)
- If global proxy enabled + scraper override missing → Inherit
- If global proxy enabled + scraper override disabled → Direct (user opted out)
- If global proxy enabled + scraper override enabled + profile → Specific
- If global proxy enabled + scraper override enabled + no profile → Inherit
type ScraperSettings ¶
type ScraperSettings struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Language string `yaml:"language" json:"language"` // Language code varies by scraper
Timeout int `yaml:"timeout" json:"timeout"` // HTTP client timeout in seconds
RateLimit int `yaml:"rate_limit" json:"rate_limit"` // Request delay in milliseconds (mirrors RequestDelay)
RetryCount int `yaml:"retry_count" json:"retry_count"` // Max retries (mirrors MaxRetries)
UserAgent string `yaml:"user_agent" json:"user_agent"` // Custom User-Agent; if empty, configutil.DefaultScraperUserAgent is used
Proxy *ProxyConfig `yaml:"proxy,omitempty" json:"proxy,omitempty"` // Optional scraper-specific proxy override
DownloadProxy *ProxyConfig `yaml:"download_proxy,omitempty" json:"download_proxy,omitempty"` // Optional scraper-specific download proxy override
BaseURL string `yaml:"base_url,omitempty" json:"base_url,omitempty"` // Base URL for the scraper
UseFlareSolverr bool `yaml:"use_flaresolverr" json:"use_flaresolverr"` // Whether to use FlareSolverr for this scraper
// NEW: Per-scraper toggle for browser (mirrors use_flaresolverr pattern)
UseBrowser bool `yaml:"use_browser" json:"use_browser"`
// NEW: Per-scraper override for scrape_actress (nil = inherit global)
ScrapeActress *bool `yaml:"scrape_actress,omitempty" json:"scrape_actress,omitempty"`
Cookies map[string]string `yaml:"cookies,omitempty" json:"cookies,omitempty"` // CONF-06: scraper-specific cookies
Extra map[string]any `yaml:"-" json:"-"` // Scraper-specific fields, flattened on marshal
}
ScraperSettings holds common scraper configuration fields used by the Scraper interface. Individual scraper configs embed this and add scraper-specific fields. CONF-01: All fields are present: Enabled, Timeout, RateLimit, RetryCount, UseFlareSolverr, UserAgent, Cookies.
func FlatToScraperConfig ¶
func FlatToScraperConfig(name string, flat interface{}) *ScraperSettings
FlatToScraperConfig converts a flat per-scraper config to unified ScraperSettings. Uses FlattenFunc registry for backwards compatibility with existing scraper packages.
func (*ScraperSettings) DeepCopy ¶
func (s *ScraperSettings) DeepCopy() *ScraperSettings
DeepCopy creates a deep copy of ScraperSettings, ensuring that pointer fields (Proxy, DownloadProxy) and map fields (Cookies) are properly isolated from the original. This prevents mutation leaks when settings are shared between config instances.
func (*ScraperSettings) GetBaseURL ¶
func (sc *ScraperSettings) GetBaseURL() string
GetBaseURL returns the base URL for the scraper, or an empty string if not set.
func (*ScraperSettings) MarshalJSON ¶
func (s *ScraperSettings) MarshalJSON() ([]byte, error)
MarshalJSON preserves the full unified scraper settings shape for JSON serialization. Extra fields are flattened to the top level, matching MarshalYAML behavior.
func (*ScraperSettings) MarshalYAML ¶
func (s *ScraperSettings) MarshalYAML() (interface{}, error)
MarshalYAML preserves the full unified scraper settings shape so config save/load round-trips do not drop scraper-specific data. Extra fields are flattened to the top level for clean YAML output.
func (*ScraperSettings) SetScrapeActress ¶
func (s *ScraperSettings) SetScrapeActress(value bool)
SetScrapeActress sets the per-scraper scrape_actress override.
func (*ScraperSettings) ShouldScrapeActress ¶
func (s *ScraperSettings) ShouldScrapeActress(globalDefault bool) bool
ShouldScrapeActress returns whether actress scraping is enabled for this scraper. Returns per-scraper override if set, otherwise falls back to global default.
func (*ScraperSettings) ShouldUseBrowser ¶
func (s *ScraperSettings) ShouldUseBrowser(globalEnabled bool) bool
ShouldUseBrowser returns whether browser automation is enabled for this scraper. Checks global enabled first, then per-scraper toggle.
func (*ScraperSettings) ToScraperSettings ¶
func (s *ScraperSettings) ToScraperSettings() *ScraperSettings
ToScraperSettings implements ScraperSettingsAdapter.
type ScraperSettingsAdapter ¶
type ScraperSettingsAdapter interface {
ToScraperSettings() *ScraperSettings
}
ScraperSettingsAdapter is an optional adapter for concrete scraper configs. When implemented, config decoding can avoid flatten-registry coupling.
type ScrapersConfig ¶
type ScrapersConfig struct {
UserAgent string `yaml:"user_agent" json:"user_agent"`
Referer string `yaml:"referer" json:"referer"` // Referer header for CDN compatibility (default: https://www.dmm.co.jp/)
TimeoutSeconds int `yaml:"timeout_seconds" json:"timeout_seconds"` // HTTP client timeout in seconds (default: 30)
RequestTimeoutSeconds int `yaml:"request_timeout_seconds" json:"request_timeout_seconds"` // Overall request timeout in seconds (default: 60)
Priority []string `yaml:"priority" json:"priority"` // Global scraper priority order
FlareSolverr FlareSolverrConfig `yaml:"flaresolverr" json:"flaresolverr"` // Global FlareSolverr config for Cloudflare bypass
// NEW: Global scrape_actress default (opt-out behavior, default: true)
ScrapeActress bool `yaml:"scrape_actress" json:"scrape_actress"`
// NEW: Global Browser configuration block
Browser BrowserConfig `yaml:"browser" json:"browser"`
Proxy ProxyConfig `yaml:"proxy" json:"proxy"` // Default HTTP/SOCKS5 proxy for scraper requests
Overrides map[string]*ScraperSettings `yaml:"-" json:"-"` // Canonical per-scraper settings map
// contains filtered or unexported fields
}
ScrapersConfig holds scraper-specific settings. PLUGIN-01: No concrete scraper type fields - map-backed storage only.
func (*ScrapersConfig) MarshalJSON ¶
func (s *ScrapersConfig) MarshalJSON() ([]byte, error)
MarshalJSON implements custom JSON marshaling for ScrapersConfig. This ensures scraper-specific settings are serialized despite json:"-" on internal maps.
func (*ScrapersConfig) MarshalYAML ¶
func (s *ScrapersConfig) MarshalYAML() (interface{}, error)
MarshalYAML serializes scrapers with full unified ScraperSettings.
func (*ScrapersConfig) NormalizeScraperConfigs ¶
func (c *ScrapersConfig) NormalizeScraperConfigs()
NormalizeScraperConfigs populates Overrides and flatConfigs from registered defaults and validators. Overrides is the canonical per-scraper configuration map.
func (*ScrapersConfig) UnmarshalJSON ¶
func (s *ScrapersConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom JSON unmarshaling for ScrapersConfig.
func (*ScrapersConfig) UnmarshalYAML ¶
func (s *ScrapersConfig) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML implements custom YAML unmarshaling for ScrapersConfig.
type SecurityConfig ¶
type SecurityConfig struct {
AllowedDirectories []string `yaml:"allowed_directories" json:"allowed_directories"`
DeniedDirectories []string `yaml:"denied_directories" json:"denied_directories"`
MaxFilesPerScan int `yaml:"max_files_per_scan" json:"max_files_per_scan"`
ScanTimeoutSeconds int `yaml:"scan_timeout_seconds" json:"scan_timeout_seconds"`
AllowedOrigins []string `yaml:"allowed_origins" json:"allowed_origins"`
AllowUNC bool `yaml:"allow_unc" json:"allow_unc"`
AllowedUNCServers []string `yaml:"allowed_unc_servers" json:"allowed_unc_servers"`
RateLimit RateLimitConfig `yaml:"rate_limit" json:"rate_limit"`
TrustedProxies []string `yaml:"trusted_proxies" json:"trusted_proxies"`
ForceSecureCookies bool `yaml:"force_secure_cookies" json:"force_secure_cookies"`
}
SecurityConfig holds API security settings for path validation and resource limits
type ServerConfig ¶
type ServerConfig struct {
Host string `yaml:"host" json:"host"`
Port int `yaml:"port" json:"port"`
}
ServerConfig holds API server configuration
type SystemConfig ¶
type SystemConfig struct {
// Umask for file creation (e.g., "002" for rwxrwxr-x)
// Can be overridden with UMASK environment variable
Umask string `yaml:"umask" json:"umask"`
// VersionCheckEnabled enables checking for new releases
VersionCheckEnabled bool `yaml:"version_check_enabled" json:"version_check_enabled"`
// VersionCheckIntervalHours is the interval between version checks in hours
VersionCheckIntervalHours int `yaml:"version_check_interval_hours" json:"version_check_interval_hours"`
// TempDir is the base directory for temporary files (default: "data/temp").
// Can be overridden with JAVINIZER_TEMP_DIR environment variable.
// Subdirectory "posters/{jobID}" is created for batch job temp posters.
TempDir string `yaml:"temp_dir" json:"temp_dir"`
}
SystemConfig holds system-level settings
type TagDatabaseConfig ¶
type TagDatabaseConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"` // Enable per-movie tag lookup from database
}
TagDatabaseConfig holds per-movie tag database configuration
type TranslationConfig ¶
type TranslationConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"` // Enable metadata translation after aggregation
Provider string `yaml:"provider" json:"provider"` // openai, openai-compatible, anthropic, deepl, google
SourceLanguage string `yaml:"source_language" json:"source_language"` // Source language code (e.g., en, ja, auto)
TargetLanguage string `yaml:"target_language" json:"target_language"` // Target language code (e.g., en, ja, zh)
TimeoutSeconds int `yaml:"timeout_seconds" json:"timeout_seconds"` // Request timeout in seconds
ApplyToPrimary bool `yaml:"apply_to_primary" json:"apply_to_primary"` // Replace primary movie metadata with translated text
OverwriteExistingTarget bool `yaml:"overwrite_existing_target" json:"overwrite_existing_target"` // Overwrite target-language translation if already present
Fields TranslationFieldsConfig `yaml:"fields" json:"fields"` // Per-field translation controls
OpenAI OpenAITranslationConfig `yaml:"openai" json:"openai"` // OpenAI/OpenAI-compatible provider settings
DeepL DeepLTranslationConfig `yaml:"deepl" json:"deepl"` // DeepL provider settings
Google GoogleTranslationConfig `yaml:"google" json:"google"` // Google provider settings
OpenAICompatible OpenAICompatibleTranslationConfig `yaml:"openai_compatible" json:"openai_compatible"` // OpenAI-compatible (Ollama, vLLM, etc.) provider settings
Anthropic AnthropicTranslationConfig `yaml:"anthropic" json:"anthropic"` // Anthropic (Claude) provider settings
}
TranslationConfig holds metadata translation settings.
func (*TranslationConfig) SettingsHash ¶
func (tc *TranslationConfig) SettingsHash() string
SettingsHash computes a deterministic hash of output-affecting translation settings. The hash is used for cache invalidation - when settings change, the hash changes, triggering re-translation of cached movies. Returns a 16-character hex string (truncated SHA256).
type TranslationFieldsConfig ¶
type TranslationFieldsConfig struct {
Title bool `yaml:"title" json:"title"`
OriginalTitle bool `yaml:"original_title" json:"original_title"`
Description bool `yaml:"description" json:"description"`
Director bool `yaml:"director" json:"director"`
Maker bool `yaml:"maker" json:"maker"`
Label bool `yaml:"label" json:"label"`
Series bool `yaml:"series" json:"series"`
Genres bool `yaml:"genres" json:"genres"`
Actresses bool `yaml:"actresses" json:"actresses"`
}
TranslationFieldsConfig controls which metadata fields are translated.
type UserAgentString ¶
type UserAgentString struct {
Value string
}
UserAgentString is a custom User-Agent string type that marshals/unmarshals as a plain string. Type definition moved to configutil for Phase 1 refactoring.
type WebUIConfig ¶
type WebUIConfig struct {
DefaultReviewView string `yaml:"default_review_view" json:"default_review_view"`
}
type WordReplacementConfig ¶
type WordReplacementConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"` // Enable word replacement from database
}
WordReplacementConfig holds word uncensor/text replacement configuration