Add play CLI commands for albums, playlists and tracks

This commit is contained in:
E1int
2025-08-06 00:52:46 +02:00
parent dbea096edf
commit 647984e92e
5 changed files with 89 additions and 4 deletions
+15
View File
@@ -5,6 +5,9 @@ import "fmt"
const (
PingPath = "/ping"
PlayPath = "/transport/play"
PlayAlbumPath = "/transport/play-album" // ?id=<album ID>&t=<firstTrack>&s=<shuffle>
PlayPlaylistPath = "/transport/play-playlist" // ?id=<playlist ID>&t=<firstTrack>&s=<shuffle>
PlayTrackPath = "/transport/play-track" // ?id=<track ID>
PlayPausePath = "/transport/playpause"
PausePath = "/transport/pause"
StopPath = "/transport/stop"
@@ -37,3 +40,15 @@ func SeekToSecondsPath(secs float64) string {
func SeekBySecondsPath(secs float64) string {
return fmt.Sprintf("%s?s=%0.2f", SeekByPath, secs)
}
func BuildPlayAlbumPath(id string, firstTrack int, shuffle bool) string {
return fmt.Sprintf("%s?id=%s&t=%d&s=%t", PlayAlbumPath, id, firstTrack, shuffle)
}
func BuildPlayPlaylistPath(id string, firstTrack int, shuffle bool) string {
return fmt.Sprintf("%s?id=%s&t=%d&s=%t", PlayPlaylistPath, id, firstTrack, shuffle)
}
func BuildPlayTrackPath(id string) string {
return fmt.Sprintf("%s?id=%s", PlayTrackPath, id)
}