check for ffprobe installed

This commit is contained in:
milarin 2023-01-14 11:10:57 +01:00
parent 326d128bd1
commit 1f13aee410

16
main.go
View File

@ -2,23 +2,29 @@ package main
import ( import (
"fmt" "fmt"
"os/exec"
"time" "time"
"git.milar.in/nyaanime/logic" "git.milar.in/nyaanime/logic"
) )
func main() { func main() {
fmt.Println("generated priority values:") // check for ffprobe in PATH
fmt.Print(Map2Table("language", logic.PreferredLanguages)) if _, err := exec.LookPath("ffprobe"); err != nil {
fmt.Print(Map2Table("subtitle", logic.PreferredSubtitles)) panic(err) // TODO error handling
fmt.Print(Map2Table("resolution", logic.PreferredResolutions)) }
fmt.Println()
// get access token once at startup to be sure that an access token is obtainable at all // get access token once at startup to be sure that an access token is obtainable at all
if _, err := logic.GetAnilistAccessToken(); err != nil { if _, err := logic.GetAnilistAccessToken(); err != nil {
panic(err) panic(err)
} }
fmt.Println("generated priority values:")
fmt.Print(Map2Table("language", logic.PreferredLanguages))
fmt.Print(Map2Table("subtitle", logic.PreferredSubtitles))
fmt.Print(Map2Table("resolution", logic.PreferredResolutions))
fmt.Println()
ticker := time.NewTicker(PollRate) ticker := time.NewTicker(PollRate)
defer ticker.Stop() defer ticker.Stop()