api: Implement next track button
This commit is contained in:
parent
fc660f49a7
commit
5ff2f0730f
1 changed files with 11 additions and 0 deletions
11
api/alarm.go
11
api/alarm.go
|
@ -33,6 +33,17 @@ func declareAlarmRoutes(cfg *config.Config, router *gin.RouterGroup) {
|
||||||
c.JSON(http.StatusOK, true)
|
c.JSON(http.StatusOK, true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.POST("/alarm/next", func(c *gin.Context) {
|
||||||
|
if player.CommonPlayer == nil {
|
||||||
|
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": "No player currently playing"})
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
player.CommonPlayer.NextTrack()
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, true)
|
||||||
|
})
|
||||||
|
|
||||||
router.DELETE("/alarm", func(c *gin.Context) {
|
router.DELETE("/alarm", func(c *gin.Context) {
|
||||||
if player.CommonPlayer != nil {
|
if player.CommonPlayer != nil {
|
||||||
err := player.CommonPlayer.Stop()
|
err := player.CommonPlayer.Stop()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue