load playlist content into result
This commit is contained in:
parent
bddc82399b
commit
bb19b095b6
3 changed files with 50 additions and 1 deletions
19
mpd.go
19
mpd.go
|
@ -257,3 +257,22 @@ func listPlaylists(c echo.Context) error {
|
|||
|
||||
return c.JSON(http.StatusOK, playlists)
|
||||
}
|
||||
|
||||
func listPlaylist(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("name")
|
||||
|
||||
playlist, err := conn.PlaylistContents(name)
|
||||
if err != nil {
|
||||
c.Logger().Error(err)
|
||||
return c.String(http.StatusBadRequest, err.Error())
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, playlist)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue