FF-1450 - plex lowercase and use invariant culture for lookups

This commit is contained in:
John Andrews
2024-03-22 13:30:27 +13:00
parent be2f501b26
commit da7373ad7a

View File

@@ -1,4 +1,5 @@
using FileFlows.Plex.Models;
using System.Diagnostics.CodeAnalysis;
using FileFlows.Plex.Models;
namespace FileFlows.Plex.MediaManagement;
@@ -48,6 +49,7 @@ public class PlexAnalyze : PlexNode
return item?.RatingKey ?? string.Empty;
}
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "<Pending>")]
internal PlexMedia[] GetPlexMedia(HttpClient httpClient, NodeParameters args, string baseUrl, string urlPath, string token, int depth = 0)
{
if (depth > 10)
@@ -56,7 +58,7 @@ public class PlexAnalyze : PlexNode
urlPath = urlPath[1..];
string fullUrl = baseUrl + urlPath;
fullUrl += (fullUrl.IndexOf("?") > 0 ? "&" : "?") + "X-Plex-Token=" + token;
fullUrl += (fullUrl.IndexOf("?", StringComparison.Ordinal) > 0 ? "&" : "?") + "X-Plex-Token=" + token;
var updateResponse = GetWebRequest(httpClient, fullUrl);
if (updateResponse.success == false)
{
@@ -71,7 +73,9 @@ public class PlexAnalyze : PlexNode
{
var options = new System.Text.Json.JsonSerializerOptions();
options.PropertyNameCaseInsensitive = true;
metadata = System.Text.Json.JsonSerializer.Deserialize<PlexSections>(updateResponse.body, options)?.MediaContainer?.Metadata?.ToList();
metadata = System.Text.Json.JsonSerializer.Deserialize<PlexSections>(updateResponse.body, options)
?.MediaContainer?.Metadata?.ToList()
?? new();
}
catch (Exception ex)
{