From 43d85bf59db46f6a015dc5ae76178862a566e19f Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 2 Dec 2016 10:39:12 -0800 Subject: [PATCH] Fixed: Parsing of some Plex server responses before 1.3 --- .../Notifications/Plex/PlexServerProxy.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/NzbDrone.Core/Notifications/Plex/PlexServerProxy.cs b/src/NzbDrone.Core/Notifications/Plex/PlexServerProxy.cs index cc1011b8d..43658c5f6 100644 --- a/src/NzbDrone.Core/Notifications/Plex/PlexServerProxy.cs +++ b/src/NzbDrone.Core/Notifications/Plex/PlexServerProxy.cs @@ -97,12 +97,12 @@ namespace NzbDrone.Core.Notifications.Plex _logger.Trace("Version response: {0}", response.Content); CheckForError(response, settings); - if (response.Content.Contains("MediaContainer")) + if (response.Content.Contains("_children")) { - return Json.Deserialize>(response.Content).MediaContainer.Version; + return Json.Deserialize(response.Content).Version; } - return Json.Deserialize(response.Content).Version; + return Json.Deserialize>(response.Content).MediaContainer.Version; } public List Preferences(PlexServerSettings settings) @@ -114,12 +114,12 @@ namespace NzbDrone.Core.Notifications.Plex _logger.Trace("Preferences response: {0}", response.Content); CheckForError(response, settings); - if (response.Content.Contains("MediaContainer")) + if (response.Content.Contains("_children")) { - return Json.Deserialize>(response.Content).MediaContainer.Preferences; + return Json.Deserialize(response.Content).Preferences; } - return Json.Deserialize(response.Content).Preferences; + return Json.Deserialize>(response.Content).MediaContainer.Preferences; } public int? GetMetadataId(int sectionId, int tvdbId, string language, PlexServerSettings settings) @@ -240,9 +240,9 @@ namespace NzbDrone.Core.Notifications.Plex throw new PlexAuthenticationException("Unauthorized - Username or password is incorrect"); } - var error = response.Content.Contains("MediaContainer") ? - Json.Deserialize>(response.Content).MediaContainer : - Json.Deserialize(response.Content); + var error = response.Content.Contains("_children") ? + Json.Deserialize(response.Content) : + Json.Deserialize>(response.Content).MediaContainer; if (error != null && !error.Error.IsNullOrWhiteSpace()) {