Browse Source

use separate model for plex collection scanning since the api types are inconsistent (#1504)

pull/1505/head
Jason Dove 2 years ago committed by GitHub
parent
commit
5d11a6b46f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ErsatzTV.Infrastructure/Plex/IPlexServerApi.cs
  2. 30
      ErsatzTV.Infrastructure/Plex/Models/PlexCollectionMetadataResponse.cs
  3. 12
      ErsatzTV.Infrastructure/Plex/Models/PlexMetadataResponse.cs
  4. 2
      ErsatzTV.Infrastructure/Plex/PlexEtag.cs
  5. 2
      ErsatzTV.Infrastructure/Plex/PlexServerApiClient.cs

2
ErsatzTV.Infrastructure/Plex/IPlexServerApi.cs

@ -44,7 +44,7 @@ public interface IPlexServerApi @@ -44,7 +44,7 @@ public interface IPlexServerApi
[Get("/library/all?type=18")]
[Headers("Accept: application/json")]
public Task<PlexMediaContainerResponse<PlexMediaContainerMetadataContent<PlexMetadataResponse>>>
public Task<PlexMediaContainerResponse<PlexMediaContainerMetadataContent<PlexCollectionMetadataResponse>>>
GetCollections(
[Query] [AliasAs("X-Plex-Container-Start")]
int skip,

30
ErsatzTV.Infrastructure/Plex/Models/PlexCollectionMetadataResponse.cs

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
using System.Xml.Serialization;
namespace ErsatzTV.Infrastructure.Plex.Models;
public class PlexCollectionMetadataResponse
{
[XmlAttribute("key")]
public string Key { get; set; }
[XmlAttribute("ratingKey")]
public string RatingKey { get; set; }
[XmlAttribute("title")]
public string Title { get; set; }
[XmlAttribute("addedAt")]
public long AddedAt { get; set; }
[XmlAttribute("updatedAt")]
public long UpdatedAt { get; set; }
[XmlAttribute("smart")]
public string Smart { get; set; }
[XmlAttribute("librarySectionId")]
public int LibrarySectionId { get; set; }
[XmlAttribute("childCount")]
public string ChildCount { get; set; }
}

12
ErsatzTV.Infrastructure/Plex/Models/PlexMetadataResponse.cs

@ -7,9 +7,6 @@ public class PlexMetadataResponse @@ -7,9 +7,6 @@ public class PlexMetadataResponse
[XmlAttribute("key")]
public string Key { get; set; }
[XmlAttribute("ratingKey")]
public string RatingKey { get; set; }
[XmlAttribute("title")]
public string Title { get; set; }
@ -40,15 +37,6 @@ public class PlexMetadataResponse @@ -40,15 +37,6 @@ public class PlexMetadataResponse
[XmlAttribute("updatedAt")]
public long UpdatedAt { get; set; }
[XmlAttribute("childCount")]
public string ChildCount { get; set; }
[XmlAttribute("smart")]
public string Smart { get; set; }
[XmlAttribute("librarySectionId")]
public int LibrarySectionId { get; set; }
[XmlAttribute("index")]
public int Index { get; set; }

2
ErsatzTV.Infrastructure/Plex/PlexEtag.cs

@ -254,7 +254,7 @@ public class PlexEtag @@ -254,7 +254,7 @@ public class PlexEtag
return BitConverter.ToString(hash).Replace("-", string.Empty);
}
public string ForCollection(PlexMetadataResponse response)
public string ForCollection(PlexCollectionMetadataResponse response)
{
using MemoryStream ms = _recyclableMemoryStreamManager.GetStream();
using var bw = new BinaryWriter(ms);

2
ErsatzTV.Infrastructure/Plex/PlexServerApiClient.cs

@ -407,7 +407,7 @@ public class PlexServerApiClient : IPlexServerApiClient @@ -407,7 +407,7 @@ public class PlexServerApiClient : IPlexServerApiClient
_ => None
};
private Option<PlexCollection> ProjectToCollection(PlexMediaSource plexMediaSource, PlexMetadataResponse item)
private Option<PlexCollection> ProjectToCollection(PlexMediaSource plexMediaSource, PlexCollectionMetadataResponse item)
{
try
{

Loading…
Cancel
Save