add CLI parity flags and expand provider support

This brings the Go CLI closer to upstream behavior with global flag handling and clearer resolve failures, while adding Tidal video downloads plus initial Deezer and SoundCloud no-account flows for broader end-to-end coverage.
This commit is contained in:
2026-04-20 00:56:10 +02:00
parent 4da5114a70
commit b2688ce949
15 changed files with 1746 additions and 57 deletions

View File

@@ -115,3 +115,54 @@ func TestExtractLastFMPlaylistInfoAndPairs(t *testing.T) {
t.Fatalf("unexpected first pair: %+v", pairs[0])
}
}
func TestParseGlobalArgsNoDBBeforeCommand(t *testing.T) {
opts, err := parseGlobalArgs([]string{"-ndb", "url", "https://play.qobuz.com/album/0004228000522"})
if err != nil {
t.Fatalf("parseGlobalArgs() error = %v", err)
}
if !opts.noDB {
t.Fatalf("expected noDB true")
}
if opts.command != "url" {
t.Fatalf("command = %q, want %q", opts.command, "url")
}
if len(opts.commandArgs) != 1 {
t.Fatalf("command args len = %d, want 1", len(opts.commandArgs))
}
}
func TestParseGlobalArgsAllOfficialFlags(t *testing.T) {
opts, err := parseGlobalArgs([]string{
"--config-path", "/tmp/custom.toml",
"-f", "/tmp/music",
"--no-db",
"-q", "3",
"-c", "ogg",
"--no-progress",
"--no-ssl-verify",
"-v",
"search", "tidal", "track", "dreams",
})
if err != nil {
t.Fatalf("parseGlobalArgs() error = %v", err)
}
if opts.configPath != "/tmp/custom.toml" || opts.folder != "/tmp/music" {
t.Fatalf("unexpected path/folder opts: %+v", opts)
}
if !opts.noDB || !opts.qualitySet || opts.quality != 3 || !opts.codecSet || opts.codec != "VORBIS" {
t.Fatalf("unexpected quality/codec/db opts: %+v", opts)
}
if !opts.noProgress || !opts.noSSLVerify || !opts.verbose {
t.Fatalf("unexpected boolean opts: %+v", opts)
}
if opts.command != "search" {
t.Fatalf("command = %q, want search", opts.command)
}
}
func TestNormalizeCodecRejectsUnknown(t *testing.T) {
if _, err := normalizeCodec("wav"); err == nil {
t.Fatalf("expected error for unsupported codec")
}
}