add attach playlist feature

This commit is contained in:
XenGi 2024-04-18 12:12:52 +02:00
parent aeaef11341
commit 1fc5dc2bf8
Signed by: xengi
SSH key fingerprint: SHA256:FGp51kRvGOcWnTHiOI39ImwVO4A3fpvR30nPX3LpV7g
4 changed files with 23 additions and 2 deletions

19
mpd.go
View file

@ -335,3 +335,22 @@ func replaceQueue(c echo.Context) error {
return c.JSON(http.StatusOK, "")
}
func attachPlaylist(c echo.Context) error {
// Connect to MPD server
conn, err := mpd.Dial("tcp", "localhost:6600")
if err != nil {
c.Logger().Error(err)
}
defer conn.Close()
name := c.Param("playlist_name")
err = conn.PlaylistLoad(name, -1, -1)
if err != nil {
c.Logger().Error(err)
return c.String(http.StatusBadRequest, err.Error())
}
return c.JSON(http.StatusOK, "")
}