Configurable interval

master v0.8
Bel LaPointe 2021-01-25 08:53:15 -06:00
parent 70f0231371
commit 0016e5afa9
2 changed files with 9 additions and 6 deletions

View File

@ -4,14 +4,16 @@ import (
"local/args"
"local/sandbox/contact/contact"
"os"
"time"
)
var (
Feed string
Root string
To string
Subject string
Emailer *contact.Emailer
Feed string
Root string
To string
Subject string
Emailer *contact.Emailer
Interval time.Duration
)
func init() {
@ -28,6 +30,7 @@ func init() {
as.Append(args.STRING, "feed", "feed URL", "https://www.youtube.com/feeds/videos.xml?channel_id=UCwX0AEx-qIhQ9kgtlNhyIXw")
as.Append(args.STRING, "root", "root to save videos", "/tmp")
as.Append(args.DURATION, "interval", "check interval", time.Hour)
if err := as.Parse(); err != nil {
panic(err)

View File

@ -18,7 +18,7 @@ func main() {
if err != nil {
panic(err)
}
interval := time.Minute * 30
interval := config.Interval
for true {
err := do(client)
if err != nil {