DRMDTool/config.go

43 lines
685 B
Go
Raw Permalink Normal View History

package main
import (
"fmt"
"io"
"os"
"github.com/BurntSushi/toml"
)
type Config struct {
2024-09-13 22:43:22 +02:00
BaseDir string
Format string
TempBaseDir string
N_m3u8DLRE struct {
Path string
}
}
var config Config
func loadConfig() {
configFile, err := os.Open("config.toml")
if err != nil {
fmt.Println("Error opening config file:", err)
return
}
defer configFile.Close()
byteValue, _ := io.ReadAll(configFile)
if _, err := toml.Decode(string(byteValue), &config); err != nil {
fmt.Println("Error decoding config file:", err)
return
}
if config.N_m3u8DLRE.Path == "" {
fmt.Println("Error: N_m3u8DL-RE path is not specified in the config file")
return
}
}