add attach playlist feature
This commit is contained in:
parent
aeaef11341
commit
1fc5dc2bf8
4 changed files with 23 additions and 2 deletions
19
mpd.go
19
mpd.go
|
@ -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, "")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue