config

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: GPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultInputHistoryLimit is the default number of retained input paths.
	DefaultInputHistoryLimit = 20
	// DefaultDVDMenuItems is the default automatic DVD menu capture limit.
	DefaultDVDMenuItems = 6
	// MaxDVDMenuItems is the largest accepted automatic DVD menu capture limit.
	MaxDVDMenuItems = 32
)

Variables

View Source
var ErrSecretEncryptionHelperUnavailable = errors.New("config secret encryption helper unavailable")

ErrSecretEncryptionHelperUnavailable means encrypted secret operations need web auth helper material that is not available for the config's DB path.

Functions

func ApplyEnvOverrides

func ApplyEnvOverrides(cfg *Config)

ApplyEnvOverrides mutates cfg with supported non-blank UA_ environment values. Invalid boolean and integer values are ignored, leaving the current field unchanged.

func BackupToYAML

func BackupToYAML(cfg *Config, baseDir string) (string, error)

BackupToYAML writes an encrypted backup to backups/config.yaml below baseDir, replacing any prior backup at that path, and returns the path.

func EmbeddedExampleYAML

func EmbeddedExampleYAML() []byte

EmbeddedExampleYAML returns a defensive copy of the embedded example config.

func ExportFromDatabaseToPlaintextYAML

func ExportFromDatabaseToPlaintextYAML(ctx context.Context, outputPath string, repo interface {
	LoadFullConfig(ctx context.Context, dest any) error
}) error

ExportFromDatabaseToPlaintextYAML loads config from database, applies environment overrides, and writes the resulting config to a YAML file without encrypting secret fields.

func ExportFromDatabaseToYAML

func ExportFromDatabaseToYAML(ctx context.Context, outputPath string, repo interface {
	LoadFullConfig(ctx context.Context, dest any) error
}) error

ExportFromDatabaseToYAML loads config from database, applies environment overrides, and writes the resulting config to a YAML file.

func ExportToJSON

func ExportToJSON(cfg *Config) (string, error)

ExportToJSON returns indented JSON with known secret fields encrypted.

func ExportToPlaintextJSON

func ExportToPlaintextJSON(cfg *Config) (string, error)

ExportToPlaintextJSON returns indented JSON without encrypting secret fields; callers must treat the result as secret-bearing.

func ExportToPlaintextYAML

func ExportToPlaintextYAML(cfg *Config, path string) error

ExportToPlaintextYAML writes YAML without encrypting secret fields. It still uses mode 0600, but callers must treat the file as secret-bearing.

func ExportToYAML

func ExportToYAML(cfg *Config, path string) error

ExportToYAML writes YAML with known secret fields encrypted. It creates the parent directory and writes the destination with mode 0600.

func LoadFromDatabaseWithRepairReport added in v0.2.0

func LoadFromDatabaseWithRepairReport(ctx context.Context, repo fullConfigLoader) (*Config, DatabaseRepairReport, error)

LoadFromDatabaseWithRepairReport loads and decrypts full config from repo, overlaying stored raw sections onto embedded defaults. The returned report identifies repaired root sections; if raw section-map loading fails but legacy struct loading succeeds, the report carries repair context without scheduling section persistence. On error the returned config is nil.

func LoadSectionFromDatabase

func LoadSectionFromDatabase(ctx context.Context, section string, dest any, repo interface {
	LoadConfigSection(ctx context.Context, section string, dest any) error
}) error

LoadSectionFromDatabase decodes one raw section into dest without applying defaults, decryption, environment overrides, or validation.

func MergeMissingTrackerDefaults

func MergeMissingTrackerDefaults(cfg *Config) (bool, error)

MergeMissingTrackerDefaults backfills tracker stubs from the embedded example config so older saved configs can discover newly added trackers in the WebUI. Existing exact tracker names are preserved; ASCII case variants of "BTN" are treated as the BTN entry so default backfill and legacy metadata tokens do not create a duplicate canonical "BTN" entry. CZT keeps user credentials in Passkey only, so stale URL, APIKey, and AnnounceURL values are removed while preserving the passkey. Legacy Metadata.BTNAPI is moved into the BTN tracker APIKey when needed, then cleared once a tracker token is available. Legacy RF image-host settings are moved into the global image-hosting section. The returned flag reports whether cfg was modified.

func ResolveBTNAPIToken

func ResolveBTNAPIToken(cfg Config) string

