From c43c008715685a7960b9851f4d83bd58d83ca72e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas?= Date: Mon, 4 Dec 2023 01:28:03 +0100 Subject: [PATCH] Now we play and stop --- .tool-versions | 1 + main.go | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .tool-versions diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..83d3f70 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +golang 1.21.4 diff --git a/main.go b/main.go index 62bca0f..99aa35a 100644 --- a/main.go +++ b/main.go @@ -133,10 +133,16 @@ func main() { radiospiral_label, nowplaying_label, widget.NewButton("Play", func() { - nowplaying_label.SetText("Playing!") - mplayer.Play("http://radiospiral.radio/stream.mp3") + if !mplayer.is_playing { + nowplaying_label.SetText("Playing!") + mplayer.Play("http://radiospiral.radio/stream.mp3") + } else { + nowplaying_label.SetText("Stopped") + mplayer.Pause() + } }), )) window.ShowAndRun() + mplayer.Close() }