fix(torrent): expand tracker list, add DHT persistence and configurable timeouts

- Expand default trackers from 5 to 31 (synced with web tracker-list.ts)
- Add DHT node persistence between sessions (~/.local/share/unarr/dht-nodes.txt)
  Saves known nodes on shutdown, restores on startup for warm DHT bootstrap
- Make metadata_timeout and stall_timeout configurable in config.toml
  Default: 0 (unlimited, like qBittorrent) — users can set custom values
- Fix CleanTitle to handle web domains and format patterns (e.g. pctfenix.com)
This commit is contained in:
Deivid Soto 2026-03-29 19:09:51 +02:00
parent 20d4d34dfc
commit 386c97f84a
7 changed files with 265 additions and 39 deletions

View file

@ -108,11 +108,17 @@ func CleanTitle(filename string) string {
// Remove brackets
name = regexp.MustCompile(`[\[\(].*?[\]\)]`).ReplaceAllString(name, "")
// Remove web domains BEFORE replacing separators (dots are still dots here)
name = regexp.MustCompile(`(?i)[a-z0-9]+\.(com|org|net|mx|io|to|cc|se)`).ReplaceAllString(name, "")
// Replace common separators with spaces
name = strings.NewReplacer(".", " ", "_", " ", "-", " ").Replace(name)
// Remove quality/codec/release artifacts
name = regexp.MustCompile(`(?i)\b(2160p|1080p|720p|480p|4K|UHD|BluRay|BDRip|WEBRip|WEB-DL|HDTV|DVDRip|BRRip|x264|x265|HEVC|AVC|AV1|AAC|DTS|AC3|Atmos|FLAC|10bit|HDR10?\+?|DV|DoVi|PROPER|REPACK|REMUX|EXTENDED|DUAL|MULTi)\b`).ReplaceAllString(name, "")
name = regexp.MustCompile(`(?i)\b(2160p|1080p|720p|480p|4K|UHD|BluRay|BDRip|WEBRip|WEB-DL|HDTV|DVDRip|BRRip|x264|x265|HEVC|AVC|AV1|AAC|DTS|AC3|Atmos|FLAC|10bit|HDR10?\+?|DV|DoVi|PROPER|REPACK|REMUX|EXTENDED|DUAL|MULTi|UHDremux|4Kremux\d*)\b`).ReplaceAllString(name, "")
// Remove standalone numbers that look like resolution/format (e.g. "2160", "1080")
name = regexp.MustCompile(`\b(2160|1080|720|480)\b`).ReplaceAllString(name, "")
// Remove year
name = regexp.MustCompile(`\b(19|20)\d{2}\b`).ReplaceAllString(name, "")

View file

@ -143,6 +143,7 @@ func TestCleanTitle(t *testing.T) {
{"Breaking.Bad.S01E05.720p.HDTV.mkv", "Breaking Bad S01E05"},
{"The.Matrix.1999.2160p.UHD.BluRay.REMUX.mkv", "The Matrix"},
{"Movie [YTS.MX].mp4", "Movie"},
{"Greenland 4Kremux2160.pctfenix.com.mkv", "Greenland"},
}
for _, tt := range tests {