downloader/main.go

40 lines
756 B
Go
Raw Normal View History

2022-08-15 15:55:27 +02:00
package main
import (
2023-01-14 11:10:57 +01:00
"os/exec"
2022-08-15 15:55:27 +02:00
"time"
"git.milar.in/nyaanime/logic"
2022-08-15 15:55:27 +02:00
)
func main() {
2023-01-16 00:26:11 +01:00
// check for ffmpeg in PATH
if _, err := exec.LookPath("ffmpeg"); err != nil {
panic(err) // TODO error handling
}
2023-01-14 11:10:57 +01:00
// check for ffprobe in PATH
if _, err := exec.LookPath("ffprobe"); err != nil {
panic(err) // TODO error handling
}
2022-08-21 21:14:44 +02:00
2022-08-15 15:55:27 +02:00
// get access token once at startup to be sure that an access token is obtainable at all
if _, err := logic.GetAnilistAccessToken(); err != nil {
2023-01-15 20:59:54 +01:00
panic(err) // TODO error handling
}
if err := InitTelegramBot(); err != nil {
panic(err) // TODO error handling
2022-08-15 15:55:27 +02:00
}
2023-01-15 20:59:54 +01:00
logic.PrintPriorityTables()
2023-01-14 11:10:57 +01:00
2022-08-15 15:55:27 +02:00
ticker := time.NewTicker(PollRate)
defer ticker.Stop()
CheckTorrents()
2022-08-15 15:55:27 +02:00
for range ticker.C {
CheckTorrents()
2022-08-15 15:55:27 +02:00
}
}