diff --git a/PlexRequests.Api.Interfaces/ISickRageApi.cs b/PlexRequests.Api.Interfaces/ISickRageApi.cs index 5d10d7557..13cfacd84 100644 --- a/PlexRequests.Api.Interfaces/ISickRageApi.cs +++ b/PlexRequests.Api.Interfaces/ISickRageApi.cs @@ -40,6 +40,6 @@ namespace PlexRequests.Api.Interfaces Task AddSeason(int tvdbId, int season, string apiKey, Uri baseUrl); - Task GetShows(string apiKey, Uri baseUrl); + Task GetShows(string apiKey, Uri baseUrl); } } \ No newline at end of file diff --git a/PlexRequests.Api.Models/PlexRequests.Api.Models.csproj b/PlexRequests.Api.Models/PlexRequests.Api.Models.csproj index e6c3dfde8..08d39300b 100644 --- a/PlexRequests.Api.Models/PlexRequests.Api.Models.csproj +++ b/PlexRequests.Api.Models/PlexRequests.Api.Models.csproj @@ -70,6 +70,7 @@ + diff --git a/PlexRequests.Api.Models/SickRage/SickrageShows.cs b/PlexRequests.Api.Models/SickRage/SickrageShows.cs new file mode 100644 index 000000000..b33aeaf58 --- /dev/null +++ b/PlexRequests.Api.Models/SickRage/SickrageShows.cs @@ -0,0 +1,42 @@ +#region Copyright +// /************************************************************************ +// Copyright (c) 2016 Jamie Rees +// File: SickrageShows.cs +// Created By: Jamie Rees +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ************************************************************************/ +#endregion + +using System; +using System.Collections.Generic; + +namespace PlexRequests.Api.Models.SickRage +{ + public class SickrageShows : SickRageBase> + { + + } + + public class Item + { + public int tvdbid { get; set; } + } +} \ No newline at end of file diff --git a/PlexRequests.Api/SickrageApi.cs b/PlexRequests.Api/SickrageApi.cs index 68a501a04..7d5aca913 100644 --- a/PlexRequests.Api/SickrageApi.cs +++ b/PlexRequests.Api/SickrageApi.cs @@ -33,6 +33,7 @@ using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Newtonsoft.Json; using NLog; using PlexRequests.Api.Interfaces; using PlexRequests.Api.Models.SickRage; @@ -208,7 +209,7 @@ namespace PlexRequests.Api }).ConfigureAwait(false); } - public async Task GetShows(string apiKey, Uri baseUrl) // TODO: get the correct response/models from SR + public async Task GetShows(string apiKey, Uri baseUrl) { var request = new RestRequest { @@ -216,16 +217,8 @@ namespace PlexRequests.Api Method = Method.GET }; request.AddUrlSegment("apiKey", apiKey); - - //await Task.Run(() => Thread.Sleep(2000)); - //return await Task.Run(() => - //{ - //Log.Trace("Entering `Execute` in a new `Task`"); - var result = Api.ExecuteJson(request, baseUrl); - - //Log.Trace("Exiting `Execute` and yeilding `Task` result"); - return null; - //}).ConfigureAwait(false); + + return await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false); } } } \ No newline at end of file diff --git a/PlexRequests.Services/Interfaces/ISickRageCacher.cs b/PlexRequests.Services/Interfaces/ITvCacher.cs similarity index 100% rename from PlexRequests.Services/Interfaces/ISickRageCacher.cs rename to PlexRequests.Services/Interfaces/ITvCacher.cs diff --git a/PlexRequests.Services/PlexRequests.Services.csproj b/PlexRequests.Services/PlexRequests.Services.csproj index 552b84941..3afb8086f 100644 --- a/PlexRequests.Services/PlexRequests.Services.csproj +++ b/PlexRequests.Services/PlexRequests.Services.csproj @@ -88,7 +88,7 @@ - + diff --git a/PlexRequests.Services/SickRageCacher.cs b/PlexRequests.Services/SickRageCacher.cs index 277b19645..c42759d16 100644 --- a/PlexRequests.Services/SickRageCacher.cs +++ b/PlexRequests.Services/SickRageCacher.cs @@ -71,8 +71,9 @@ namespace PlexRequests.Services // we do not want to set here... public int[] QueuedIds() { - var tv = Cache.Get(CacheKeys.SickRageQueued); - return new int[] { }; //tv != null ? tv.Select(x => x.info.tmdb_id).ToArray() : new int[] { }; // TODO: return the array of tvdb IDs from SR + var tv = Cache.Get(CacheKeys.SickRageQueued); + var values = tv?.data.Values.Select(x => x.tvdbid).ToArray(); + return values; } } } \ No newline at end of file diff --git a/PlexRequests.Services/SonarrCacher.cs b/PlexRequests.Services/SonarrCacher.cs index 018db93c0..34d00b8c3 100644 --- a/PlexRequests.Services/SonarrCacher.cs +++ b/PlexRequests.Services/SonarrCacher.cs @@ -71,7 +71,7 @@ namespace PlexRequests.Services public int[] QueuedIds() { var series = Cache.Get>(CacheKeys.SonarrQueued); - return series != null ? series.Select(x => x.tvdbId).ToArray() : new int[] { }; + return series?.Select(x => x.tvdbId).ToArray() ?? new int[] { }; } } } \ No newline at end of file