mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
Fixed #144
This commit is contained in:
parent
08cbf927ee
commit
3efd54c1b6
7 changed files with 57 additions and 15 deletions
|
@ -87,6 +87,12 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PlexRequests.Helpers\PlexRequests.Helpers.csproj">
|
||||||
|
<Project>{1252336D-42A3-482A-804C-836E60173DFA}</Project>
|
||||||
|
<Name>PlexRequests.Helpers</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace PlexRequests.Api.Models.SickRage
|
namespace PlexRequests.Api.Models.SickRage
|
||||||
{
|
{
|
||||||
public class SickRageBase<T>
|
public abstract class SickRageBase<T>
|
||||||
{
|
{
|
||||||
public T data { get; set; }
|
public T data { get; set; }
|
||||||
public string message { get; set; }
|
public string message { get; set; }
|
||||||
|
|
|
@ -1,6 +1,33 @@
|
||||||
namespace PlexRequests.Api.Models.SickRage
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using PlexRequests.Helpers;
|
||||||
|
|
||||||
|
namespace PlexRequests.Api.Models.SickRage
|
||||||
{
|
{
|
||||||
public class SickRageSeasonList : SickRageBase<int[]>
|
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) };
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,6 +25,7 @@
|
||||||
// ************************************************************************/
|
// ************************************************************************/
|
||||||
#endregion
|
#endregion
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
@ -33,13 +34,19 @@ using Newtonsoft.Json;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
|
||||||
using PlexRequests.Api.Interfaces;
|
using PlexRequests.Api.Interfaces;
|
||||||
|
using PlexRequests.Helpers;
|
||||||
using RestSharp;
|
using RestSharp;
|
||||||
|
|
||||||
namespace PlexRequests.Api
|
namespace PlexRequests.Api
|
||||||
{
|
{
|
||||||
public class ApiRequest : IApiRequest
|
public class ApiRequest : IApiRequest
|
||||||
{
|
{
|
||||||
|
private JsonSerializerSettings Settings = new JsonSerializerSettings
|
||||||
|
{
|
||||||
|
NullValueHandling = NullValueHandling.Ignore,
|
||||||
|
MissingMemberHandling = MissingMemberHandling.Ignore
|
||||||
|
};
|
||||||
|
|
||||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An API request handler
|
/// An API request handler
|
||||||
|
@ -108,7 +115,7 @@ namespace PlexRequests.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var json = JsonConvert.DeserializeObject<T>(response.Content);
|
var json = JsonConvert.DeserializeObject<T>(response.Content, Settings);
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
@ -129,4 +136,6 @@ namespace PlexRequests.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace PlexRequests.Api
|
||||||
while (seasonIncrement < seasonCount)
|
while (seasonIncrement < seasonCount)
|
||||||
{
|
{
|
||||||
seasonList = VerifyShowHasLoaded(tvdbId, apiKey, baseUrl);
|
seasonList = VerifyShowHasLoaded(tvdbId, apiKey, baseUrl);
|
||||||
seasonIncrement = seasonList.data?.Length ?? 0;
|
seasonIncrement = seasonList.Data?.Length ?? 0;
|
||||||
|
|
||||||
if (sw.ElapsedMilliseconds > 30000) // Break out after 30 seconds, it's not going to get added
|
if (sw.ElapsedMilliseconds > 30000) // Break out after 30 seconds, it's not going to get added
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="/Content/jquery-2.2.1.min.js"></script>
|
<script src="~/Content/jquery-2.2.1.min.js"></script>
|
||||||
<script src="/Content/handlebars.min.js"></script>
|
<script src="~/Content/handlebars.min.js"></script>
|
||||||
<script src="/Content/bootstrap.min.js"></script>
|
<script src="~/Content/bootstrap.min.js"></script>
|
||||||
<script src="/Content/bootstrap-notify.min.js"></script>
|
<script src="~/Content/bootstrap-notify.min.js"></script>
|
||||||
<script src="/Content/site.js"></script>
|
<script src="~/Content/site.js"></script>
|
||||||
<script src="/Content/pace.min.js"></script>
|
<script src="~/Content/pace.min.js"></script>
|
||||||
<script src="/Content/jquery.mixitup.js"></script>
|
<script src="~/Content/jquery.mixitup.js"></script>
|
||||||
<script src="/Content/moment.min.js"></script>
|
<script src="~/Content/moment.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ assembly_info:
|
||||||
file: '**\AssemblyInfo.*'
|
file: '**\AssemblyInfo.*'
|
||||||
assembly_version: '1.6.0'
|
assembly_version: '1.6.0'
|
||||||
assembly_file_version: '{version}'
|
assembly_file_version: '{version}'
|
||||||
assembly_informational_version: '1.6.0'
|
assembly_informational_version: '1.6.0'
|
||||||
before_build:
|
before_build:
|
||||||
- cmd: appveyor-retry nuget restore
|
- cmd: appveyor-retry nuget restore
|
||||||
build:
|
build:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue