From 99958c7ce69485e6ef17d37c79b35d8e5a743e21 Mon Sep 17 00:00:00 2001 From: jodacame Date: Wed, 1 Jul 2026 14:09:01 +0000 Subject: [PATCH] feat(engine): auto-free disk space with retention + hard cap Disk mode never fills up now: content that is no longer needed is removed, and the download folder is bounded by a configurable cap (the disk analogue of the RAM ring-buffer). Policy (internal/engine/janitor.go): - retire(): a torrent no longer needed. Private torrents are deleted immediately (their tracker ratio/time already served as the retention window); public torrents are dropped from the active set but kept on disk and marked PendingDeleteAt = now + grace, so a returning viewer resumes instantly. - janitor loop: deletes pending content once its grace window elapses; if the dir exceeds Disk.MaxGB, evicts the oldest inactive content first (the hard cap overrides the grace window). - Never touches content being watched (readers>0) or seeding toward a live target. Triggers wired: - seed ratio/time target met -> retire (was: drop, leaving files) [deleteAfterSeed] - end of playback / idle timeout in disk mode -> retire [deleteAfterPlayback] - re-adding a pending torrent clears the flag (rescue from retained files). Safety guards for automatic deletion: reject empty names and path traversal via crafted torrent names (safeDataPath), delete only disk-mode records, and route manual delete-with-files through the same guard. Settings (config.Disk, editable in the UI, not env): maxGB, graceMinutes, deleteAfterSeed, deleteAfterPlayback. TorrentRecord gains PendingDeleteAt. Tests: safeDataPath guards, dirSize, evictKey ordering, deleteRecordFiles. Docs: README "Disk cleanup" section. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_012bj3G2zzqEaALFa8ufbkDJ --- README.md | 20 +++ internal/config/config.go | 21 +++ internal/engine/engine.go | 6 +- internal/engine/janitor.go | 200 ++++++++++++++++++++++++++++ internal/engine/janitor_test.go | 104 +++++++++++++++ internal/engine/seeding.go | 37 +++-- internal/engine/stream.go | 17 ++- web/src/api.ts | 6 + web/src/components/SettingsView.tsx | 11 ++ web/src/i18n/locales/en.ts | 9 ++ web/src/i18n/locales/es.ts | 9 ++ 11 files changed, 427 insertions(+), 13 deletions(-) create mode 100644 internal/engine/janitor.go create mode 100644 internal/engine/janitor_test.go diff --git a/README.md b/README.md index 723f927..3695e61 100644 --- a/README.md +++ b/README.md @@ -244,6 +244,26 @@ environment: > Going public? Always put it behind **TLS** (a reverse proxy) so the session cookie is > `Secure`, and prefer a **VPN** when you can. See [Security](#security). +### Disk cleanup (disk mode) + +In **RAM mode** nothing is written to disk, so there's nothing to clean. In **disk mode** +FluxTorrent frees space automatically so `/downloads` never fills up. Tune it in the +**Settings → Disk cleanup** screen: + +| Setting | Default | What it does | +|---|---|---| +| **Disk limit (GB)** | `0` = off | Hard cap for the download folder. When exceeded, the **oldest unused** content is deleted first until back under the cap. | +| **Safety window (min)** | `60` | After content is no longer needed it's kept this long before deletion, so replaying it **resumes without re-downloading**. | +| **Delete after sharing** | `on` | Free the files once a torrent meets its seed **ratio/time** target. | +| **Delete after watching** | `on` | Remove leftover files after you finish watching or a torrent goes idle. | + +**What is kept:** anything **being watched right now** or **still seeding toward a live +target** is never touched. **Private torrents** manage their own ratio/time window, so they're +deleted **immediately** when it's met (no safety window). Everything else is retired: dropped +from the active set, kept for the safety window (so a returning viewer resumes instantly), then +deleted. The disk cap is a hard guarantee — under pressure it evicts the oldest content first, +overriding the safety window. + ### Per-source rules Rules are evaluated **in order, first match wins** (edit them in the **Rules** screen): diff --git a/internal/config/config.go b/internal/config/config.go index dbb1daf..acbcbf2 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -62,6 +62,15 @@ type Compressed struct { Reject bool `json:"reject"` } +// Disk retention: auto-free space in disk mode by removing content once it is no +// longer needed, and cap the disk-cache directory so it can never fill up. +type Disk struct { + MaxGB int `json:"maxGB"` // hard cap for the disk-cache dir; 0 = no cap + GraceMinutes int `json:"graceMinutes"` // safety window before deleting public content (0 = immediate) + DeleteAfterSeed bool `json:"deleteAfterSeed"` // delete files once a seed ratio/time target is met + DeleteAfterPlayback bool `json:"deleteAfterPlayback"` // disk mode: delete leftover files after playback / idle timeout +} + // Settings is the full config object persisted in bbolt. type Settings struct { Cache Cache `json:"cache"` @@ -69,6 +78,7 @@ type Settings struct { Net Net `json:"net"` Limits Limits `json:"limits"` Compressed Compressed `json:"compressed"` + Disk Disk `json:"disk"` NoPeersTimeoutSec int `json:"noPeersTimeoutSec"` APIToken string `json:"apiToken"` } @@ -100,6 +110,7 @@ func Defaults() Settings { Net: Net{ListenHost: "0.0.0.0", ListenPort: 7001, BTPort: 42069, DHT: true, MaxConns: 200, DownKbps: 0, UpKbps: 0, EncryptHeaders: false, IPv6: true, UTP: true, DisconnectTimeoutSec: 0}, Limits: Limits{MaxActiveTorrents: 8}, Compressed: Compressed{Reject: true}, + Disk: Disk{MaxGB: 0, GraceMinutes: 60, DeleteAfterSeed: true, DeleteAfterPlayback: true}, NoPeersTimeoutSec: 60, APIToken: "", } @@ -126,6 +137,10 @@ type TorrentRecord struct { SeedUntilRatio float64 `json:"seedUntilRatio"` SeedUntilMinutes int `json:"seedUntilMinutes"` SeedStartedAt int64 `json:"seedStartedAt"` + // PendingDeleteAt marks public disk content slated for deletion once the + // grace window elapses (unix seconds; 0 = not pending). Re-adding the torrent + // clears it (the returning viewer resumes from the retained files). + PendingDeleteAt int64 `json:"pendingDeleteAt"` } // Store is the bbolt-backed config + state store. Safe for concurrent use. @@ -302,6 +317,12 @@ func normalize(cfg *Settings) { if cfg.NoPeersTimeoutSec < 1 { cfg.NoPeersTimeoutSec = 60 } + if cfg.Disk.MaxGB < 0 { + cfg.Disk.MaxGB = 0 + } + if cfg.Disk.GraceMinutes < 0 { + cfg.Disk.GraceMinutes = 0 + } } // applyEnv overlays FT_* environment variables onto the config (boot only). diff --git a/internal/engine/engine.go b/internal/engine/engine.go index f454b54..836b4c1 100644 --- a/internal/engine/engine.go +++ b/internal/engine/engine.go @@ -262,6 +262,7 @@ func New(store *config.Store) (*Engine, error) { } e.ApplyRateLimits(cfg.Net) e.startSeedEnforcer() // keepSeed ratio/time enforcement (SPEC §6.4) + e.startJanitor() // disk retention: auto-free space + cap (SPEC §6.1) return e, nil } @@ -756,8 +757,9 @@ func (e *Engine) Delete(hash string, withFiles bool) error { _ = e.store.DeleteTorrent(hash) if withFiles && found && rec.StorageMode == "disk" { - cfg := e.store.Get() - _ = os.RemoveAll(filepath.Join(cfg.Cache.Path, rec.Name)) + if path, ok := e.safeDataPath(rec.Name); ok { + _ = os.RemoveAll(path) + } } return nil } diff --git a/internal/engine/janitor.go b/internal/engine/janitor.go new file mode 100644 index 0000000..e3889d8 --- /dev/null +++ b/internal/engine/janitor.go @@ -0,0 +1,200 @@ +package engine + +// Disk retention (SPEC §6.1 disk mode). +// +// Goal: keep only what is in use or seeding toward a live target, and free +// everything else — while guaranteeing the disk-cache dir never exceeds +// Disk.MaxGB (the disk analogue of the RAM ring-buffer cap). +// +// Two phases keep it safe: +// - retire(): a torrent that is no longer needed. Private torrents are deleted +// immediately (their tracker ratio/time already served as the retention +// window); public torrents are dropped from the active set but kept on disk +// and marked PendingDeleteAt = now + grace, so a returning viewer resumes +// instantly from the retained files. +// - the janitor loop: deletes pending content once its grace window elapses, +// and, if the dir is over the cap, evicts the oldest inactive content first +// (the hard cap overrides the grace window). + +import ( + "log" + "os" + "path/filepath" + "sort" + "strings" + "time" + + "github.com/jodacame/fluxtorrent/internal/config" +) + +const janitorInterval = 30 * time.Second + +// startJanitor launches the periodic disk-retention loop. +func (e *Engine) startJanitor() { + go func() { + t := time.NewTicker(janitorInterval) + defer t.Stop() + for range t.C { + e.sweepPending() + e.enforceDiskCap() + } + }() +} + +// retire disposes of a torrent that is no longer needed (see file header). +func (e *Engine) retire(hash string, private bool) { + if private { + _ = e.Delete(hash, true) // immediate: private manages its own window + return + } + grace := time.Duration(e.store.Get().Disk.GraceMinutes) * time.Minute + _ = e.Drop(hash) // stop sharing/downloading, keep the files on disk + rec, ok := e.store.GetTorrent(hash) + if !ok { + return + } + rec.PendingDeleteAt = time.Now().Add(grace).Unix() + if rec.LastPlayedAt == 0 { + rec.LastPlayedAt = time.Now().Unix() + } + _ = e.store.SaveTorrent(rec) + log.Printf("retire: %s kept ~%dm before deletion", shortHash(hash), e.store.Get().Disk.GraceMinutes) +} + +// sweepPending deletes public records whose grace window has elapsed and that +// are not currently active (an active torrent means a viewer rescued it). +func (e *Engine) sweepPending() { + now := time.Now().Unix() + recs, _ := e.store.Torrents() + for _, r := range recs { + if r.PendingDeleteAt == 0 || r.PendingDeleteAt > now { + continue + } + if e.isActive(r.Hash) { + continue // rescued + } + if freed := e.deleteRecordFiles(r); freed >= 0 { + log.Printf("janitor: deleted %s (%s)", shortHash(r.Hash), r.Name) + } + } +} + +// enforceDiskCap evicts the oldest inactive pending content until the disk-cache +// dir is back under Disk.MaxGB. The hard cap overrides the grace window. +func (e *Engine) enforceDiskCap() { + cfg := e.store.Get() + if cfg.Disk.MaxGB <= 0 { + return + } + limit := int64(cfg.Disk.MaxGB) << 30 + used := dirSize(cfg.Cache.Path) + if used <= limit { + return + } + + recs, _ := e.store.Torrents() + cand := make([]config.TorrentRecord, 0, len(recs)) + for _, r := range recs { + if r.PendingDeleteAt == 0 || e.isActive(r.Hash) { + continue // only inactive, already-retired content is evictable + } + cand = append(cand, r) + } + // Oldest first: by last use, falling back to when it was added. + sort.Slice(cand, func(i, j int) bool { return evictKey(cand[i]) < evictKey(cand[j]) }) + + for _, r := range cand { + if used <= limit { + break + } + freed := e.deleteRecordFiles(r) + if freed > 0 { + used -= freed + } + log.Printf("disk cap: evicted %s (%s), freed %dMB", shortHash(r.Hash), r.Name, freed>>20) + } + if used > limit { + // Everything evictable is gone but active/seeding content still exceeds + // the cap — surface it rather than silently over-run. + log.Printf("disk cap: still over budget (%dMB > %dMB) — only active/seeding content remains", + used>>20, limit>>20) + } +} + +// deleteRecordFiles removes a record's on-disk files (guarded) and the record +// itself, returning the bytes freed. Only disk-mode records with a path that +// stays strictly inside the cache dir are touched. +func (e *Engine) deleteRecordFiles(r config.TorrentRecord) int64 { + defer func() { _ = e.store.DeleteTorrent(r.Hash) }() + if r.StorageMode != "disk" { + return 0 + } + path, ok := e.safeDataPath(r.Name) + if !ok { + log.Printf("janitor: refusing unsafe delete path for %s (name=%q)", shortHash(r.Hash), r.Name) + return 0 + } + size := dirSize(path) + if err := os.RemoveAll(path); err != nil { + log.Printf("janitor: remove %s: %v", path, err) + return 0 + } + return size +} + +// safeDataPath resolves a torrent's on-disk root and verifies it stays strictly +// inside the disk-cache dir — guarding against an empty name (which would target +// the whole dir) and path traversal via a crafted torrent name. +func (e *Engine) safeDataPath(name string) (string, bool) { + name = strings.TrimSpace(name) + if name == "" { + return "", false + } + root := filepath.Clean(e.store.Get().Cache.Path) + p := filepath.Clean(filepath.Join(root, name)) + if p == root || !strings.HasPrefix(p, root+string(os.PathSeparator)) { + return "", false + } + return p, true +} + +// isActive reports whether the hash is currently a managed (running) torrent. +func (e *Engine) isActive(hash string) bool { + e.mu.Lock() + _, ok := e.managed[hash] + e.mu.Unlock() + return ok +} + +// evictKey is the eviction ordering: least-recently-used first (fall back to +// add time for never-played content). +func evictKey(r config.TorrentRecord) int64 { + if r.LastPlayedAt > 0 { + return r.LastPlayedAt + } + return r.AddedAt +} + +// dirSize sums the byte size of every file under path (0 if it doesn't exist). +func dirSize(path string) int64 { + var total int64 + _ = filepath.WalkDir(path, func(_ string, d os.DirEntry, err error) error { + if err != nil { + return nil + } + if !d.IsDir() { + if info, ierr := d.Info(); ierr == nil { + total += info.Size() + } + } + return nil + }) + return total +} + +func shortHash(h string) string { + if len(h) >= 8 { + return h[:8] + } + return h +} diff --git a/internal/engine/janitor_test.go b/internal/engine/janitor_test.go new file mode 100644 index 0000000..93bf19f --- /dev/null +++ b/internal/engine/janitor_test.go @@ -0,0 +1,104 @@ +package engine + +import ( + "os" + "path/filepath" + "testing" + + "github.com/jodacame/fluxtorrent/internal/config" +) + +func testEngine(t *testing.T, cachePath string) *Engine { + t.Helper() + st, err := config.Open(filepath.Join(t.TempDir(), "test.db")) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = st.Close() }) + cfg := st.Get() + cfg.Cache.Path = cachePath + if err := st.Put(cfg); err != nil { + t.Fatal(err) + } + return &Engine{store: st, managed: map[string]*managed{}} +} + +// TestSafeDataPath locks the guards that make automatic deletion safe: an empty +// name (which would target the whole cache dir) and path traversal via a crafted +// torrent name must both be rejected. +func TestSafeDataPath(t *testing.T) { + root := t.TempDir() + e := testEngine(t, root) + + if p, ok := e.safeDataPath("My.Movie.2024"); !ok || p != filepath.Join(root, "My.Movie.2024") { + t.Fatalf("valid name rejected: %q ok=%v", p, ok) + } + if p, ok := e.safeDataPath("show/S01E01"); !ok || p != filepath.Join(root, "show", "S01E01") { + t.Fatalf("valid nested name rejected: %q ok=%v", p, ok) + } + for _, bad := range []string{"", " ", "..", "../etc", "../../x", "foo/../../bar"} { + if _, ok := e.safeDataPath(bad); ok { + t.Errorf("unsafe name %q must be rejected", bad) + } + } +} + +func TestDirSize(t *testing.T) { + d := t.TempDir() + if err := os.WriteFile(filepath.Join(d, "a"), make([]byte, 100), 0o644); err != nil { + t.Fatal(err) + } + if err := os.MkdirAll(filepath.Join(d, "sub"), 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(d, "sub", "b"), make([]byte, 50), 0o644); err != nil { + t.Fatal(err) + } + if got := dirSize(d); got != 150 { + t.Errorf("dirSize = %d, want 150", got) + } + if got := dirSize(filepath.Join(d, "missing")); got != 0 { + t.Errorf("missing dir should be 0, got %d", got) + } +} + +func TestEvictKey(t *testing.T) { + if got := evictKey(config.TorrentRecord{LastPlayedAt: 5, AddedAt: 1}); got != 5 { + t.Errorf("should prefer LastPlayedAt, got %d", got) + } + if got := evictKey(config.TorrentRecord{AddedAt: 7}); got != 7 { + t.Errorf("should fall back to AddedAt, got %d", got) + } +} + +// TestDeleteRecordFilesGuards ensures a non-disk record frees nothing and an +// unsafe name never calls RemoveAll, while both still drop the stale record. +func TestDeleteRecordFilesGuards(t *testing.T) { + root := t.TempDir() + e := testEngine(t, root) + + // A real disk file that should be removed and its size reported. + name := "clip" + if err := os.MkdirAll(filepath.Join(root, name), 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(root, name, "v.mkv"), make([]byte, 200), 0o644); err != nil { + t.Fatal(err) + } + freed := e.deleteRecordFiles(config.TorrentRecord{Hash: "h1", Name: name, StorageMode: "disk"}) + if freed != 200 { + t.Errorf("freed = %d, want 200", freed) + } + if _, err := os.Stat(filepath.Join(root, name)); !os.IsNotExist(err) { + t.Error("files should have been removed") + } + + // RAM-mode record: nothing on disk to free. + if freed := e.deleteRecordFiles(config.TorrentRecord{Hash: "h2", Name: "x", StorageMode: "ram"}); freed != 0 { + t.Errorf("ram record should free 0, got %d", freed) + } + // Unsafe name must not escape the cache dir. + if freed := e.deleteRecordFiles(config.TorrentRecord{Hash: "h3", Name: "../../etc", StorageMode: "disk"}); freed != 0 { + t.Errorf("unsafe name should free 0, got %d", freed) + } +} diff --git a/internal/engine/seeding.go b/internal/engine/seeding.go index f510730..3004fe5 100644 --- a/internal/engine/seeding.go +++ b/internal/engine/seeding.go @@ -41,8 +41,14 @@ func (e *Engine) reapIdle() { return } cutoff := time.Now().Add(-time.Duration(timeout) * time.Second) + deleteLeftovers := e.store.Get().Disk.DeleteAfterPlayback e.mu.Lock() - var drop []string + type idleT struct { + hash string + disk bool + private bool + } + var drop []idleT for h, m := range e.managed { m.mu.Lock() last := m.played @@ -50,15 +56,21 @@ func (e *Engine) reapIdle() { last = m.addedAt } idle := m.readers == 0 && !m.keepSeed && last.Before(cutoff) + it := idleT{hash: h, disk: m.mode == "disk", private: m.private} m.mu.Unlock() if idle { - drop = append(drop, h) + drop = append(drop, it) } } e.mu.Unlock() - for _, h := range drop { - log.Printf("disconnect-timeout: dropping idle torrent %s", h) - _ = e.Drop(h) + for _, it := range drop { + if it.disk && deleteLeftovers { + log.Printf("disconnect-timeout: retiring idle torrent %s", it.hash) + e.retire(it.hash, it.private) + } else { + log.Printf("disconnect-timeout: dropping idle torrent %s", it.hash) + _ = e.Drop(it.hash) + } } } @@ -112,11 +124,18 @@ func (e *Engine) enforceSeeding() { if sMinutes > 0 && complete && time.Since(seedStarted) >= time.Duration(sMinutes)*time.Minute { met = true } - // Don't cut off an active viewer; drop once the target is met and idle. + // Don't cut off an active viewer; act once the target is met and idle. if met && readers == 0 { - log.Printf("keepSeed target met for %s (ratio=%.2f) — dropping", m.hash, ratio) - e.clearKeepSeed(m.hash) - _ = e.Drop(m.hash) + if e.store.Get().Disk.DeleteAfterSeed { + // Free the space: private → deleted now (it managed its own + // window), public → kept for the grace window then removed. + log.Printf("keepSeed target met for %s (ratio=%.2f) — cleaning up", m.hash, ratio) + e.retire(m.hash, m.private) + } else { + log.Printf("keepSeed target met for %s (ratio=%.2f) — dropping", m.hash, ratio) + e.clearKeepSeed(m.hash) + _ = e.Drop(m.hash) + } } } } diff --git a/internal/engine/stream.go b/internal/engine/stream.go index 80629d8..29a3de0 100644 --- a/internal/engine/stream.go +++ b/internal/engine/stream.go @@ -158,8 +158,21 @@ func (e *Engine) releaseReader(m *managed) { return } cfg := e.store.Get() - // Drop-after-playback (SPEC §6.2) unless seeding/keepSeed retains it. - if cfg.Seed.DropAfterPlayback && !keep && !cfg.Seed.Enabled { + // keepSeed / global seeding retains it — the seed enforcer disposes of it + // once its target is met. + if keep || cfg.Seed.Enabled { + return + } + if m.mode == "disk" { + // Disk leftover: retire so the space is freed (public keeps a grace + // window for a returning viewer; private is deleted immediately). + if cfg.Disk.DeleteAfterPlayback { + e.retire(m.hash, m.private) + } + return + } + // RAM: drop-after-playback frees the in-memory buffer (SPEC §6.2). + if cfg.Seed.DropAfterPlayback { _ = e.Drop(m.hash) } } diff --git a/web/src/api.ts b/web/src/api.ts index ca14c1c..394fc3c 100644 --- a/web/src/api.ts +++ b/web/src/api.ts @@ -80,6 +80,12 @@ export interface Settings { }; limits: { maxActiveTorrents: number }; compressed: { reject: boolean }; + disk: { + maxGB: number; + graceMinutes: number; + deleteAfterSeed: boolean; + deleteAfterPlayback: boolean; + }; noPeersTimeoutSec: number; apiToken: string; } diff --git a/web/src/components/SettingsView.tsx b/web/src/components/SettingsView.tsx index 8cf4d42..d35cf8a 100644 --- a/web/src/components/SettingsView.tsx +++ b/web/src/components/SettingsView.tsx @@ -81,6 +81,17 @@ export function SettingsView() { + + setS({ ...s, disk: { ...s.disk, maxGB: v } })} /> + setS({ ...s, disk: { ...s.disk, graceMinutes: v } })} /> + setS({ ...s, disk: { ...s.disk, deleteAfterSeed: v } })} /> + setS({ ...s, disk: { ...s.disk, deleteAfterPlayback: v } })} /> + +
diff --git a/web/src/i18n/locales/en.ts b/web/src/i18n/locales/en.ts index 1ec0cb9..98412d7 100644 --- a/web/src/i18n/locales/en.ts +++ b/web/src/i18n/locales/en.ts @@ -178,6 +178,15 @@ export const en: Dict = { "settings.maxActiveHelp": "The oldest idle one is released past this limit.", "settings.rejectCompressed": "Reject compressed", "settings.rejectCompressedHelp": "Discards RAR/ZIP releases that can't be played.", + "settings.cleanup": "Disk cleanup", + "settings.diskMaxGB": "Disk limit (GB)", + "settings.diskMaxGBHelp": "Hard cap for the download folder. When exceeded, the oldest unused content is deleted first. 0 = no limit.", + "settings.graceMinutes": "Safety window (minutes)", + "settings.graceMinutesHelp": "After content is no longer needed, it's kept this long before deletion, so if you play it again it resumes without re-downloading. Private torrents are deleted at once.", + "settings.deleteAfterSeed": "Delete after sharing", + "settings.deleteAfterSeedHelp": "Free the files once a torrent meets its share ratio/time target.", + "settings.deleteAfterPlayback": "Delete after watching", + "settings.deleteAfterPlaybackHelp": "In disk mode, remove leftover files after you finish watching or a torrent goes idle.", "settings.save": "Save changes", "settings.saving": "Saving…", "settings.language": "Language", diff --git a/web/src/i18n/locales/es.ts b/web/src/i18n/locales/es.ts index c964ec2..6476df7 100644 --- a/web/src/i18n/locales/es.ts +++ b/web/src/i18n/locales/es.ts @@ -179,6 +179,15 @@ export const es: Dict = { "settings.maxActiveHelp": "El más antiguo inactivo se libera al superar este límite.", "settings.rejectCompressed": "Rechazar comprimidos", "settings.rejectCompressedHelp": "Descarta releases RAR/ZIP que no se pueden reproducir.", + "settings.cleanup": "Limpieza de disco", + "settings.diskMaxGB": "Límite de disco (GB)", + "settings.diskMaxGBHelp": "Tope de la carpeta de descargas. Al superarlo, se borra primero lo más viejo sin usar. 0 = sin límite.", + "settings.graceMinutes": "Ventana de seguridad (minutos)", + "settings.graceMinutesHelp": "Cuando algo deja de usarse, se conserva este tiempo antes de borrarlo; si lo vuelves a reproducir, se reanuda sin descargar de nuevo. Los torrents privados se borran al instante.", + "settings.deleteAfterSeed": "Borrar tras compartir", + "settings.deleteAfterSeedHelp": "Libera los archivos cuando un torrent cumple su objetivo de ratio/tiempo.", + "settings.deleteAfterPlayback": "Borrar tras ver", + "settings.deleteAfterPlaybackHelp": "En modo disco, elimina los archivos sobrantes al terminar de ver o cuando el torrent queda inactivo.", "settings.save": "Guardar cambios", "settings.saving": "Guardando…", "settings.language": "Idioma",