refactor(cli): remove --quality=best flag since fallback is now automatic

This commit is contained in:
Mathis Maquenne
2025-08-06 22:28:58 +02:00
parent 50fde9dfa9
commit 7154c15cc3
5 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ func init() {
RootCmd.AddCommand(downloadCmd)
downloadCmd.PersistentFlags().StringVar(&cfgPath, "config", "", "config file (default ~/.godeez/config.toml)")
downloadCmd.PersistentFlags().StringVarP(&opts.Quality, "quality", "q", "best", "download quality [mp3_128, mp3_320, flac, best]")
downloadCmd.PersistentFlags().StringVarP(&opts.Quality, "quality", "q", "flac", "download quality [mp3_128, mp3_320, flac]")
downloadCmd.PersistentFlags().DurationVarP(&opts.Timeout, "timeout", "t", 2*time.Minute, "timeout for each download (e.g. 10s, 1m, 2m30s)")
downloadCmd.PersistentFlags().BoolVar(&opts.BPM, "bpm", false, "fetch BPM/key and add to file tags")
+3 -2
View File
@@ -2,6 +2,7 @@ package cmd
import (
"fmt"
"strings"
"time"
"github.com/mathismqn/godeez/internal/store"
@@ -25,7 +26,7 @@ var watchAddCmd = &cobra.Command{
playlist := &store.WatchedPlaylist{
ID: id,
Quality: opts.Quality,
Quality: strings.ToLower(opts.Quality),
BPM: opts.BPM,
Timeout: opts.Timeout,
}
@@ -42,7 +43,7 @@ var watchAddCmd = &cobra.Command{
func init() {
watchCmd.AddCommand(watchAddCmd)
watchAddCmd.Flags().StringVarP(&opts.Quality, "quality", "q", "best", "download quality [mp3_128, mp3_320, flac, best]")
watchAddCmd.Flags().StringVarP(&opts.Quality, "quality", "q", "flac", "download quality [mp3_128, mp3_320, flac]")
watchAddCmd.Flags().DurationVarP(&opts.Timeout, "timeout", "t", 2*time.Minute, "timeout for each download (e.g. 10s, 1m, 2m30s)")
watchAddCmd.Flags().BoolVar(&opts.BPM, "bpm", false, "fetch BPM/key and add to file tags")
}
+1 -1
View File
@@ -99,7 +99,7 @@ func (c *Client) FetchMedia(ctx context.Context, song *Song, quality string) (*M
formats = `[{"cipher":"BF_CBC_STRIPE","format":"MP3_128"}]`
case "mp3_320":
formats = `[{"cipher":"BF_CBC_STRIPE","format":"MP3_320"},{"cipher":"BF_CBC_STRIPE","format":"MP3_128"}]`
case "flac", "best":
case "flac":
formats = `[{"cipher":"BF_CBC_STRIPE","format":"FLAC"},{"cipher":"BF_CBC_STRIPE","format":"MP3_320"},{"cipher":"BF_CBC_STRIPE","format":"MP3_128"}]`
}
+1 -1
View File
@@ -52,7 +52,7 @@ func (c *Client) Run(ctx context.Context, opts Options, id string) error {
}
if !c.deezerClient.Session.Premium && (opts.Quality == "mp3_320" || opts.Quality == "flac") {
return fmt.Errorf("premium account required for %s quality", opts.Quality)
return fmt.Errorf("premium account required for '%s' quality", opts.Quality)
}
var resource deezer.Resource
-1
View File
@@ -9,7 +9,6 @@ var validQualities = map[string]bool{
"mp3_128": true,
"mp3_320": true,
"flac": true,
"best": true,
}
type Options struct {