refactor: major project restructure

This commit is contained in:
Mathis Maquenne
2025-05-01 20:30:56 +02:00
parent c74531b36c
commit 0bae78a1ff
27 changed files with 1017 additions and 812 deletions
+33
View File
@@ -0,0 +1,33 @@
package downloader
import (
"fmt"
)
var validQualities = map[string]bool{
"mp3_128": true,
"mp3_320": true,
"flac": true,
"best": true,
}
type Options struct {
OutputDir string
Quality string
}
func (o *Options) Validate(appDir string) error {
if o.OutputDir == "" {
o.OutputDir = appDir
}
if o.Quality == "" {
o.Quality = "best"
}
if !validQualities[o.Quality] {
return fmt.Errorf("invalid quality option: %s", o.Quality)
}
return nil
}