From 51c7ec058b66597bacac478c224c7b0fcdab46f8 Mon Sep 17 00:00:00 2001 From: kar Date: Tue, 30 Dec 2025 21:53:08 -0600 Subject: [PATCH] feat: Adding next song --- client.go | 2 +- server.go | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/client.go b/client.go index b288e3c..a5a4fd4 100644 --- a/client.go +++ b/client.go @@ -22,7 +22,7 @@ func main() { os.Exit(1) } - comandosPermitidos := []string{"play", "pause", "info"} + comandosPermitidos := []string{"play", "pause", "info", "next"} var comando string if slices.Contains(comandosPermitidos, os.Args[1]) { comando = os.Args[1] diff --git a/server.go b/server.go index 57c2fc7..00ad1d5 100644 --- a/server.go +++ b/server.go @@ -38,6 +38,8 @@ func menuController(conn net.Conn) { out = pauseSong(conn) case "info": out = infoSong(conn) + case "next": + out = nextSong(conn) } _, err = conn.Write([]byte(out)) if err != nil { @@ -71,3 +73,12 @@ func infoSong(conn net.Conn) string { } return string(output) } + +func nextSong(conn net.Conn) string { + cmd := exec.Command("mpc", "next") + output, err := cmd.CombinedOutput() + if err != nil { + log.Println("Error al reproducir siguiente cancion", err) + } + return string(output) +}