Add artist recommendation CLI with Qobuz downloads
This commit is contained in:
4 files changed
+270
No files matched your search
@@ -102,6 +102,21 @@ func Load(envPath string, getenv func(string) string) (*Config, error) {
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
// LoadLastFMOnly is for standalone commands that only need the Last.fm key.
|
||||
func LoadLastFMOnly(envPath string) (string, string, error) {
|
||||
path := findEnv(envPath)
|
||||
if path != "" {
|
||||
if err := loadDotEnv(path); err != nil {
|
||||
return "", path, err
|
||||
}
|
||||
}
|
||||
key := strings.TrimSpace(os.Getenv("LASTFM_API_KEY"))
|
||||
if key == "" {
|
||||
return "", path, fmt.Errorf("missing LASTFM_API_KEY (looked at %s)", path)
|
||||
}
|
||||
return key, path, nil
|
||||
}
|
||||
|
||||
func (c *Config) Validate() error {
|
||||
var missing []string
|
||||
if c.NavidromeURL == "" {
|
||||
@@ -173,6 +188,10 @@ func loadDotEnv(path string) error {
|
||||
return scanner.Err()
|
||||
}
|
||||
|
||||
func DefaultRipBinary() string {
|
||||
return defaultRipBinary()
|
||||
}
|
||||
|
||||
func defaultRipBinary() string {
|
||||
// Prefer a bundled Go `rip` next to this binary, then the local clone.
|
||||
// A Python streamrip `rip` may also be on PATH and has a different
|
||||
|
||||
Reference in new issue
Block a user