subsyt/internal/config/config.go
Viktor Varland dda892750d
All checks were successful
build / build (push) Successful in 2m2s
feat: generate metadata for shows and episodes
2025-04-04 13:24:06 +02:00

47 lines
757 B
Go

package config
import (
"log"
"os"
toml "github.com/pelletier/go-toml/v2"
)
type Provider struct {
Url string
Throttle int
Range string
After_date string
Cmd string
Cookies bool
Cookies_file string
Opml_file string
Quality string
Output_path_template string
}
type Config struct {
Out_dir string
Provider map[string]Provider
Dry_run bool
}
func Load(filepath string) (Config, error) {
data, err := os.ReadFile(filepath)
if err != nil {
panic(err)
}
cfg := Config{}
err = toml.Unmarshal(data, &cfg)
if err != nil {
panic(err)
}
log.Println("Loaded config:")
log.Printf("%+v\n", cfg)
return cfg, err
}