feat: Adding next song

This commit is contained in:
kar
2025-12-30 21:53:08 -06:00
parent 19e920a83f
commit 51c7ec058b
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ func main() {
os.Exit(1) os.Exit(1)
} }
comandosPermitidos := []string{"play", "pause", "info"} comandosPermitidos := []string{"play", "pause", "info", "next"}
var comando string var comando string
if slices.Contains(comandosPermitidos, os.Args[1]) { if slices.Contains(comandosPermitidos, os.Args[1]) {
comando = os.Args[1] comando = os.Args[1]
+11
View File
@@ -38,6 +38,8 @@ func menuController(conn net.Conn) {
out = pauseSong(conn) out = pauseSong(conn)
case "info": case "info":
out = infoSong(conn) out = infoSong(conn)
case "next":
out = nextSong(conn)
} }
_, err = conn.Write([]byte(out)) _, err = conn.Write([]byte(out))
if err != nil { if err != nil {
@@ -71,3 +73,12 @@ func infoSong(conn net.Conn) string {
} }
return string(output) 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)
}