feat: write an m3u playlist to preserve playlist track order

Playlist file names carry no ordering information, so the sequence a
user curated on Deezer was lost once the tracks landed on disk (unlike
albums, which get a zero padded track number prefix). downloadTrack
now reports the output path on success as well as on skip, and
downloadAllTracks collects the per-track paths for playlist downloads
and writes them, in order, to an extended m3u file next to the audio.
Failed tracks are left out since there is nothing on disk to point at;
a write failure is reported as a warning rather than failing the run.
This commit is contained in:
2026-08-14 21:00:08 +02:00
parent 765595133f
commit b1c15341fd
3 changed files with 76 additions and 1 deletions
+1 -1
View File
@@ -107,7 +107,7 @@ func (d *Downloader) downloadTrack(ctx context.Context, resource deezer.Resource
warnings = append(warnings, metadata.warnings...)
warnings = append(warnings, d.finalizeDownload(resource, track, outputPath, outputFormat, metadata.genre, cover, metadata.bpmKey)...)
return downloadResult{warnings: warnings}
return downloadResult{path: outputPath, warnings: warnings}
}
// uniqueOutputPath avoids clobbering an unrelated file by appending " (2)",