mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-10 07:22:35 -07:00
Made more async goodness
This commit is contained in:
parent
8550cc4c5e
commit
166e0f81cf
7 changed files with 181 additions and 30 deletions
|
@ -164,8 +164,6 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
private async Task<Response> ProcessMovies(MovieSearchType searchType, string searchTerm)
|
||||
{
|
||||
|
||||
|
||||
var apiMovies = new List<MovieResult>();
|
||||
await Task.Factory.StartNew(
|
||||
() =>
|
||||
|
@ -208,16 +206,12 @@ namespace PlexRequests.UI.Modules
|
|||
apiMovies = t.Result;
|
||||
});
|
||||
|
||||
Dictionary<int, RequestedModel> dbMovies = new Dictionary<int, RequestedModel>();
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
return RequestService.GetAll().Where(x => x.Type == RequestType.Movie);
|
||||
var allResults = await RequestService.GetAllAsync();
|
||||
allResults = allResults.Where(x => x.Type == RequestType.Movie);
|
||||
|
||||
var distinctResults = allResults.DistinctBy(x => x.ProviderId);
|
||||
var dbMovies = distinctResults.ToDictionary(x => x.ProviderId);
|
||||
|
||||
}).ContinueWith((t) =>
|
||||
{
|
||||
var distinctResults = t.Result.DistinctBy(x => x.ProviderId);
|
||||
dbMovies = distinctResults.ToDictionary(x => x.ProviderId);
|
||||
});
|
||||
|
||||
var cpCached = CpCacher.QueuedIds();
|
||||
var plexMovies = Checker.GetPlexMovies();
|
||||
|
@ -287,15 +281,10 @@ namespace PlexRequests.UI.Modules
|
|||
apiTv = t.Result;
|
||||
});
|
||||
|
||||
var dbTv = new Dictionary<int, RequestedModel>();
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
return RequestService.GetAll().Where(x => x.Type == RequestType.TvShow);
|
||||
var allResults = await RequestService.GetAllAsync();
|
||||
allResults = allResults.Where(x => x.Type == RequestType.TvShow);
|
||||
|
||||
}).ContinueWith((t) =>
|
||||
{
|
||||
dbTv = t.Result.ToDictionary(x => x.ProviderId);
|
||||
});
|
||||
var dbTv = allResults.ToDictionary(x => x.ProviderId);
|
||||
|
||||
if (!apiTv.Any())
|
||||
{
|
||||
|
@ -366,18 +355,11 @@ namespace PlexRequests.UI.Modules
|
|||
apiAlbums = t.Result.releases ?? new List<Release>();
|
||||
});
|
||||
|
||||
var dbAlbum = new Dictionary<string, RequestedModel>();
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
return RequestService.GetAll().Where(x => x.Type == RequestType.Album);
|
||||
|
||||
}).ContinueWith((t) =>
|
||||
{
|
||||
dbAlbum = t.Result.ToDictionary(x => x.MusicBrainzId);
|
||||
});
|
||||
|
||||
|
||||
var allResults = await RequestService.GetAllAsync();
|
||||
allResults = allResults.Where(x => x.Type == RequestType.Album);
|
||||
|
||||
var dbAlbum = allResults.ToDictionary(x => x.MusicBrainzId);
|
||||
|
||||
var plexAlbums = Checker.GetPlexAlbums();
|
||||
|
||||
var viewAlbum = new List<SearchMusicViewModel>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue