Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
e425b08ef8 | |||
f413f97824 | |||
5eb15eb7a5 | |||
3e68bbda29 | |||
bca0e0bf3a |
@ -23,6 +23,12 @@ func LoadFile(socket string, file string, flags LoadFileFlag) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func ShufflePlaylist(socket string) error {
|
||||
cmd := &Command{Command: []interface{}{"playlist-shuffle"}}
|
||||
_, err := SendCommand[any](socket, cmd)
|
||||
return err
|
||||
}
|
||||
|
||||
func Quit(socket string) error {
|
||||
cmd := &Command{Command: []interface{}{"quit"}}
|
||||
_, err := SendCommand[any](socket, cmd)
|
||||
|
8
playlist_entry.go
Normal file
8
playlist_entry.go
Normal file
@ -0,0 +1,8 @@
|
||||
package mpvipc
|
||||
|
||||
type PlaylistEntry struct {
|
||||
Filename string `json:"filename"`
|
||||
Current bool `json:"current"`
|
||||
Playing bool `json:"playing"`
|
||||
ID int `json:"id"`
|
||||
}
|
12
props_get.go
12
props_get.go
@ -49,6 +49,18 @@ func GetFileFormat(socket string) (string, error) {
|
||||
return GetProperty[string](socket, "file-format")
|
||||
}
|
||||
|
||||
func GetPlaylist(socket string) ([]PlaylistEntry, error) {
|
||||
return GetProperty[[]PlaylistEntry](socket, "playlist")
|
||||
}
|
||||
|
||||
func GetPause(socket string) (bool, error) {
|
||||
return GetProperty[bool](socket, "pause")
|
||||
}
|
||||
|
||||
func GetPlaylistPosition(socket string) (int, error) {
|
||||
return GetProperty[int](socket, "playlist-pos")
|
||||
}
|
||||
|
||||
func GetDuration(socket string) (time.Duration, error) {
|
||||
durationInSeconds, err := GetProperty[float64](socket, "duration")
|
||||
if err != nil {
|
||||
|
@ -21,3 +21,7 @@ func SetPercentPos(socket string, percentPos float64) error {
|
||||
func SetVolume(socket string, volume float64) error {
|
||||
return SetProperty[float64](socket, "volume", volume)
|
||||
}
|
||||
|
||||
func SetPlaylistPosition(socket string, index int) error {
|
||||
return SetProperty(socket, "playlist-pos", index)
|
||||
}
|
||||
|
Reference in New Issue
Block a user