2 Commits

Author SHA1 Message Date
b65edb4cce yes 2026-06-15 17:18:47 +02:00
db26a40415 fix qobuz interpreter artist urls 2026-06-10 12:34:37 +02:00
6 changed files with 54 additions and 0 deletions

View File

@@ -1352,6 +1352,7 @@ func buildTagMetadata(trackMeta map[string]any, title, source, trackID string, o
Album: album, Album: album,
Artist: artist, Artist: artist,
AlbumArtist: albumArtist, AlbumArtist: albumArtist,
OmitDiscTags: opts.forPlaylist,
TrackNumber: trackNumber, TrackNumber: trackNumber,
DiscNumber: discNumber, DiscNumber: discNumber,
TrackTotal: trackTotal, TrackTotal: trackTotal,

View File

@@ -525,6 +525,9 @@ func TestBuildTagMetadataPlaylistOmitsDiscTags(t *testing.T) {
if tags.DiscTotal != 0 { if tags.DiscTotal != 0 {
t.Fatalf("disc total = %d, want 0", tags.DiscTotal) t.Fatalf("disc total = %d, want 0", tags.DiscTotal)
} }
if !tags.OmitDiscTags {
t.Fatalf("omit disc tags = %v, want true", tags.OmitDiscTags)
}
} }
func TestTrackOutputPathFallsBackToDisc1(t *testing.T) { func TestTrackOutputPathFallsBackToDisc1(t *testing.T) {

View File

@@ -14,6 +14,7 @@ type Metadata struct {
Album string Album string
Artist string Artist string
AlbumArtist string AlbumArtist string
OmitDiscTags bool
TrackNumber int TrackNumber int
DiscNumber int DiscNumber int
TrackTotal int TrackTotal int
@@ -101,6 +102,14 @@ func buildFFmpegArgs(inputPath, outputPath string, meta Metadata, coverPath, ext
} }
args = append(args, "-metadata", k+"="+v) args = append(args, "-metadata", k+"="+v)
} }
if meta.OmitDiscTags {
args = append(args,
"-metadata", "disc=",
"-metadata", "disk=",
"-metadata", "disctotal=",
"-metadata", "totaldiscs=",
)
}
args = append(args, outputPath) args = append(args, outputPath)
return args return args

View File

@@ -96,6 +96,28 @@ func TestBuildFFmpegArgsSkipsCoverForUnsupportedContainer(t *testing.T) {
} }
} }
func TestBuildFFmpegArgsClearsDiscTagsWhenRequested(t *testing.T) {
args := buildFFmpegArgs("in.flac", "out.flac", Metadata{Title: "x", OmitDiscTags: true}, "", "flac")
want := map[string]bool{
"disc=": false,
"disk=": false,
"disctotal=": false,
"totaldiscs=": false,
}
for i := 0; i < len(args)-1; i++ {
if args[i] == "-metadata" {
if _, ok := want[args[i+1]]; ok {
want[args[i+1]] = true
}
}
}
for tag, found := range want {
if !found {
t.Fatalf("missing clear tag %q in args: %v", tag, args)
}
}
}
func TestTaggedTempPathPreservesExtension(t *testing.T) { func TestTaggedTempPathPreservesExtension(t *testing.T) {
if got := taggedTempPath("/tmp/song.flac"); got != "/tmp/song.tmp.flac" { if got := taggedTempPath("/tmp/song.flac"); got != "/tmp/song.tmp.flac" {
t.Fatalf("taggedTempPath(flac)=%q", got) t.Fatalf("taggedTempPath(flac)=%q", got)

View File

@@ -69,6 +69,9 @@ func parseQobuz(raw string, parts []string) *ParsedURL {
} }
mediaType := parts[0] mediaType := parts[0]
if mediaType == "interpreter" {
mediaType = "artist"
}
if !isSupportedMedia(mediaType) { if !isSupportedMedia(mediaType) {
return nil return nil
} }

View File

@@ -27,6 +27,22 @@ func TestQobuzAlbumURL(t *testing.T) {
} }
} }
func TestQobuzInterpreterURLParsesAsArtist(t *testing.T) {
inputs := []string{
"https://www.qobuz.com/us-en/interpreter/odezenne/739874",
"https://play.qobuz.com/artist/739874",
}
for _, input := range inputs {
result := Parse(input)
if result == nil {
t.Fatalf("expected parsed url for %q", input)
}
if result.Source != "qobuz" || result.MediaType != "artist" || result.ID != "739874" {
t.Fatalf("unexpected parse result for %q: %+v", input, result)
}
}
}
func TestTidalTrackURL(t *testing.T) { func TestTidalTrackURL(t *testing.T) {
inputs := []string{ inputs := []string{
"https://tidal.com/browse/track/3083287", "https://tidal.com/browse/track/3083287",