From f839357bd68f3a687726dab9123a6f452f60e316 Mon Sep 17 00:00:00 2001 From: Jille Timmermans Date: Mon, 23 Sep 2019 14:21:02 +0100 Subject: [PATCH] Fix some small things in the README's example Capture the SessionKey that is needed for the example. Fix a syntax error. Use the right field name. --- README.md | 4 ++-- models.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a4ed2d..1062177 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ events := plex.NewNotificationEvents() events.OnPlaying(func(n NotificationContainer) { mediaID := n.PlaySessionStateNotification[0].RatingKey sessionID := n.PlaySessionStateNotification[0].SessionKey - var title + var title string sessions, err := plexConnection.GetSessions() @@ -62,7 +62,7 @@ events.OnPlaying(func(n NotificationContainer) { return } - for _, session := range sessions.MediaContainer.Video { + for _, session := range sessions.MediaContainer.Metadata { if sessionID != session.SessionKey { continue } diff --git a/models.go b/models.go index 9fa1d2e..969e2cc 100644 --- a/models.go +++ b/models.go @@ -95,6 +95,7 @@ type MetadataV1 struct { LibrarySectionID string `json:"librarySectionID"` Media []MediaV1 `json:"Media"` Rating string `json:"rating"` + SessionKey string `json:"sessionKey"` UpdatedAt string `json:"updatedAt"` ViewOffset string `json:"viewOffset"` Year string `json:"year"`