ResolveBTNAPIToken returns the BTN tracker API key from ASCII case variants of "BTN" before falling back to the legacy metadata-level token. Fuzzy or Unicode-equivalent tracker names are not treated as aliases.

func ResolveTrackerDomain

func ResolveTrackerDomain(_ *Config, trackerNameOrDomain string) (string, string)

ResolveTrackerDomain preserves the trimmed tracker identifier in its first result. Domain resolution is no longer performed, so the second result is empty.

func RewrapSecretsInDatabase

func RewrapSecretsInDatabase(ctx context.Context, repo interface {
	LoadFullConfig(ctx context.Context, dest any) error
	SaveFullConfig(ctx context.Context, cfg any) error
}, oldMaterial, newMaterial authmaterial.Material) error

RewrapSecretsInDatabase decrypts stored config secrets with oldMaterial, re-encrypts them with newMaterial, and saves the updated config.

func RewrapSecretsInDatabaseWithFallback

func RewrapSecretsInDatabaseWithFallback(ctx context.Context, repo interface {
	LoadFullConfig(ctx context.Context, dest any) error
	SaveFullConfig(ctx context.Context, cfg any) error
}, sourceMaterials []authmaterial.Material, newMaterial authmaterial.Material) error

RewrapSecretsInDatabaseWithFallback decrypts stored config secrets using the first matching source material, then re-encrypts them with newMaterial.

func SaveSectionToDatabase

func SaveSectionToDatabase(ctx context.Context, section string, data any, repo interface {
	SaveConfigSection(ctx context.Context, section string, data any) error
}) error

SaveSectionToDatabase writes one caller-supplied section verbatim. It does not canonicalize the section name, encrypt secrets, or preserve unknown stored fields; use SaveSectionsToDatabase for Config-owned persistence.

func SaveSectionsToDatabase added in v0.2.0

func SaveSectionsToDatabase(ctx context.Context, cfg *Config, sections []string, repo interface {
	SaveConfigSection(ctx context.Context, section string, data any) error
}) error

SaveSectionsToDatabase persists only selected root config sections. Section names may use exported field names or root yaml/json tag aliases, and every requested name is canonicalized before any write. Only selected sections are prepared for secret encryption; repositories that support batch section saves receive all selected payloads in one call, preserving same-root unknown stored fields when the full raw config is available. Repositories without batch support can save one canonical section only; multi-section requests fail before any write.

func SaveToDatabase

func SaveToDatabase(ctx context.Context, cfg *Config, repo interface {
	SaveFullConfig(ctx context.Context, cfg any) error
}) error

SaveToDatabase encrypts known secrets in a clone, then replaces the repository's full config without mutating cfg.

func TrackerConfigured added in v0.3.0

func TrackerConfigured(cfg TrackerConfig, schema TrackerSchema) bool

TrackerConfigured reports whether any schema activation field has a non-empty value. Configured state is intentionally weaker than authentication readiness.

Types

type ArrIntegrationConfig

type ArrIntegrationConfig struct {
	UseSonarr     bool   `yaml:"use_sonarr"`
	SonarrURL     string `yaml:"sonarr_url"`
	SonarrAPIKey  string `yaml:"sonarr_api_key"`
	SonarrURL1    string `yaml:"sonarr_url_1"`
	SonarrAPIKey1 string `yaml:"sonarr_api_key_1"`
	SonarrURL2    string `yaml:"sonarr_url_2"`
	SonarrAPIKey2 string `yaml:"sonarr_api_key_2"`
	SonarrURL3    string `yaml:"sonarr_url_3"`
	SonarrAPIKey3 string `yaml:"sonarr_api_key_3"`
	UseRadarr     bool   `yaml:"use_radarr"`
	RadarrURL     string `yaml:"radarr_url"`
	RadarrAPIKey  string `yaml:"radarr_api_key"`
	RadarrURL1    string `yaml:"radarr_url_1"`
	RadarrAPIKey1 string `yaml:"radarr_api_key_1"`
	RadarrURL2    string `yaml:"radarr_url_2"`
	RadarrAPIKey2 string `yaml:"radarr_api_key_2"`
	RadarrURL3    string `yaml:"radarr_url_3"`
	RadarrAPIKey3 string `yaml:"radarr_api_key_3"`
	EmbyDir       string `yaml:"emby_dir"`
	EmbyTVDir     string `yaml:"emby_tv_dir"`
}

type CSVList

type CSVList []string

CSVList accepts either a YAML sequence or a comma-separated scalar. Scalar items are trimmed and blanks removed; sequence values are preserved as read.

func (*CSVList) UnmarshalYAML

func (c *CSVList) UnmarshalYAML(value *yaml.Node) error

type ClientSetupConfig

type ClientSetupConfig struct {
	DefaultClient string  `yaml:"default_torrent_client"`
	InjectClients CSVList `yaml:"injecting_client_list"`
	SearchClients CSVList `yaml:"searching_client_list"`
}

type Config

type Config struct {
	MainSettings       MainSettingsConfig             `yaml:"main_settings"`
	ImageHosting       ImageHostingConfig             `yaml:"image_hosting"`
	Metadata           MetadataConfig                 `yaml:"metadata"`
	ScreenshotHandling ScreenshotHandlingConfig       `yaml:"screenshot_handling"`
	Description        DescriptionSettingsConfig      `yaml:"description_settings"`
	ClientSetup        ClientSetupConfig              `yaml:"client_setup"`
	ArrIntegration     ArrIntegrationConfig           `yaml:"arr_integration"`
	TorrentCreation    TorrentCreationConfig          `yaml:"torrent_creation"`
	PostUpload         PostUploadConfig               `yaml:"post_upload"`
	Logging            LoggingConfig                  `yaml:"logging"`
	Trackers           TrackersConfig                 `yaml:"trackers"`
	TorrentClients     map[string]TorrentClientConfig `yaml:"torrent_clients"`
	// contains filtered or unexported fields
}

Config is the complete runtime and persistence configuration. Secret-aware export and database APIs clone it before transforming secret fields.

func DecryptConfigSecrets

func DecryptConfigSecrets(cfg *Config) (*Config, error)

DecryptConfigSecrets returns a cloned config where known encrypted secret fields are decrypted. Helper material is required only when at least one secret envelope is present.

func DecryptImportedConfigSecrets added in v0.2.0

func DecryptImportedConfigSecrets(cfg *Config) (*Config, error)

DecryptImportedConfigSecrets decrypts native-import secret envelopes and marks the returned config so later persistence cannot silently fall back to plaintext if destination helper material is unavailable.

func EncryptConfigSecrets

func EncryptConfigSecrets(cfg *Config) (*Config, error)

EncryptConfigSecrets returns a cloned config where known secret fields are encrypted. If helper material is unavailable, configs with imported or existing encrypted envelopes fail instead of falling back to plaintext.

func ImportFromJSON

func ImportFromJSON(payload string) (*Config, error)

ImportFromJSON deserializes plaintext JSON config (for example, ExportToPlaintextJSON output) without attempting secret decryption.

func ImportFromJSONEncrypted

func ImportFromJSONEncrypted(payload string) (*Config, error)

ImportFromJSONEncrypted deserializes JSON config that contains encrypted secret envelopes (for example, ExportToJSON output) and decrypts secrets.

func ImportFromYAML

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

ImportFromYAML reads YAML and decrypts recognized secret envelopes. It does not overlay embedded defaults, apply environment overrides, or validate the resulting config.

func Load

func Load(path string) (Config, error)

Load reads YAML, applies environment overrides, and validates the resulting runtime config. It does not overlay embedded defaults.

func LoadEmbeddedDefaultConfig

func LoadEmbeddedDefaultConfig() (*Config, error)

LoadEmbeddedDefaultConfig parses the embedded example and backfills any tracker defaults missing from its decoded shape.

func LoadFromDatabase

func LoadFromDatabase(ctx context.Context, repo fullConfigLoader) (*Config, error)

LoadFromDatabase loads the full config from the repository, overlaying saved sections onto embedded defaults so older persisted configs pick up newly added options while preserving explicit zero values and decrypted secrets.

func LoadFromDatabaseWithDefaultBackfill added in v0.2.0

func LoadFromDatabaseWithDefaultBackfill(ctx context.Context, repo fullConfigLoader) (*Config, bool, error)

LoadFromDatabaseWithDefaultBackfill returns a loaded config plus a changed flag indicating whether embedded defaults filled fields missing from storage. The flag is based on raw stored JSON key presence before Config unmarshaling, so explicit false, zero, and empty values do not look like missing fields.

func (Config) Validate

func (c Config) Validate() error

Validate checks the loaded configuration values needed before runtime services can safely start or save settings. An empty TMDBAPI is valid and leaves TMDB enrichment disabled.

type DatabaseRepairReport added in v0.2.0

type DatabaseRepairReport struct {
	BackfilledDefaults bool
	ChangedSections    []string
	InvalidPaths       []string
	DeprecatedPaths    []string
}

DatabaseRepairReport describes load-time repairs needed after overlaying stored config onto embedded defaults. BackfilledDefaults reports missing defaults, invalid stored objects, or legacy fallback context repaired in memory. ChangedSections contains sorted JSON root section names that should be persisted; roots with invalid object-shaped input are excluded because the stored subtree was not safely reusable. InvalidPaths contains dotted raw-config paths whose stored value could not be used as an object.

type DescriptionSettingsConfig

type DescriptionSettingsConfig struct {
	LogoSize                int    `yaml:"logo_size"`
	LogoLanguage            string `yaml:"logo_language"`
	ThumbnailSize           int    `yaml:"thumbnail_size"`
	ScreensPerRow           string `yaml:"screens_per_row"`
	EpisodeOverview         bool   `yaml:"episode_overview"`
	TonemappedHeader        string `yaml:"tonemapped_header"`
	MultiScreens            int    `yaml:"multiScreens"`
	PackThumbSize           int    `yaml:"pack_thumb_size"`
	CharLimit               int    `yaml:"charLimit"`
	FileLimit               int    `yaml:"fileLimit"`
	ProcessLimit            int    `yaml:"processLimit"`
	CustomDescriptionHeader string `yaml:"custom_description_header"`
	ScreenshotHeader        string `yaml:"screenshot_header"`
	DiscMenuHeader          string `yaml:"disc_menu_header"`
	CustomSignature         string `yaml:"custom_signature"`
	AddBlurayLink           bool   `yaml:"add_bluray_link"`
	UseBlurayImages         bool   `yaml:"use_bluray_images"`
	BlurayImageSize         int    `yaml:"bluray_image_size"`
}

type ImageHostingConfig

type ImageHostingConfig struct {
	Host1             string `yaml:"img_host_1"`
	Host2             string `yaml:"img_host_2"`
	Host3             string `yaml:"img_host_3"`
	Host4             string `yaml:"img_host_4"`
	Host5             string `yaml:"img_host_5"`
	Host6             string `yaml:"img_host_6"`
	ImgBBAPI          string `yaml:"imgbb_api"`
	LensdumpAPI       string `yaml:"lensdump_api"`
	PTScreensAPI      string `yaml:"ptscreens_api"`
	OnlyImageAPI      string `yaml:"onlyimage_api"`
	DalexniAPI        string `yaml:"dalexni_api"`
	PassTheImageAPI   string `yaml:"passtheima_ge_api"`
	ZiplineURL        string `yaml:"zipline_url"`
	ZiplineAPIKey     string `yaml:"zipline_api_key"`
	SeedpoolCDNAPI    string `yaml:"seedpool_cdn_api"`
	SamaritanoEnabled bool   `yaml:"samaritano_enabled"`
	SamaritanoAPI     string `yaml:"samaritano_api_key"`
	ShareXURL         string `yaml:"sharex_url"`
	ShareXAPIKey      string `yaml:"sharex_api_key"`
	UTPPMAPI          string `yaml:"utppm_api"`
	LostimgEnabled    bool   `yaml:"lostimg_enabled"`
	LostimgAPI        string `yaml:"lostimg_api"`
	ReelflixEnabled   bool   `yaml:"reelflix_enabled"`
	ReelflixAPI       string `yaml:"reelflix_api"`
}

func (ImageHostingConfig) ConditionalHostConfigured added in v0.3.2

func (c ImageHostingConfig) ConditionalHostConfigured(host string) (configured bool, ok bool)

ConditionalHostConfigured reports whether host is a known conditional image host and has both its enable flag and required API key configured.

type LoggingConfig

type LoggingConfig struct {
	Level          string `yaml:"level"`
	FileEnabled    bool   `yaml:"file_enabled"`
	MaxTotalSizeMB int    `yaml:"max_total_size_mb"`
	MaxFiles       int    `yaml:"max_files"`
}

type MainSettingsConfig

