diff --git a/cmd/download.go b/cmd/download.go index 0a9185a..08985cd 100644 --- a/cmd/download.go +++ b/cmd/download.go @@ -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") diff --git a/cmd/watch_add.go b/cmd/watch_add.go index 23d4f7d..6540aa2 100644 --- a/cmd/watch_add.go +++ b/cmd/watch_add.go @@ -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") } diff --git a/internal/deezer/client.go b/internal/deezer/client.go index f789c9c..b6d53a2 100644 --- a/internal/deezer/client.go +++ b/internal/deezer/client.go @@ -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"}]` } diff --git a/internal/downloader/client.go b/internal/downloader/client.go index e7f6ba7..800a376 100644 --- a/internal/downloader/client.go +++ b/internal/downloader/client.go @@ -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 diff --git a/internal/downloader/options.go b/internal/downloader/options.go index 76ff839..8bbf11c 100644 --- a/internal/downloader/options.go +++ b/internal/downloader/options.go @@ -9,7 +9,6 @@ var validQualities = map[string]bool{ "mp3_128": true, "mp3_320": true, "flac": true, - "best": true, } type Options struct {