1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 18:02:44 +01:00

Fixed: Plex Library Updates

(cherry picked from commit bd70fa54107c225ea08da53183e2be944e730475)
This commit is contained in:
Mark McDowall 2022-04-11 19:34:02 -07:00 committed by Qstick
parent 5c8b58c30d
commit 43a2a2d335
3 changed files with 48 additions and 11 deletions

View File

@ -5,6 +5,7 @@
using NzbDrone.Common.Serializer; using NzbDrone.Common.Serializer;
using NzbDrone.Core.ImportLists.Exceptions; using NzbDrone.Core.ImportLists.Exceptions;
using NzbDrone.Core.ImportLists.ImportListMovies; using NzbDrone.Core.ImportLists.ImportListMovies;
using NzbDrone.Core.Notifications.Plex.PlexTv;
using NzbDrone.Core.Notifications.Plex.Server; using NzbDrone.Core.Notifications.Plex.Server;
namespace NzbDrone.Core.ImportLists.Plex namespace NzbDrone.Core.ImportLists.Plex
@ -19,7 +20,7 @@ public PlexParser()
public virtual IList<ImportListMovie> ParseResponse(ImportListResponse importResponse) public virtual IList<ImportListMovie> ParseResponse(ImportListResponse importResponse)
{ {
List<PlexSectionItem> items; List<PlexWatchlistItem> items;
_importResponse = importResponse; _importResponse = importResponse;
@ -30,7 +31,7 @@ public virtual IList<ImportListMovie> ParseResponse(ImportListResponse importRes
return movies; return movies;
} }
items = Json.Deserialize<PlexResponse<PlexSectionResponse>>(_importResponse.Content) items = Json.Deserialize<PlexResponse<PlexWatchlistRespone>>(_importResponse.Content)
.MediaContainer .MediaContainer
.Items; .Items;

View File

@ -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<PlexWatchlistItem> Items { get; set; }
public PlexWatchlistRespone()
{
Items = new List<PlexWatchlistItem>();
}
}
public class PlexWatchlistItem
{
public PlexWatchlistItem()
{
Guids = new List<PlexSectionItemGuid>();
}
[JsonProperty("ratingKey")]
public string Id { get; set; }
public string Title { get; set; }
public int Year { get; set; }
[JsonProperty("Guid")]
public List<PlexSectionItemGuid> Guids { get; set; }
}
}

View File

@ -3,22 +3,14 @@
namespace NzbDrone.Core.Notifications.Plex.Server namespace NzbDrone.Core.Notifications.Plex.Server
{ {
public class PlexSectionItemGuid
{
public string Id { get; set; }
}
public class PlexSectionItem public class PlexSectionItem
{ {
[JsonProperty("ratingKey")] [JsonProperty("ratingKey")]
public string Id { get; set; } public string Id { get; set; }
public string Title { get; set; } public string Title { get; set; }
public int Year { get; set; } public int Year { get; set; }
public string Guid { get; set; }
[JsonProperty("Guid")]
public List<PlexSectionItemGuid> Guids { get; set; }
} }
public class PlexSectionResponse public class PlexSectionResponse
@ -36,5 +28,10 @@ public class PlexSectionResponseLegacy
{ {
[JsonProperty("_children")] [JsonProperty("_children")]
public List<PlexSectionItem> Items { get; set; } public List<PlexSectionItem> Items { get; set; }
public PlexSectionResponseLegacy()
{
Items = new List<PlexSectionItem>();
}
} }
} }