From c0f3b6e92047aa24318940c552ccdab0efb8cc88 Mon Sep 17 00:00:00 2001 From: aditya-K2 Date: Sat, 9 Oct 2021 17:21:47 +0530 Subject: [PATCH] All the Client related activities are in client.go --- client.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 client.go diff --git a/client.go b/client.go new file mode 100644 index 0000000..819ead0 --- /dev/null +++ b/client.go @@ -0,0 +1,15 @@ +package main + +import ( + "github.com/fhs/gompd/mpd" +) + +func togglePlayBack(connection mpd.Client) error { + status, err := connection.Status() + if(status["state"] == "play" && err == nil){ + connection.Pause(true) + } else if(status["state"] == "pause" && err == nil) { + connection.Play(-1) + } + return err +}