This commit is contained in:
Javis Sullivan
2025-12-07 20:11:10 -05:00
parent 81e1e23066
commit 0e0fe0e37c
9 changed files with 147 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
package config
import (
"os"
"gopkg.in/yaml.v3"
)
type StructureConfig struct {
MoviesDir string `yaml:"movies_dir"`
TVDir string `yaml:"tv_dir"`
MiscDir string `yaml:"misc_dir"`
UnknownDir string `yaml:"unknown_dir"`
AutoCreate bool `yaml:"auto_create"`
}
type WatchConfig struct {
Dirs []string `yaml:"dirs"`
}
type Config struct {
Watch WatchConfig `yaml:"watch"`
Structure StructureConfig `yaml:"structure"`
}
func LoadConfig(path string) (*Config, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, err
}
var cfg Config
if err := yaml.Unmarshal(data, &cfg); err != nil {
return nil, err
}
return &cfg, nil
}