type MainSettingsConfig struct {
	UpdateNotification  bool `yaml:"update_notification"`
	VerboseNotification bool `yaml:"verbose_notification"`
	// TMDBAPI is the optional API key used for TMDB lookups and enrichment.
	TMDBAPI           string `yaml:"tmdb_api"`
	TrackerPassChecks int    `yaml:"tracker_pass_checks"`
	InputHistoryLimit int    `yaml:"input_history_limit"`
	DBPath            string `yaml:"db_path"`
	UseFavicons       bool   `yaml:"use_favicons"`
	FaviconOnly       bool   `yaml:"favicon_only"`
	SceneDetection    bool   `yaml:"scene_detection"`
}

MainSettingsConfig defines application-wide runtime and presentation settings. TMDB enrichment is disabled when TMDBAPI is empty; other metadata providers and externally supplied metadata IDs remain available.

func (*MainSettingsConfig) UnmarshalJSON

func (c *MainSettingsConfig) UnmarshalJSON(data []byte) error

func (*MainSettingsConfig) UnmarshalYAML

func (c *MainSettingsConfig) UnmarshalYAML(value *yaml.Node) error

type MetadataConfig

type MetadataConfig struct {
	BTNAPI                    string  `yaml:"btn_api"`
	SkipAutoTorrent           bool    `yaml:"skip_auto_torrent"`
	SkipTrackerFilenameLookup bool    `yaml:"skip_tracker_filename_lookup"`
	UseLargestPlaylist        bool    `yaml:"use_largest_playlist"`
	KeepImages                bool    `yaml:"keep_images"`
	OnlyID                    bool    `yaml:"only_id"`
	UserOverrides             bool    `yaml:"user_overrides"`
	PingUnit3D                bool    `yaml:"ping_unit3d"`
	GetBlurayInfo             bool    `yaml:"get_bluray_info"`
	BlurayScore               float64 `yaml:"bluray_score"`
	BluraySingleScore         float64 `yaml:"bluray_single_score"`
	CheckPredb                bool    `yaml:"check_predb"`
}

type PostUploadConfig

type PostUploadConfig struct {
	InjectDelay              int  `yaml:"inject_delay"`
	ShowUploadDuration       bool `yaml:"show_upload_duration"`
	PrintTrackerMessages     bool `yaml:"print_tracker_messages"`
	PrintTrackerLinks        bool `yaml:"print_tracker_links"`
	MaxConcurrentTrackers    int  `yaml:"max_concurrent_tracker_uploads"`
	SearchRequests           bool `yaml:"search_requests"`
	CrossSeeding             bool `yaml:"cross_seeding"`
	CrossSeedCheckEverything bool `yaml:"cross_seed_check_everything"`
}

type ScreenshotHandlingConfig

type ScreenshotHandlingConfig struct {
	Screens int `yaml:"screens"`
	// MaxMenuItems bounds automatic DVD menu captures; zero resolves to DefaultDVDMenuItems.
	MaxMenuItems         int     `yaml:"max_menu_items"`
	MinSuccessfulUploads int     `yaml:"min_successful_image_uploads"`
	CutoffScreens        int     `yaml:"cutoff_screens"`
	FrameOverlay         bool    `yaml:"frame_overlay"`
	OverlayTextSize      int     `yaml:"overlay_text_size"`
	ProcessLimit         int     `yaml:"process_limit"`
	MaxConcurrentUploads int     `yaml:"max_concurrent_uploads"`
	FFmpegLimit          bool    `yaml:"ffmpeg_limit"`
	ToneMap              bool    `yaml:"tone_map"`
	UseLibplacebo        bool    `yaml:"use_libplacebo"`
	FFmpegCompression    int     `yaml:"ffmpeg_compression"`
	TonemapAlgorithm     string  `yaml:"algorithm"`
	Desat                float64 `yaml:"desat"`
}

func (*ScreenshotHandlingConfig) ResolvedMaxMenuItems added in v0.2.4

func (c *ScreenshotHandlingConfig) ResolvedMaxMenuItems() int

ResolvedMaxMenuItems returns the configured DVD menu capture limit. Zero in legacy or programmatic configs uses the embedded default.

func (*ScreenshotHandlingConfig) ResolvedMinSuccessfulUploads added in v0.3.0

func (c *ScreenshotHandlingConfig) ResolvedMinSuccessfulUploads() int

ResolvedMinSuccessfulUploads returns how many images a host must publish for a tracker before a partially failed image-host batch still counts as usable. Zero or negative disables the allowance, so any failed image fails the batch.

func (*ScreenshotHandlingConfig) UnmarshalJSON added in v0.2.4

func (c *ScreenshotHandlingConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON preserves the default menu limit when legacy JSON omits or explicitly zeroes MaxMenuItems.

func (*ScreenshotHandlingConfig) UnmarshalYAML added in v0.2.4

func (c *ScreenshotHandlingConfig) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML preserves the default menu limit when legacy YAML omits or explicitly zeroes max_menu_items.

type StringList

type StringList []string

StringList accepts one string or a string sequence in JSON and YAML. Unlike CSVList, a scalar is one item and is not split on commas.

func (*StringList) UnmarshalJSON

func (l *StringList) UnmarshalJSON(data []byte) error

func (*StringList) UnmarshalYAML

func (l *StringList) UnmarshalYAML(value *yaml.Node) error

type TorrentClientConfig

type TorrentClientConfig struct {
	Type          string     `yaml:"type"`
	TorrentClient string     `yaml:"torrent_client"`
	URL           string     `yaml:"url"`
	QuiProxyURL   string     `yaml:"qui_proxy_url"`
	WatchFolder   string     `yaml:"watch_folder"`
	StorageDir    string     `yaml:"torrent_storage_dir"`
	Username      string     `yaml:"username"`
	Password      string     `yaml:"password"`
	Category      string     `yaml:"category"`
	Tags          []string   `yaml:"tags"`
	TLSSkipVerify *bool      `yaml:"tls_skip_verify"`
	Linking       string     `yaml:"linking"`
	AllowFallback *bool      `yaml:"allow_fallback"`
	LinkedFolder  StringList `yaml:"linked_folder"`
	LocalPath     StringList `yaml:"local_path"`
	RemotePath    StringList `yaml:"remote_path"`
	// AutomaticManagementPaths enables qBittorrent automatic management when
	// an unlinked injection's original local save path contains any configured value.
	AutomaticManagementPaths StringList `yaml:"automatic_management_paths"`

	QbitURL                string   `yaml:"qbit_url"`
	QbitPort               int      `yaml:"qbit_port"`
	QbitUser               string   `yaml:"qbit_user"`
	QbitPass               string   `yaml:"qbit_pass"`
	QbitCategoryValue      string   `yaml:"qbit_cat"`
	QbitTag                string   `yaml:"qbit_tag"`
	QbitTagsValue          []string `yaml:"qbit_tags"`
	QbitCrossCategory      string   `yaml:"qbit_cross_cat"`
	QbitCrossTag           string   `yaml:"qbit_cross_tag"`
	UseTrackerAsTag        bool     `yaml:"use_tracker_as_tag"`
	VerifyWebUICertificate *bool    `yaml:"verify_webui_certificate"`
}

TorrentClientConfig supports current qBittorrent/watch/qui fields plus legacy aliases. Its resolver methods define field precedence, and marshaling emits the resolved canonical values rather than duplicate aliases.

func (TorrentClientConfig) ClientType

func (c TorrentClientConfig) ClientType() string

ClientType resolves Type before legacy TorrentClient and defaults to "qbit".

func (TorrentClientConfig) FallbackAllowed

func (c TorrentClientConfig) FallbackAllowed() bool

FallbackAllowed defaults to true when AllowFallback is unset.

func (TorrentClientConfig) LinkingMode

func (c TorrentClientConfig) LinkingMode() string

LinkingMode returns a lowercase mode and normalizes "none" or "disabled" to empty.

func (TorrentClientConfig) MarshalJSON

func (c TorrentClientConfig) MarshalJSON() ([]byte, error)

func (TorrentClientConfig) MarshalYAML

func (c TorrentClientConfig) MarshalYAML() (any, error)

func (TorrentClientConfig) QbitCategory

func (c TorrentClientConfig) QbitCategory() string

QbitCategory resolves QbitCategoryValue before legacy Category.

func (TorrentClientConfig) QbitHost

func (c TorrentClientConfig) QbitHost() string

QbitHost returns QuiProxyURL when set; otherwise it resolves QbitURL before legacy URL, adds an http scheme when absent, and applies QbitPort when the URL has no explicit port.

func (TorrentClientConfig) QbitPassword

func (c TorrentClientConfig) QbitPassword() string

QbitPassword resolves QbitPass before legacy Password.

func (TorrentClientConfig) QbitTLSSkipVerify

func (c TorrentClientConfig) QbitTLSSkipVerify() bool

QbitTLSSkipVerify resolves TLSSkipVerify first, then inverts the legacy VerifyWebUICertificate value, and otherwise defaults to false.

func (TorrentClientConfig) QbitTags

func (c TorrentClientConfig) QbitTags() string

QbitTags resolves QbitTag, then QbitTagsValue, then legacy Tags, removing blank slice entries and joining multiple tags with commas.

func (TorrentClientConfig) QbitUsername

func (c TorrentClientConfig) QbitUsername() string

QbitUsername resolves QbitUser before legacy Username.

func (TorrentClientConfig) UsesQuiProxy

func (c TorrentClientConfig) UsesQuiProxy() bool

UsesQuiProxy reports whether a non-blank QuiProxyURL is configured.

type TorrentCreationConfig

type TorrentCreationConfig struct {
	MkbrrThreads   int  `yaml:"mkbrr_threads"`
	PreferMax16    bool `yaml:"prefer_max_16_torrent"`
	RehashCooldown int  `yaml:"rehash_cooldown"`
}

TorrentCreationConfig controls torrent construction and reuse scheduling. RehashCooldown delays rehash-dependent tracker submissions by that many seconds after all reusable tracker submissions finish; negative values act as zero.

type TrackerConfig

type TrackerConfig struct {
	LinkDirName         string         `yaml:"link_dir_name" json:"LinkDirName"`
	APIKey              string         `yaml:"api_key" json:"APIKey"`
	PTPAPIUser          string         `yaml:"ApiUser" json:"ApiUser"`
	PTPAPIKey           string         `yaml:"ApiKey" json:"ApiKey"`
	Username            string         `yaml:"username" json:"Username"`
	Password            string         `yaml:"password" json:"Password"`
	Passkey             string         `yaml:"passkey" json:"Passkey"`
	AnnounceURL         string         `yaml:"announce_url" json:"AnnounceURL"`
	MyAnnounceURL       string         `yaml:"my_announce_url" json:"MyAnnounceURL"`
	FaviconURL          string         `yaml:"favicon_url" json:"FaviconURL"`
	UploaderStatus      bool           `yaml:"uploader_status" json:"UploaderStatus"`
	CustomLayout        string         `yaml:"custom_layout" json:"CustomLayout"`
	TagForCustomRelease string         `yaml:"tag_for_custom_release" json:"TagForCustomRelease"`
	CheckForRules       bool           `yaml:"check_for_rules" json:"CheckForRules"`
	ModQ                bool           `yaml:"modq" json:"ModQ"`
	Draft               bool           `yaml:"draft" json:"Draft"`
	DraftDefault        bool           `yaml:"draft_default" json:"DraftDefault"`
	Anon                bool           `yaml:"anon" json:"Anon"`
	ShowGroupIfAnon     bool           `yaml:"show_group_if_anon" json:"ShowGroupIfAnon"`
	BhdRSSKey           string         `yaml:"bhd_rss_key" json:"BhdRSSKey"`
	CheckRequests       bool           `yaml:"check_requests" json:"CheckRequests"`
	FullMediainfo       bool           `yaml:"full_mediainfo" json:"FullMediainfo"`
	UploaderName        string         `yaml:"uploader_name" json:"UploaderName"`
	ImgRehost           bool           `yaml:"img_rehost" json:"ImgRehost"`
	ImageHost           string         `yaml:"image_host" json:"ImageHost"`
	TorrentClient       string         `yaml:"torrent_client" json:"TorrentClient"`
	UseSpanishTitle     bool           `yaml:"use_spanish_title" json:"UseSpanishTitle"`
	UseItalianTitle     bool           `yaml:"use_italian_title" json:"UseItalianTitle"`
	OTPURI              string         `yaml:"otp_uri" json:"OTPURI"`
	SkipIfRehash        bool           `yaml:"skip_if_rehash" json:"SkipIfRehash"`
	PTGenAPI            string         `yaml:"ptgen_api" json:"PTGenAPI"`
	AddWebSourceToDesc  bool           `yaml:"add_web_source_to_desc" json:"AddWebSourceToDesc"`
	UseMetadataName     bool           `yaml:"use_metadata_name" json:"UseMetadataName"`
	InjectDelay         *int           `yaml:"inject_delay" json:"InjectDelay"`
	ImageCount          int            `yaml:"image_count" json:"ImageCount"`
	Channel             string         `yaml:"channel" json:"Channel"`
	ImgAPI              string         `yaml:"img_api" json:"ImgAPI"`
	PronfoAPIKey        string         `yaml:"pronfo_api_key" json:"PronfoAPIKey"`
	PronfoTheme         string         `yaml:"pronfo_theme" json:"PronfoTheme"`
	PronfoRAPIID        string         `yaml:"pronfo_rapi_id" json:"PronfoRAPIID"`
	APIUpload           bool           `yaml:"api_upload" json:"APIUpload"`
	Exclusive           bool           `yaml:"exclusive" json:"Exclusive"`
	LoginQuestion       string         `yaml:"login_question" json:"LoginQuestion"`
	LoginAnswer         string         `yaml:"login_answer" json:"LoginAnswer"`
	UserID              string         `yaml:"user_id" json:"UserID"`
	Internal            bool           `yaml:"internal" json:"Internal"`
	InternalGroups      []string       `yaml:"internal_groups" json:"InternalGroups"`
	Unknown             map[string]any `yaml:"-" json:"-"`
}

TrackerConfig stores one tracker's supported settings. Unknown preserves unsupported extension fields across load/save, excluding deprecated URL fields and schema-known fields belonging to another tracker. SkipIfRehash omits the tracker when torrent preparation requires regeneration, including forced regeneration of source data.

func TrackerConfigByName added in v0.3.2

func TrackerConfigByName(trackers map[string]TrackerConfig, name string) (TrackerConfig, bool)

TrackerConfigByName returns the exact canonical tracker entry when present, then the first trimmed case-insensitive alias in lexical order.

type TrackerDefaultsMergeReport added in v0.2.0

type TrackerDefaultsMergeReport struct {
	Changed         bool
	ChangedSections []string
}

TrackerDefaultsMergeReport describes semantic tracker-default changes made by MergeMissingTrackerDefaultsWithReport. Changed reports whether cfg was modified; ChangedSections contains sorted JSON root section names to persist, including Metadata when a legacy metadata BTN token is cleared.

func MergeMissingTrackerDefaultsWithReport added in v0.2.0

func MergeMissingTrackerDefaultsWithReport(cfg *Config) (TrackerDefaultsMergeReport, error)

MergeMissingTrackerDefaultsWithReport backfills semantic tracker defaults and reports the root sections that should be persisted. It may initialize nil tracker maps for runtime use without marking cfg changed. Legacy Metadata.BTNAPI is copied to the BTN tracker before Metadata is marked for clearing so callers can persist both affected sections together.

type TrackerFieldSchema added in v0.3.0

type TrackerFieldSchema struct {
	JSONKey    string
	YAMLKey    string
	Default    any
	Activation bool
}

TrackerFieldSchema maps one ordered field between JSON and YAML, records its embedded default, and marks whether a non-empty value activates configured state.

type TrackerSchema added in v0.3.0

type TrackerSchema struct {
	Name   string
	Fields []TrackerFieldSchema
}

TrackerSchema describes the ordered configuration surface for one supported tracker.

func OrderedTrackerSchemas added in v0.3.0

func OrderedTrackerSchemas() ([]TrackerSchema, error)

OrderedTrackerSchemas returns a defensive copy of the tracker schemas declared by the embedded example config, preserving tracker and field declaration order.

type TrackersConfig

type TrackersConfig struct {
	DefaultTrackers  CSVList                  `yaml:"default_trackers" json:"DefaultTrackers"`
	PreferredTracker string                   `yaml:"preferred_tracker" json:"PreferredTracker"`
	Trackers         map[string]TrackerConfig `yaml:"-" json:"Trackers"`
}

TrackersConfig preserves ordered default selections, one preferred tracker, and tracker settings keyed by configured tracker name.

func (TrackersConfig) MarshalJSON

func (t TrackersConfig) MarshalJSON() ([]byte, error)

func (TrackersConfig) MarshalYAML

func (t TrackersConfig) MarshalYAML() (any, error)

func (*TrackersConfig) UnmarshalJSON

func (t *TrackersConfig) UnmarshalJSON(data []byte) error

func (*TrackersConfig) UnmarshalYAML

func (t *TrackersConfig) UnmarshalYAML(value *yaml.Node) error

Directories

Path Synopsis
Package importer dispatches configuration imports to the appropriate parser based on file extension.
Package importer dispatches configuration imports to the appropriate parser based on file extension.

Jump to

Keyboard shortcuts

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