downloader/main.go
2023-01-16 00:26:11 +01:00

40 lines
756 B
Go

package main
import (
"os/exec"
"time"
"git.milar.in/nyaanime/logic"
)
func main() {
// check for ffmpeg in PATH
if _, err := exec.LookPath("ffmpeg"); err != nil {
panic(err) // TODO error handling
}
// 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()
}
}