subsyt/main.go
Viktor Varland 97a299fe0b
All checks were successful
build / build (push) Successful in 1m53s
feat: support CONFIG env variable for file
2025-03-29 09:48:23 +01:00

44 lines
776 B
Go

package main
import (
"log"
"os"
"git.meatbag.se/varl/subsyt/internal/config"
"git.meatbag.se/varl/subsyt/internal/dl"
"git.meatbag.se/varl/subsyt/internal/opml"
)
func main() {
configPath := os.Getenv("CONFIG")
if configPath == "" {
configPath = "./config.toml"
}
cfg, err := config.Load(configPath)
if err != nil {
panic(err)
}
provider := cfg.Provider["youtube"]
opml, err := opml.Load(provider.Opml_file)
if err != nil {
panic(err)
}
for _, outlines := range opml.Body.Outline {
log.Printf("Archiving videos from OPML: %s", outlines.Title)
for _, outline := range outlines.Outlines {
dl.Get(dl.Download{
Url: outline.XmlUrl,
Name: outline.Title,
OutDir: cfg.Out_dir,
DryRun: cfg.Dry_run,
}, provider)
}
}
}