mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Finished up the caching TODO's
This commit is contained in:
parent
39c89647f0
commit
fdbb373da5
8 changed files with 53 additions and 16 deletions
|
@ -40,6 +40,6 @@ namespace PlexRequests.Api.Interfaces
|
|||
|
||||
Task<SickRageTvAdd> AddSeason(int tvdbId, int season, string apiKey, Uri baseUrl);
|
||||
|
||||
Task<SickRageTvAdd> GetShows(string apiKey, Uri baseUrl);
|
||||
Task<SickrageShows> GetShows(string apiKey, Uri baseUrl);
|
||||
}
|
||||
}
|
|
@ -70,6 +70,7 @@
|
|||
<Compile Include="Plex\PlexUserRequest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SickRage\SickRageBase.cs" />
|
||||
<Compile Include="SickRage\SickrageShows.cs" />
|
||||
<Compile Include="SickRage\SickRagePing.cs" />
|
||||
<Compile Include="SickRage\SickRageSeasonList.cs" />
|
||||
<Compile Include="SickRage\SickRageShowInformation.cs" />
|
||||
|
|
42
PlexRequests.Api.Models/SickRage/SickrageShows.cs
Normal file
42
PlexRequests.Api.Models/SickRage/SickrageShows.cs
Normal file
|
@ -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<Dictionary<int, Item>>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class Item
|
||||
{
|
||||
public int tvdbid { get; set; }
|
||||
}
|
||||
}
|
|
@ -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<SickRageTvAdd> GetShows(string apiKey, Uri baseUrl) // TODO: get the correct response/models from SR
|
||||
public async Task<SickrageShows> GetShows(string apiKey, Uri baseUrl)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
|
@ -217,15 +218,7 @@ namespace PlexRequests.Api
|
|||
};
|
||||
request.AddUrlSegment("apiKey", apiKey);
|
||||
|
||||
//await Task.Run(() => Thread.Sleep(2000));
|
||||
//return await Task.Run(() =>
|
||||
//{
|
||||
//Log.Trace("Entering `Execute<SickRageTvAdd>` in a new `Task<T>`");
|
||||
var result = Api.ExecuteJson<JObject>(request, baseUrl);
|
||||
|
||||
//Log.Trace("Exiting `Execute<SickRageTvAdd>` and yeilding `Task<T>` result");
|
||||
return null;
|
||||
//}).ConfigureAwait(false);
|
||||
return await Task.Run(() => Api.Execute<SickrageShows>(request, baseUrl)).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -88,7 +88,7 @@
|
|||
<Compile Include="Models\PlexMovie.cs" />
|
||||
<Compile Include="Models\PlexTvShow.cs" />
|
||||
<Compile Include="SickRageCacher.cs" />
|
||||
<Compile Include="Interfaces\ISickRageCacher.cs" />
|
||||
<Compile Include="Interfaces\ITvCacher.cs" />
|
||||
<Compile Include="SonarrCacher.cs" />
|
||||
<Compile Include="Interfaces\ISonarrCacher.cs" />
|
||||
<Compile Include="MediaCacheService.cs" />
|
||||
|
|
|
@ -71,8 +71,9 @@ namespace PlexRequests.Services
|
|||
// we do not want to set here...
|
||||
public int[] QueuedIds()
|
||||
{
|
||||
var tv = Cache.Get<SickRageTvAdd>(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<SickrageShows>(CacheKeys.SickRageQueued);
|
||||
var values = tv?.data.Values.Select(x => x.tvdbid).ToArray();
|
||||
return values;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -71,7 +71,7 @@ namespace PlexRequests.Services
|
|||
public int[] QueuedIds()
|
||||
{
|
||||
var series = Cache.Get<List<Series>>(CacheKeys.SonarrQueued);
|
||||
return series != null ? series.Select(x => x.tvdbId).ToArray() : new int[] { };
|
||||
return series?.Select(x => x.tvdbId).ToArray() ?? new int[] { };
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue