From 56cc38144d79e9ccbad98e02443d74e4db245973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas?= Date: Wed, 6 Dec 2023 19:35:10 +0100 Subject: [PATCH] feat: detect OS and use the ffmpeg exe name --- main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 718f0f2..18e6e90 100644 --- a/main.go +++ b/main.go @@ -46,6 +46,7 @@ import ( "net/url" "os" "os/exec" + "runtime" "strings" "time" @@ -283,10 +284,15 @@ func loadImageURL(url string) image.Image { } func main() { - RADIOSPIRAL_STREAM := "https://radiospiral.radio/stream.mp3" - RADIOSPIRAL_JSON_ENDPOINT := "https://radiospiral.net/wp-json/radio/broadcast" + const RADIOSPIRAL_STREAM = "https://radiospiral.radio/stream.mp3" + const RADIOSPIRAL_JSON_ENDPOINT = "https://radiospiral.net/wp-json/radio/broadcast" PLAYER_CMD := "ffmpeg" + if runtime.GOOS == "windows" { + log.Println("Detected Windows") + PLAYER_CMD = "ffmpeg.exe" + } + // Command line arguments parsing loggingToFilePtr := flag.Bool("log", false, "Create a log file")