From 43a2a2d335036008706a45be479128ed7a78c16c Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 11 Apr 2022 19:34:02 -0700 Subject: [PATCH] Fixed: Plex Library Updates (cherry picked from commit bd70fa54107c225ea08da53183e2be944e730475) --- .../ImportLists/Plex/PlexParser.cs | 5 ++- .../Plex/PlexTv/PlexWatchlistItem.cs | 39 +++++++++++++++++++ .../Plex/Server/PlexSectionItem.cs | 15 +++---- 3 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 src/NzbDrone.Core/Notifications/Plex/PlexTv/PlexWatchlistItem.cs diff --git a/src/NzbDrone.Core/ImportLists/Plex/PlexParser.cs b/src/NzbDrone.Core/ImportLists/Plex/PlexParser.cs index 36fbc670d..5da2d6833 100644 --- a/src/NzbDrone.Core/ImportLists/Plex/PlexParser.cs +++ b/src/NzbDrone.Core/ImportLists/Plex/PlexParser.cs @@ -5,6 +5,7 @@ using NzbDrone.Common.Extensions; using NzbDrone.Common.Serializer; using NzbDrone.Core.ImportLists.Exceptions; using NzbDrone.Core.ImportLists.ImportListMovies; +using NzbDrone.Core.Notifications.Plex.PlexTv; using NzbDrone.Core.Notifications.Plex.Server; namespace NzbDrone.Core.ImportLists.Plex @@ -19,7 +20,7 @@ namespace NzbDrone.Core.ImportLists.Plex public virtual IList ParseResponse(ImportListResponse importResponse) { - List items; + List items; _importResponse = importResponse; @@ -30,7 +31,7 @@ namespace NzbDrone.Core.ImportLists.Plex return movies; } - items = Json.Deserialize>(_importResponse.Content) + items = Json.Deserialize>(_importResponse.Content) .MediaContainer .Items; diff --git a/src/NzbDrone.Core/Notifications/Plex/PlexTv/PlexWatchlistItem.cs b/src/NzbDrone.Core/Notifications/Plex/PlexTv/PlexWatchlistItem.cs new file mode 100644 index 000000000..a2e77d614 --- /dev/null +++ b/src/NzbDrone.Core/Notifications/Plex/PlexTv/PlexWatchlistItem.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace NzbDrone.Core.Notifications.Plex.PlexTv +{ + public class PlexSectionItemGuid + { + public string Id { get; set; } + } + + public class PlexWatchlistRespone + { + [JsonProperty("Metadata")] + public List Items { get; set; } + + public PlexWatchlistRespone() + { + Items = new List(); + } + } + + public class PlexWatchlistItem + { + public PlexWatchlistItem() + { + Guids = new List(); + } + + [JsonProperty("ratingKey")] + public string Id { get; set; } + + public string Title { get; set; } + + public int Year { get; set; } + + [JsonProperty("Guid")] + public List Guids { get; set; } + } +} diff --git a/src/NzbDrone.Core/Notifications/Plex/Server/PlexSectionItem.cs b/src/NzbDrone.Core/Notifications/Plex/Server/PlexSectionItem.cs index 42e6919cc..dcb5fe7a9 100644 --- a/src/NzbDrone.Core/Notifications/Plex/Server/PlexSectionItem.cs +++ b/src/NzbDrone.Core/Notifications/Plex/Server/PlexSectionItem.cs @@ -3,22 +3,14 @@ using Newtonsoft.Json; namespace NzbDrone.Core.Notifications.Plex.Server { - public class PlexSectionItemGuid - { - public string Id { get; set; } - } - public class PlexSectionItem { [JsonProperty("ratingKey")] public string Id { get; set; } public string Title { get; set; } - public int Year { get; set; } - - [JsonProperty("Guid")] - public List Guids { get; set; } + public string Guid { get; set; } } public class PlexSectionResponse @@ -36,5 +28,10 @@ namespace NzbDrone.Core.Notifications.Plex.Server { [JsonProperty("_children")] public List Items { get; set; } + + public PlexSectionResponseLegacy() + { + Items = new List(); + } } }