mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-30 19:40:05 -07:00
Added logging around SickRage
This commit is contained in:
parent
10be8f0440
commit
dd07e7546b
7 changed files with 113 additions and 36 deletions
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json;
|
||||
using PlexRequests.Helpers;
|
||||
|
||||
namespace PlexRequests.Api.Models.SickRage
|
||||
|
@ -8,26 +6,6 @@ namespace PlexRequests.Api.Models.SickRage
|
|||
public class SickRageSeasonList : SickRageBase<object>
|
||||
{
|
||||
[JsonIgnore]
|
||||
public int[] Data => ParseObjectToArray<int>(data);
|
||||
|
||||
protected T[] ParseObjectToArray<T>(object ambiguousObject)
|
||||
{
|
||||
var json = ambiguousObject.ToString();
|
||||
if (string.IsNullOrWhiteSpace(json))
|
||||
{
|
||||
return new T[0]; // Could return null here instead.
|
||||
}
|
||||
if (json.TrimStart().StartsWith("["))
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T[]>(json);
|
||||
}
|
||||
if (json.TrimStart().Equals("{}"))
|
||||
{
|
||||
return new T[0];
|
||||
}
|
||||
|
||||
return new T[1] { JsonConvert.DeserializeObject<T>(json) };
|
||||
|
||||
}
|
||||
public int[] Data => JsonConvertHelper.ParseObjectToArray<int>(data);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue