44 lines
776 B
Go
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)
|
|
}
|
|
}
|
|
}
|