feat: add migrate command, media server detection, and debrid auto-config
- Migration wizard from Sonarr/Radarr/Prowlarr (unarr migrate) [pre-beta] - Auto-detect instances via Docker, config files, port scan, Prowlarr - Import wanted list (monitored+missing movies/series) - Import download history and blocklist to avoid re-downloading - Extract debrid tokens from *arr download clients - Quality profile mapping to preferred_quality config - DISTINCT ON PostgreSQL query for optimal torrent selection - JSON export with --dry-run --json (text to stderr, JSON to stdout) - Media server detection (Plex/Jellyfin/Emby) in unarr init - Detects library paths and offers them as download directory options - Debrid auto-configuration in unarr init - Scans *arr instances for debrid tokens - Validates and saves via API if user confirms - New preferred_quality setting in config (2160p/1080p/720p) - Library scan command (unarr scan) with ffprobe metadata extraction
This commit is contained in:
parent
0b6c6849b1
commit
677a8fe083
34 changed files with 4766 additions and 22 deletions
64
internal/library/mediainfo/lang_test.go
Normal file
64
internal/library/mediainfo/lang_test.go
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
package mediainfo
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNormalizeLang(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
want string
|
||||
}{
|
||||
{"", "und"},
|
||||
{"eng", "en"},
|
||||
{"spa", "es"},
|
||||
{"fre", "fr"},
|
||||
{"fra", "fr"},
|
||||
{"ger", "de"},
|
||||
{"deu", "de"},
|
||||
{"en", "en"},
|
||||
{"es", "es"},
|
||||
{"English", "en"},
|
||||
{"SPANISH", "es"},
|
||||
{"Japanese", "ja"},
|
||||
{"jpn", "ja"},
|
||||
{"chi", "zh"},
|
||||
{"zho", "zh"},
|
||||
{"und", "und"},
|
||||
{"xyz", "xyz"}, // unknown → lowercase passthrough
|
||||
{"POR", "pt"},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.input, func(t *testing.T) {
|
||||
got := NormalizeLang(tt.input)
|
||||
if got != tt.want {
|
||||
t.Errorf("NormalizeLang(%q) = %q, want %q", tt.input, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestComputeLanguages(t *testing.T) {
|
||||
tracks := []AudioTrack{
|
||||
{Lang: "en", Codec: "aac", Channels: 2},
|
||||
{Lang: "es", Codec: "ac3", Channels: 6},
|
||||
{Lang: "en", Codec: "dts", Channels: 6}, // duplicate
|
||||
{Lang: "und", Codec: "aac", Channels: 2},
|
||||
{Lang: "", Codec: "aac", Channels: 2},
|
||||
}
|
||||
|
||||
langs := ComputeLanguages(tracks)
|
||||
|
||||
if len(langs) != 2 {
|
||||
t.Fatalf("expected 2 languages, got %d: %v", len(langs), langs)
|
||||
}
|
||||
if langs[0] != "en" || langs[1] != "es" {
|
||||
t.Errorf("expected [en es], got %v", langs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestComputeLanguagesEmpty(t *testing.T) {
|
||||
langs := ComputeLanguages(nil)
|
||||
if len(langs) != 0 {
|
||||
t.Errorf("expected empty, got %v", langs)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue