add updateDb method
This commit is contained in:
parent
99d50084f2
commit
dd41374467
2 changed files with 17 additions and 0 deletions
16
mpd.go
16
mpd.go
|
@ -11,6 +11,22 @@ import (
|
|||
|
||||
// MPD API calls
|
||||
|
||||
func updateDb(c echo.Context) error {
|
||||
// Connect to MPD server
|
||||
conn, err := mpd.Dial("tcp", "localhost:6600")
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
jobId, err := conn.Update("")
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
return c.String(http.StatusOK, strconv.Itoa(jobId))
|
||||
}
|
||||
|
||||
func previousTrack(c echo.Context) error {
|
||||
// Connect to MPD server
|
||||
conn, err := mpd.Dial("tcp", "localhost:6600")
|
||||
|
|
|
@ -78,6 +78,7 @@ func main() {
|
|||
})
|
||||
|
||||
g := e.Group("/api")
|
||||
g.GET("/update_db", updateDb)
|
||||
g.GET("/previous_track", previousTrack)
|
||||
g.GET("/next_track", nextTrack)
|
||||
g.GET("/stop", stopPlayback)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue