mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-28 08:58:41 +02:00
parent
481345226a
commit
bd70fa5410
@ -3,6 +3,7 @@
|
||||
using System.Net;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.ImportLists.Exceptions;
|
||||
using NzbDrone.Core.Notifications.Plex.PlexTv;
|
||||
using NzbDrone.Core.Notifications.Plex.Server;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
@ -14,7 +15,7 @@ public class PlexParser : IParseImportListResponse
|
||||
|
||||
public virtual IList<ImportListItemInfo> ParseResponse(ImportListResponse importResponse)
|
||||
{
|
||||
List<PlexSectionItem> items;
|
||||
List<PlexWatchlistItem> items;
|
||||
|
||||
_importResponse = importResponse;
|
||||
|
||||
@ -25,7 +26,7 @@ public virtual IList<ImportListItemInfo> ParseResponse(ImportListResponse import
|
||||
return series;
|
||||
}
|
||||
|
||||
items = Json.Deserialize<PlexResponse<PlexSectionResponse>>(_importResponse.Content)
|
||||
items = Json.Deserialize<PlexResponse<PlexWatchlistRespone>>(_importResponse.Content)
|
||||
.MediaContainer
|
||||
.Items;
|
||||
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
@ -3,27 +3,14 @@
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Plex.Server
|
||||
{
|
||||
public class PlexSectionItemGuid
|
||||
{
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
public class PlexSectionItem
|
||||
{
|
||||
public PlexSectionItem()
|
||||
{
|
||||
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; }
|
||||
public string Guid { get; set; }
|
||||
}
|
||||
|
||||
public class PlexSectionResponse
|
||||
@ -41,5 +28,10 @@ public class PlexSectionResponseLegacy
|
||||
{
|
||||
[JsonProperty("_children")]
|
||||
public List<PlexSectionItem> Items { get; set; }
|
||||
|
||||
public PlexSectionResponseLegacy()
|
||||
{
|
||||
Items = new List<PlexSectionItem>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user