downloader/main.go
2022-08-25 09:05:19 +02:00

36 lines
770 B
Go

package main
import (
"fmt"
"time"
"git.milar.in/milarin/anilist"
)
func main() {
fmt.Println("language priorites:", Map2Str(PreferredLanguages))
fmt.Println("subtitle priorites:", Map2Str(PreferredSubtitles))
fmt.Println("resolution priorites:", Map2Str(PreferredResolutions))
// TODO ugly code (see issue nyaanime/downloader#1)
if len(AnimeStatus) == 0 {
AnimeStatus = []anilist.MediaListStatus{
anilist.MediaListStatusCurrent,
anilist.MediaListStatusPlanning,
}
}
// get access token once at startup to be sure that an access token is obtainable at all
if _, err := GetAnilistAccessToken(); err != nil {
panic(err)
}
ticker := time.NewTicker(PollRate)
defer ticker.Stop()
checkTorrents()
for range ticker.C {
checkTorrents()
}
}