feat(cli): add --strict flag to fail track download if quality is unavailable

This commit is contained in:
Mathis Maquenne
2025-08-09 19:17:29 +02:00
parent 7154c15cc3
commit 283c5d76e9
3 changed files with 15 additions and 4 deletions
+3
View File
@@ -179,6 +179,9 @@ func (c *Client) downloadSong(ctx context.Context, resource deezer.Resource, son
if err != nil {
return nil, fmt.Errorf("failed to get media format: %w", err)
}
if opts.Strict && strings.ToLower(mediaFormat) != opts.Quality {
return nil, fmt.Errorf("requested quality '%s' not available", opts.Quality)
}
if path, skip := c.shouldSkipDownload(ctx, song.ID, mediaFormat); skip {
return nil, SkipError{Path: path}