refactor(cli): remove --quality=best flag since fallback is now automatic
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@ func init() {
|
|||||||
RootCmd.AddCommand(downloadCmd)
|
RootCmd.AddCommand(downloadCmd)
|
||||||
|
|
||||||
downloadCmd.PersistentFlags().StringVar(&cfgPath, "config", "", "config file (default ~/.godeez/config.toml)")
|
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().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")
|
downloadCmd.PersistentFlags().BoolVar(&opts.BPM, "bpm", false, "fetch BPM/key and add to file tags")
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -2,6 +2,7 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mathismqn/godeez/internal/store"
|
"github.com/mathismqn/godeez/internal/store"
|
||||||
@@ -25,7 +26,7 @@ var watchAddCmd = &cobra.Command{
|
|||||||
|
|
||||||
playlist := &store.WatchedPlaylist{
|
playlist := &store.WatchedPlaylist{
|
||||||
ID: id,
|
ID: id,
|
||||||
Quality: opts.Quality,
|
Quality: strings.ToLower(opts.Quality),
|
||||||
BPM: opts.BPM,
|
BPM: opts.BPM,
|
||||||
Timeout: opts.Timeout,
|
Timeout: opts.Timeout,
|
||||||
}
|
}
|
||||||
@@ -42,7 +43,7 @@ var watchAddCmd = &cobra.Command{
|
|||||||
func init() {
|
func init() {
|
||||||
watchCmd.AddCommand(watchAddCmd)
|
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().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")
|
watchAddCmd.Flags().BoolVar(&opts.BPM, "bpm", false, "fetch BPM/key and add to file tags")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ func (c *Client) FetchMedia(ctx context.Context, song *Song, quality string) (*M
|
|||||||
formats = `[{"cipher":"BF_CBC_STRIPE","format":"MP3_128"}]`
|
formats = `[{"cipher":"BF_CBC_STRIPE","format":"MP3_128"}]`
|
||||||
case "mp3_320":
|
case "mp3_320":
|
||||||
formats = `[{"cipher":"BF_CBC_STRIPE","format":"MP3_320"},{"cipher":"BF_CBC_STRIPE","format":"MP3_128"}]`
|
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"}]`
|
formats = `[{"cipher":"BF_CBC_STRIPE","format":"FLAC"},{"cipher":"BF_CBC_STRIPE","format":"MP3_320"},{"cipher":"BF_CBC_STRIPE","format":"MP3_128"}]`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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") {
|
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
|
var resource deezer.Resource
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ var validQualities = map[string]bool{
|
|||||||
"mp3_128": true,
|
"mp3_128": true,
|
||||||
"mp3_320": true,
|
"mp3_320": true,
|
||||||
"flac": true,
|
"flac": true,
|
||||||
"best": true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user