downloader/main.go
2023-01-15 20:59:54 +01:00

35 lines
635 B
Go

package main
import (
"os/exec"
"time"
"git.milar.in/nyaanime/logic"
)
func main() {
// check for ffprobe in PATH
if _, err := exec.LookPath("ffprobe"); err != nil {
panic(err) // TODO error handling
}
// get access token once at startup to be sure that an access token is obtainable at all
if _, err := logic.GetAnilistAccessToken(); err != nil {
panic(err) // TODO error handling
}
if err := InitTelegramBot(); err != nil {
panic(err) // TODO error handling
}
logic.PrintPriorityTables()
ticker := time.NewTicker(PollRate)
defer ticker.Stop()
CheckTorrents()
for range ticker.C {
CheckTorrents()
}
}