config

package
v0.1.2-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DirPermConfig is the permission mode for configuration directories (owner + group read/execute)
	DirPermConfig = 0755
	// DirPermTemp is the permission mode for temporary/sensitive directories (owner-only access)
	DirPermTemp = 0700
	// FilePermConfig is the permission mode for configuration files
	FilePermConfig = 0644

	// CurrentConfigVersion is the latest configuration schema version.
	// Increment this when adding migrations for new config fields/structures.
	CurrentConfigVersion = 2

	// DefaultUserAgent is the true/identifying UA for Javinizer.
	DefaultUserAgent = "Javinizer (+https://github.com/javinizer/Javinizer)"

	// DefaultFakeUserAgent is a browser-like UA for scraper-hostile sites.
	DefaultFakeUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
)

File and directory permission constants Centralized to ensure consistency across the codebase

Variables

This section is empty.

Functions

func ApplyEnvironmentOverrides

func ApplyEnvironmentOverrides(cfg *Config)

ApplyEnvironmentOverrides applies environment variable overrides to config

func ApplyScrapeFlagOverrides

func ApplyScrapeFlagOverrides(cmd *cobra.Command, cfg *Config)

ApplyScrapeFlagOverrides applies CLI flag overrides to config

func ResolveScraperUserAgent

func ResolveScraperUserAgent(globalUserAgent string, useFakeUserAgent bool, fakeUserAgent string) string

ResolveScraperUserAgent resolves the effective User-Agent for a scraper. When useFakeUserAgent is true, fakeUserAgent takes precedence and falls back to DefaultFakeUserAgent when empty.

func Save

func Save(cfg *Config, path string) error

Save writes the configuration to a YAML file

Types

type APIConfig

type APIConfig struct {
	Security SecurityConfig `yaml:"security" json:"security"`
}

APIConfig holds API-specific configuration

type AVEntertainmentConfig

type AVEntertainmentConfig struct {
	Enabled            bool         `yaml:"enabled" json:"enabled"`
	Language           string       `yaml:"language" json:"language"`                                 // Language code: en, ja (default: en)
	RequestDelay       int          `yaml:"request_delay" json:"request_delay"`                       // Delay between requests in milliseconds (0 = no delay)
	BaseURL            string       `yaml:"base_url" json:"base_url"`                                 // Base URL for AVEntertainment
	ScrapeBonusScreens bool         `yaml:"scrape_bonus_screens" json:"scrape_bonus_screens"`         // Append bonus image files (e.g., "特典ファイル") to screenshot URLs
	UseFakeUserAgent   bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent      string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	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
}

AVEntertainmentConfig holds AVEntertainment scraper 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 CaribbeancomConfig

type CaribbeancomConfig struct {
	Enabled          bool         `yaml:"enabled" json:"enabled"`
	Language         string       `yaml:"language" json:"language"`                                 // Language code: ja, en (default: ja)
	RequestDelay     int          `yaml:"request_delay" json:"request_delay"`                       // Delay between requests in milliseconds (0 = no delay)
	BaseURL          string       `yaml:"base_url" json:"base_url"`                                 // Base URL for Caribbeancom
	UseFakeUserAgent bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent    string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	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
}

CaribbeancomConfig holds Caribbeancom scraper configuration

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"`
}

Config represents the application configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func Load

func Load(path string) (*Config, error)

Load reads configuration from a YAML file

func LoadOrCreate

func LoadOrCreate(path string) (*Config, error)

LoadOrCreate loads config from file or creates it with defaults

func (*Config) Validate

func (c *Config) Validate() error

Validate checks configuration values for validity

type DLGetchuConfig

type DLGetchuConfig struct {
	Enabled          bool         `yaml:"enabled" json:"enabled"`
	RequestDelay     int          `yaml:"request_delay" json:"request_delay"`                       // Delay between requests in milliseconds (0 = no delay)
	BaseURL          string       `yaml:"base_url" json:"base_url"`                                 // Base URL for DLgetchu
	UseFakeUserAgent bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent    string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	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
}

DLGetchuConfig holds DLgetchu scraper configuration

type DMMConfig

