Documentation
¶
Index ¶
- func AtomicWriteWithLock(path string, content []byte, mode os.FileMode) error
- func ConfigExists() bool
- func ConfigPath() (string, error)
- func GenerateWebhookSecret() (string, error)
- func GetDatabasePath() string
- func GetReportsPath() string
- func GetSection(c *Config, name string) (json.RawMessage, error)
- func HashPassword(password string) (string, error)
- func MaskSecrets(v any)
- func PathContains(root, candidate string) bool
- func SectionNames() []string
- func SetSection(c *Config, name string, raw json.RawMessage) error
- func ValidateWatchLayout(w WatchConfig, libraries LibrariesConfig) error
- func VerifyPassword(password, hash string) bool
- type AIConfig
- type APIConfig
- type CircuitBreakerConfig
- type Config
- type DaemonConfig
- type JellyfinConfig
- type JellyfinPathMapping
- type JellystatConfig
- type KeepaliveConfig
- type LibrariesConfig
- type LoggingConfig
- type MetadataRecoveryConfig
- type OptionsConfig
- type PermissionsConfig
- func (p *PermissionsConfig) ParseDirMode() (os.FileMode, error)
- func (p *PermissionsConfig) ParseFileMode() (os.FileMode, error)
- func (p *PermissionsConfig) ResolveGID() (int, error)
- func (p *PermissionsConfig) ResolveUID() (int, error)
- func (p *PermissionsConfig) WantsMode() bool
- func (p *PermissionsConfig) WantsOwnership() bool
- type RadarrConfig
- type SetupConfig
- type SonarrConfig
- type TMDBConfig
- type WatchConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicWriteWithLock ¶
func ConfigExists ¶
func ConfigExists() bool
func ConfigPath ¶
func GenerateWebhookSecret ¶
GenerateWebhookSecret returns a 32-byte random secret encoded as hex.
func GetDatabasePath ¶
func GetDatabasePath() string
GetDatabasePath returns the path to the HOLDEN database file
func GetReportsPath ¶
func GetReportsPath() string
GetReportsPath returns the directory for Plex2Jellyfin postmortem reports.
func GetSection ¶
func GetSection(c *Config, name string) (json.RawMessage, error)
func HashPassword ¶
func MaskSecrets ¶
func MaskSecrets(v any)
func PathContains ¶ added in v0.1.13
PathContains reports whether candidate is root itself or a descendant.
func SectionNames ¶
func SectionNames() []string
func SetSection ¶
func SetSection(c *Config, name string, raw json.RawMessage) error
func ValidateWatchLayout ¶ added in v0.1.13
func ValidateWatchLayout(w WatchConfig, libraries LibrariesConfig) error
ValidateWatchLayout rejects roots whose overlapping roles make ingestion or source-retention behavior ambiguous, and all watch/library overlap.
func VerifyPassword ¶
Types ¶
type AIConfig ¶
type AIConfig struct {
Enabled bool `mapstructure:"enabled"`
OllamaEndpoint string `mapstructure:"ollama_endpoint"`
Model string `mapstructure:"model"`
FallbackModel string `mapstructure:"fallback_model"`
ConfidenceThreshold float64 `mapstructure:"confidence_threshold"`
AutoTriggerThreshold float64 `mapstructure:"auto_trigger_threshold"`
TimeoutSeconds int `mapstructure:"timeout_seconds"`
CacheEnabled bool `mapstructure:"cache_enabled"`
CloudModel string `mapstructure:"cloud_model"`
AutoResolveRisky bool `mapstructure:"auto_resolve_risky"`
CircuitBreaker CircuitBreakerConfig `mapstructure:"circuit_breaker"`
Keepalive KeepaliveConfig `mapstructure:"keepalive"`
RetryDelay time.Duration `mapstructure:"retry_delay"`
MaxRetries int `mapstructure:"max_retries"`
HourlyLimit int `mapstructure:"hourly_limit"`
DailyLimit int `mapstructure:"daily_limit"`
EnhancementIntervalSeconds int `mapstructure:"enhancement_interval_seconds"`
}
AIConfig contains AI title matching configuration
func DefaultAIConfig ¶
func DefaultAIConfig() AIConfig
DefaultAIConfig returns default AI configuration
type APIConfig ¶
type APIConfig struct {
AllowedOrigins []string `mapstructure:"allowed_origins"`
}
APIConfig holds HTTP-server-only concerns (CORS, etc.). CORS origins default to the Next.js dev server; same-origin production deployments don't need CORS, but external dev or reverse-proxied setups might.
type CircuitBreakerConfig ¶
type Config ¶
type Config struct {
Setup SetupConfig `mapstructure:"setup"`
Watch WatchConfig `mapstructure:"watch"`
Libraries LibrariesConfig `mapstructure:"libraries"`
Daemon DaemonConfig `mapstructure:"daemon"`
Options OptionsConfig `mapstructure:"options"`
Sonarr SonarrConfig `mapstructure:"sonarr"`
Radarr RadarrConfig `mapstructure:"radarr"`
Jellyfin JellyfinConfig `mapstructure:"jellyfin"`
Jellystat JellystatConfig `mapstructure:"jellystat"`
TMDB TMDBConfig `mapstructure:"tmdb"`
Logging LoggingConfig `mapstructure:"logging"`
Permissions PermissionsConfig `mapstructure:"permissions"`
AI AIConfig `mapstructure:"ai"`
API APIConfig `mapstructure:"api"`
MetadataRecovery MetadataRecoveryConfig `mapstructure:"metadata_recovery" toml:"metadata_recovery"`
Password string `mapstructure:"password" secret:"true"`
PasswordHash string `mapstructure:"password_hash" secret:"true"`
SecureCookies bool `mapstructure:"secure_cookies"`
}
func UpdateWithLock ¶
UpdateWithLock reloads the latest config while holding its write lock, then persists it only when update returns true. The returned config is always the lock-scoped snapshot, including concurrent changes made before acquisition.
func (*Config) NormalizeSecrets ¶
type DaemonConfig ¶
type JellyfinConfig ¶
type JellyfinConfig struct {
Enabled bool `mapstructure:"enabled"`
URL string `mapstructure:"url"`
APIKey string `mapstructure:"api_key" secret:"true"`
NotifyOnImport bool `mapstructure:"notify_on_import"`
PlaybackSafety bool `mapstructure:"playback_safety"`
VerifyAfterRefresh bool `mapstructure:"verify_after_refresh"`
WebhookSecret string `mapstructure:"webhook_secret" secret:"true"`
// Plugin settings
PluginEnabled bool `mapstructure:"plugin_enabled"`
PluginAutoScan bool `mapstructure:"plugin_auto_scan"`
PluginVerifyOnStartup bool `mapstructure:"plugin_verify_on_startup"`
PluginVerifyInterval int `mapstructure:"plugin_verify_interval"`
// PluginDaemonURL is the base URL Jellyfin's companion plugin calls
// back to (the plugin appends /api/v1/webhooks/jellyfin). From
// Jellyfin's point of view, so never localhost when either side is
// containerized.
PluginDaemonURL string `mapstructure:"plugin_daemon_url"`
// PathMappings translates between Jellyfin's view of a media file
// (as seen inside its container/bind mount) and the daemon's view
// (host filesystem). Without these, the sweeper and webhook handler
// cannot correlate Jellyfin items to parse_decisions rows when
// Jellyfin runs in a container with different mount roots.
PathMappings []JellyfinPathMapping `mapstructure:"path_mappings"`
}
type JellyfinPathMapping ¶
type JellyfinPathMapping struct {
Jellyfin string `mapstructure:"jellyfin"`
Daemon string `mapstructure:"daemon"`
}
JellyfinPathMapping is a single prefix translation pair. See JellyfinConfig.PathMappings for usage.
type JellystatConfig ¶
type JellystatConfig struct {
Enabled bool `mapstructure:"enabled"`
URL string `mapstructure:"url"`
APIKey string `mapstructure:"api_key" secret:"true"`
}
JellyfinConfig contains Jellyfin integration settings. JellystatConfig connects to a Jellystat instance (https://github.com/CyferShepard/Jellystat) for watch statistics. Purely additive: nothing in the pipeline depends on it.
type KeepaliveConfig ¶
type LibrariesConfig ¶
type LibrariesConfig struct {
Movies []string `mapstructure:"movies"`
TV []string `mapstructure:"tv"`
}
LibrariesConfig contains destination library paths
type LoggingConfig ¶
type LoggingConfig struct {
Level string `mapstructure:"level"`
File string `mapstructure:"file"`
MaxSizeMB int `mapstructure:"max_size_mb"`
MaxBackups int `mapstructure:"max_backups"`
// MaxAgeDays is the maximum age of a rotated log file. Files older than
// this (by mtime) are deleted at rotation time. Zero disables age-based
// pruning — only MaxBackups gates retention.
MaxAgeDays int `mapstructure:"max_age_days"`
// Compress gzips rotated backups (plex2jellyfin.1.log → plex2jellyfin.1.log.gz).
// Cuts disk footprint ~5-10×; decompressed on demand with zcat/gunzip.
// Default false for backwards compatibility with existing deployments.
Compress bool `mapstructure:"compress"`
}
type MetadataRecoveryConfig ¶
type MetadataRecoveryConfig struct {
PassiveEnabled bool `mapstructure:"passive_enabled" toml:"passive_enabled"`
RepairEnabled bool `mapstructure:"repair_enabled" toml:"repair_enabled"`
UnknownSeasonRepairEnabled bool `mapstructure:"unknown_season_repair_enabled" toml:"unknown_season_repair_enabled"`
PassiveIntervalMinutes int `mapstructure:"passive_interval_minutes" toml:"passive_interval_minutes"`
PassiveBatchSize int `mapstructure:"passive_batch_size" toml:"passive_batch_size"`
RepairBatchSize int `mapstructure:"repair_batch_size" toml:"repair_batch_size"`
RepairCooldownHours int `mapstructure:"repair_cooldown_hours" toml:"repair_cooldown_hours"`
NeedsReviewAfter int `mapstructure:"needs_review_after" toml:"needs_review_after"`
CorrectionEnabled bool `mapstructure:"correction_enabled" toml:"correction_enabled"`
}
type OptionsConfig ¶
type OptionsConfig struct {
DryRun bool `mapstructure:"dry_run"`
VerifyChecksums bool `mapstructure:"verify_checksums"`
DeleteSource bool `mapstructure:"delete_source"`
// TransferConcurrencyPerVolume caps simultaneous transfers landing on
// the same destination mount point. Heavy parallel writes to one disk
// trigger I/O contention that surfaces as false-positive disk-health
// failures and rsync no-progress timeouts. <=0 disables; 0 (unset)
// uses the daemon default (2).
TransferConcurrencyPerVolume int `mapstructure:"transfer_concurrency_per_volume"`
}
OptionsConfig contains general options
type PermissionsConfig ¶
type PermissionsConfig struct {
// User can be a username (e.g., "jellyfin") or numeric UID (e.g., "1000").
User string `mapstructure:"user" json:"user"`
// Group can be a group name (e.g., "jellyfin") or numeric GID (e.g., "1000").
Group string `mapstructure:"group" json:"group"`
// Modes are strings in octal (e.g., "0644" or "644"). Empty means preserve source.
FileMode string `mapstructure:"file_mode" json:"file_mode"`
DirMode string `mapstructure:"dir_mode" json:"dir_mode"`
}
func (*PermissionsConfig) ParseDirMode ¶
func (p *PermissionsConfig) ParseDirMode() (os.FileMode, error)
func (*PermissionsConfig) ParseFileMode ¶
func (p *PermissionsConfig) ParseFileMode() (os.FileMode, error)
func (*PermissionsConfig) ResolveGID ¶
func (p *PermissionsConfig) ResolveGID() (int, error)
func (*PermissionsConfig) ResolveUID ¶
func (p *PermissionsConfig) ResolveUID() (int, error)
func (*PermissionsConfig) WantsMode ¶
func (p *PermissionsConfig) WantsMode() bool
func (*PermissionsConfig) WantsOwnership ¶
func (p *PermissionsConfig) WantsOwnership() bool
Helper methods for permissions resolution and parsing
type RadarrConfig ¶
type SetupConfig ¶
type SonarrConfig ¶
type SonarrConfig struct {
Enabled bool `mapstructure:"enabled"`
URL string `mapstructure:"url"`
APIKey string `mapstructure:"api_key" secret:"true"`
NotifyOnImport bool `mapstructure:"notify_on_import"`
}
SonarrConfig contains Sonarr integration settings
type TMDBConfig ¶
type TMDBConfig struct {
Enabled bool `mapstructure:"enabled"`
APIKey string `mapstructure:"api_key" secret:"true"`
}
TMDBConfig holds optional credentials for TMDB direct lookups. Used by the housekeeping verifier as a fallback when Jellyfin RemoteSearch is unavailable. Free key: themoviedb.org/settings/api.
type WatchConfig ¶
type WatchConfig struct {
Movies []string `mapstructure:"movies"`
TV []string `mapstructure:"tv"`
SeedingMovies []string `mapstructure:"seeding_movies"`
SeedingTV []string `mapstructure:"seeding_tv"`
}
WatchConfig contains directories to watch
func (WatchConfig) AllPaths ¶ added in v0.1.13
func (w WatchConfig) AllPaths() []string
AllPaths returns every configured intake root in daemon scan order.
func (WatchConfig) MoviePaths ¶ added in v0.1.13
func (w WatchConfig) MoviePaths() []string
MoviePaths returns all ordinary and seeding movie intake roots.
func (WatchConfig) TVPaths ¶ added in v0.1.13
func (w WatchConfig) TVPaths() []string
TVPaths returns all ordinary and seeding TV intake roots.