Files
yellowjacket/backend/download/config.go
T
yonluandClaude Sonnet 5 e190fd75b9
Build & publish Arch package / arch-package (push) Successful in 2m12s
Search index maintenance / maintain-index (push) Successful in 2h22m28s
feat: data lifecycle rewrite, download clients, wanted list, and central catalog index
Ships the fresh-start schema cleanup: rebuilt explore catalog index
pipeline (dump import, artifact fetch/build, incremental listen-count
refresh), a new download subsystem (Lidarr/Prowlarr/qBittorrent/SABnzbd/
slskd/yt-dlp providers, staging, reconciliation, wanted list), and the
supporting schema/query/store changes across backend and frontend.

Also includes two smaller follow-ups: bump the central index's
rebuild-after cadence from 90 to 180 days, and remove the Explore
"library only" online/offline toggle entirely (frontend-only, no
backend counterpart) rather than carry unused UI/state.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2Agd9af5hE7qzti2ackiS
2026-08-06 17:12:01 -04:00

61 lines
2.2 KiB
Go

package download
import "time"
// UserConfig is the download subsystem's slice of the TOML config file.
// Provider connections are not here — they live in the database, keyed
// by row, because there can be many of them and they change through the
// settings UI rather than by hand-editing.
type UserConfig struct {
// PathTemplate lays out imported files under the library root.
// Tokens: {albumartist} {artist} {album} {year} {track} {disc}
// {title}. Empty falls back to DefaultPathTemplate.
PathTemplate string `toml:"PathTemplate"`
// AutoPick lets a single high-confidence, high-quality candidate
// download without asking. Off by default: an unattended download
// that picks wrong puts the wrong files in the library, and the
// ranking has to earn that trust on a given user's sources first.
AutoPick bool `toml:"AutoPick"`
// MaxConcurrent bounds simultaneous transfers across all providers.
// Per-provider limits sit underneath it and are set on the provider
// itself, since the right number depends on what is on the other
// end: one Soulseek peer, or a usenet server built for parallelism.
MaxConcurrent int `toml:"MaxConcurrent"`
// WantedIntervalMinutes is how often the wanted list is reconciled:
// artist subscriptions expanded, owned items retired, due wants
// searched for. Zero uses the default.
WantedIntervalMinutes int `toml:"WantedIntervalMinutes"`
// WantedBatch bounds how many wants one reconcile pass searches
// for. A large list should be worked through steadily rather than
// in one burst that every provider sees as a flood.
WantedBatch int `toml:"WantedBatch"`
}
// ApplyDefaults fills unset fields.
func (c *UserConfig) ApplyDefaults() {
if c.PathTemplate == "" {
c.PathTemplate = DefaultPathTemplate
}
if c.MaxConcurrent <= 0 {
c.MaxConcurrent = defaultConcurrency
}
if c.WantedIntervalMinutes <= 0 {
c.WantedIntervalMinutes = int(defaultReconcileInterval / time.Minute)
}
if c.WantedBatch <= 0 {
c.WantedBatch = defaultDueBatch
}
}
// WantedInterval is the reconcile interval as a duration.
func (c *UserConfig) WantedInterval() time.Duration {
return time.Duration(c.WantedIntervalMinutes) * time.Minute
}