type DMMConfig struct {
	Enabled          bool         `yaml:"enabled" json:"enabled"`
	ScrapeActress    bool         `yaml:"scrape_actress" json:"scrape_actress"`
	EnableBrowser    bool         `yaml:"enable_browser" json:"enable_browser"`                     // Enable browser mode for video.dmm.co.jp (JavaScript rendering)
	BrowserTimeout   int          `yaml:"browser_timeout" json:"browser_timeout"`                   // Timeout in seconds for browser operations (default: 30)
	UseFakeUserAgent bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent    string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	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
}

DMMConfig holds DMM/Fanza scraper configuration

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 FC2Config

type FC2Config struct {
	Enabled          bool         `yaml:"enabled" json:"enabled"`
	RequestDelay     int          `yaml:"request_delay" json:"request_delay"`                       // Delay between requests in milliseconds (0 = no delay)
	BaseURL          string       `yaml:"base_url" json:"base_url"`                                 // Base URL for FC2
	UseFakeUserAgent bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent    string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	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
}

FC2Config holds FC2 scraper configuration

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 Jav321Config

type Jav321Config struct {
	Enabled          bool         `yaml:"enabled" json:"enabled"`
	RequestDelay     int          `yaml:"request_delay" json:"request_delay"`                       // Delay between requests in milliseconds (0 = no delay)
	BaseURL          string       `yaml:"base_url" json:"base_url"`                                 // Base URL for Jav321
	UseFakeUserAgent bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent    string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	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
}

Jav321Config holds Jav321 scraper configuration

type JavBusConfig

type JavBusConfig struct {
	Enabled          bool         `yaml:"enabled" json:"enabled"`
	Language         string       `yaml:"language" json:"language"`                                 // Language code: en, ja, zh (default: zh)
	RequestDelay     int          `yaml:"request_delay" json:"request_delay"`                       // Delay between requests in milliseconds (0 = no delay)
	BaseURL          string       `yaml:"base_url" json:"base_url"`                                 // Base URL for JavBus
	UseFakeUserAgent bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent    string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	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
}

JavBusConfig holds JavBus scraper configuration

type JavDBConfig

type JavDBConfig struct {
	Enabled          bool         `yaml:"enabled" json:"enabled"`
	RequestDelay     int          `yaml:"request_delay" json:"request_delay"`                       // Delay between requests in milliseconds (0 = no delay)
	BaseURL          string       `yaml:"base_url" json:"base_url"`                                 // Base URL for JavDB
	UseFakeUserAgent bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent    string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	UseFlareSolverr  bool         `yaml:"use_flaresolverr" json:"use_flaresolverr"`                 // Enable FlareSolverr for Cloudflare bypass
	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
}

JavDBConfig holds JavDB scraper configuration

type JavLibraryConfig

type JavLibraryConfig struct {
	Enabled          bool         `yaml:"enabled" json:"enabled"`
	Language         string       `yaml:"language" json:"language"`                                 // Language code: en, ja, cn, tw (default: en)
	RequestDelay     int          `yaml:"request_delay" json:"request_delay"`                       // Delay between requests in milliseconds (0 = no delay)
	BaseURL          string       `yaml:"base_url" json:"base_url"`                                 // Base URL for JavLibrary
	CfClearance      string       `yaml:"cf_clearance" json:"cf_clearance"`                         // Cloudflare clearance cookie (deprecated, use FlareSolverr)
	CfBm             string       `yaml:"cf_bm" json:"cf_bm"`                                       // Cloudflare Bot Management cookie (deprecated)
	UserAgent        string       `yaml:"user_agent" json:"user_agent"`                             // Custom user agent (optional)
	UseFakeUserAgent bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent    string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	UseFlareSolverr  bool         `yaml:"use_flaresolverr" json:"use_flaresolverr"`                 // Enable FlareSolverr for Cloudflare bypass
	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
}

JavLibraryConfig holds JavLibrary scraper configuration

type LibreDMMConfig

type LibreDMMConfig struct {
	Enabled          bool         `yaml:"enabled" json:"enabled"`
	RequestDelay     int          `yaml:"request_delay" json:"request_delay"`                       // Delay between requests in milliseconds (0 = no delay)
	BaseURL          string       `yaml:"base_url" json:"base_url"`                                 // Base URL for LibreDMM
	UseFakeUserAgent bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent    string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	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
}

LibreDMMConfig holds LibreDMM scraper configuration

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
}

LoggingConfig holds logging configuration

type MGStageConfig

type MGStageConfig struct {
	Enabled          bool         `yaml:"enabled" json:"enabled"`
	RequestDelay     int          `yaml:"request_delay" json:"request_delay"`                       // Delay between requests in milliseconds (0 = no delay)
	UseFakeUserAgent bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent    string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	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
}

MGStageConfig holds MGStage scraper 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)
	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"`
}

MetadataConfig holds metadata aggregation settings

type NFOConfig

type NFOConfig struct {
	Enabled              bool     `yaml:"enabled" json:"enabled"`
	DisplayName          string   `yaml:"display_name" json:"display_name"`
	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
	UnknownActressText   string   `yaml:"unknown_actress_text" json:"unknown_actress_text"`
	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

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"`
	RenameFolderInPlace bool        `yaml:"rename_folder_in_place" json:"rename_folder_in_place"`
	MoveToFolder        bool        `yaml:"move_to_folder" json:"move_to_folder"` // Move/copy files to organized folders (default: true)
	RenameFile          bool        `yaml:"rename_file" json:"rename_file"`       // Rename files using file_format template (default: true)
	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

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 {
	Actress       []string `yaml:"actress" json:"actress"`
	OriginalTitle []string `yaml:"original_title" json:"original_title"`
	CoverURL      []string `yaml:"cover_url" json:"cover_url"`
	Description   []string `yaml:"description" json:"description"`
	Director      []string `yaml:"director" json:"director"`
	Genre         []string `yaml:"genre" json:"genre"`
	ID            []string `yaml:"id" json:"id"`
	ContentID     []string `yaml:"content_id" json:"content_id"`
	Label         []string `yaml:"label" json:"label"`
	Maker         []string `yaml:"maker" json:"maker"`
	PosterURL     []string `yaml:"poster_url" json:"poster_url"`
	Rating        []string `yaml:"rating" json:"rating"`
	ReleaseDate   []string `yaml:"release_date" json:"release_date"`
	Runtime       []string `yaml:"runtime" json:"runtime"`
	Series        []string `yaml:"series" json:"series"`
	ScreenshotURL []string `yaml:"screenshot_url" json:"screenshot_url"`
	Title         []string `yaml:"title" json:"title"`
	TrailerURL    []string `yaml:"trailer_url" json:"trailer_url"`
}

PriorityConfig defines which scraper to prefer for each field Note: omitempty is removed so empty arrays are preserved in YAML (signaling "use global")

type ProxyConfig

type ProxyConfig struct {
	Enabled        bool                    `yaml:"enabled" json:"enabled"`                                     // Enable proxy for HTTP requests
	UseMainProxy   bool                    `yaml:"use_main_proxy" json:"use_main_proxy"`                       // Legacy option (rejected by validation)
	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)
	URL            string                  `yaml:"url" json:"url"`                                             // Legacy direct field (rejected by validation)
	Username       string                  `yaml:"username" json:"username"`                                   // Legacy direct field (rejected by validation)
	Password       string                  `yaml:"password" json:"password"`                                   // Legacy direct field (rejected by validation)
	FlareSolverr   FlareSolverrConfig      `yaml:"flaresolverr" json:"flaresolverr"`                           // FlareSolverr for Cloudflare bypass
}

ProxyConfig holds HTTP/SOCKS5 proxy configuration

func ResolveGlobalProxy

func ResolveGlobalProxy(global ProxyConfig) *ProxyConfig

ResolveGlobalProxy returns the effective global proxy config, including the selected default profile when configured.

func ResolveScraperProxy

func ResolveScraperProxy(global ProxyConfig, scraperOverride *ProxyConfig) *ProxyConfig

ResolveScraperProxy returns the effective proxy config for a scraper. Scraper proxy usage is opt-in: a scraper override must be present and enabled. When enabled, proxy profiles are applied first, then missing URL/credentials inherit from the globally resolved proxy.

type ProxyProfile

type ProxyProfile struct {
	URL          string             `yaml:"url" json:"url"`
	Username     string             `yaml:"username" json:"username"`
	Password     string             `yaml:"password" json:"password"`
	FlareSolverr FlareSolverrConfig `yaml:"flaresolverr" json:"flaresolverr"`
}

ProxyProfile holds reusable proxy connection settings.

type R18DevConfig

type R18DevConfig struct {
	Enabled           bool         `yaml:"enabled" json:"enabled"`
	Language          string       `yaml:"language" json:"language"`                                 // Language code: en, ja (default: en)
	RequestDelay      int          `yaml:"request_delay" json:"request_delay"`                       // Delay between requests in milliseconds (0 = no delay)
	MaxRetries        int          `yaml:"max_retries" json:"max_retries"`                           // Maximum number of retry attempts for rate-limited requests
	RespectRetryAfter bool         `yaml:"respect_retry_after" json:"respect_retry_after"`           // Whether to respect Retry-After header from server
	UseFakeUserAgent  bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent     string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	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
}

R18DevConfig holds R18.dev scraper configuration

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
	Proxy                 ProxyConfig           `yaml:"proxy" json:"proxy"`                                     // Default HTTP/SOCKS5 proxy for scraper requests
	R18Dev                R18DevConfig          `yaml:"r18dev" json:"r18dev"`
	DMM                   DMMConfig             `yaml:"dmm" json:"dmm"`
	LibreDMM              LibreDMMConfig        `yaml:"libredmm" json:"libredmm"`
	MGStage               MGStageConfig         `yaml:"mgstage" json:"mgstage"`
	JavLibrary            JavLibraryConfig      `yaml:"javlibrary" json:"javlibrary"`
	JavDB                 JavDBConfig           `yaml:"javdb" json:"javdb"`
	JavBus                JavBusConfig          `yaml:"javbus" json:"javbus"`
	Jav321                Jav321Config          `yaml:"jav321" json:"jav321"`
	TokyoHot              TokyoHotConfig        `yaml:"tokyohot" json:"tokyohot"`
	AVEntertainment       AVEntertainmentConfig `yaml:"aventertainment" json:"aventertainment"`
	DLGetchu              DLGetchuConfig        `yaml:"dlgetchu" json:"dlgetchu"`
	Caribbeancom          CaribbeancomConfig    `yaml:"caribbeancom" json:"caribbeancom"`
	FC2                   FC2Config             `yaml:"fc2" json:"fc2"`
}

ScrapersConfig holds scraper-specific settings

type SecurityConfig

type SecurityConfig struct {
	// Allowed directories for scanning/browsing (empty = no allowlist restriction)
	AllowedDirectories []string `yaml:"allowed_directories" json:"allowed_directories"`
	// Denied directories (in addition to built-in system directories)
	DeniedDirectories []string `yaml:"denied_directories" json:"denied_directories"`
	// Maximum number of files to return in a scan
	MaxFilesPerScan int `yaml:"max_files_per_scan" json:"max_files_per_scan"`
	// Timeout for scan operations in seconds
	ScanTimeoutSeconds int `yaml:"scan_timeout_seconds" json:"scan_timeout_seconds"`
	// Allowed origins for CORS and WebSocket connections (empty = same-origin only, "*" = allow all)
	AllowedOrigins []string `yaml:"allowed_origins" json:"allowed_origins"`
}

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"`
}

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 TokyoHotConfig

type TokyoHotConfig struct {
	Enabled          bool         `yaml:"enabled" json:"enabled"`
	Language         string       `yaml:"language" json:"language"`                                 // Language code: en, ja, zh (default: en)
	RequestDelay     int          `yaml:"request_delay" json:"request_delay"`                       // Delay between requests in milliseconds (0 = no delay)
	BaseURL          string       `yaml:"base_url" json:"base_url"`                                 // Base URL for TokyoHot
	UseFakeUserAgent bool         `yaml:"use_fake_user_agent" json:"use_fake_user_agent"`           // Use browser-like User-Agent header for this scraper
	FakeUserAgent    string       `yaml:"fake_user_agent" json:"fake_user_agent"`                   // Optional custom fake User-Agent (defaults to built-in browser UA)
	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
}

TokyoHotConfig holds TokyoHot scraper configuration

type TranslationConfig

type TranslationConfig struct {
	Enabled                 bool                    `yaml:"enabled" json:"enabled"`                                     // Enable metadata translation after aggregation
	Provider                string                  `yaml:"provider" json:"provider"`                                   // openai, 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
}

TranslationConfig holds metadata translation settings.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL