From bca0e0bf3a2e77efe5af0874b4b3d58ab5db50a8 Mon Sep 17 00:00:00 2001 From: Tordarus Date: Sat, 28 Jun 2025 13:36:09 +0200 Subject: [PATCH] added GetPlaylist() --- playlist_entry.go | 8 ++++++++ props_get.go | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 playlist_entry.go diff --git a/playlist_entry.go b/playlist_entry.go new file mode 100644 index 0000000..40be0eb --- /dev/null +++ b/playlist_entry.go @@ -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"` +} diff --git a/props_get.go b/props_get.go index a997f39..348d624 100644 --- a/props_get.go +++ b/props_get.go @@ -49,6 +49,10 @@ func GetFileFormat(socket string) (string, error) { return GetProperty[string](socket, "file-format") } +func GetPlaylist(socket string) ([]PlaylistEntry, error) { + return GetProperty[[]PlaylistEntry](socket, "playlist") +} + func GetDuration(socket string) (time.Duration, error) { durationInSeconds, err := GetProperty[float64](socket, "duration") if err != nil {