From a003068869565b22f5cdc91c8a934ab4459b45a8 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Thu, 2 Jun 2016 14:13:21 +0100 Subject: [PATCH] Done the same for TV --- PlexRequests.UI/Modules/RequestsModule.cs | 32 ++++++++++++++--------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/PlexRequests.UI/Modules/RequestsModule.cs b/PlexRequests.UI/Modules/RequestsModule.cs index cbb9e1524..54d28d708 100644 --- a/PlexRequests.UI/Modules/RequestsModule.cs +++ b/PlexRequests.UI/Modules/RequestsModule.cs @@ -190,23 +190,31 @@ namespace PlexRequests.UI.Modules IEnumerable qualities = new List(); if (IsAdmin) { - var sonarrSettings = SonarrSettings.GetSettings(); - if (sonarrSettings.Enabled) + try { - var result = Cache.GetOrSetAsync(CacheKeys.SonarrQualityProfiles, async () => + var sonarrSettings = SonarrSettings.GetSettings(); + if (sonarrSettings.Enabled) { - return await Task.Run(() => SonarrApi.GetProfiles(sonarrSettings.ApiKey, sonarrSettings.FullUri)); - }); - qualities = result.Result.Select(x => new QualityModel() { Id = x.id.ToString(), Name = x.name }).ToList(); - } - else - { - var sickRageSettings = SickRageSettings.GetSettings(); - if (sickRageSettings.Enabled) + var result = Cache.GetOrSetAsync(CacheKeys.SonarrQualityProfiles, async () => + { + return await Task.Run(() => SonarrApi.GetProfiles(sonarrSettings.ApiKey, sonarrSettings.FullUri)); + }); + qualities = result.Result.Select(x => new QualityModel() { Id = x.id.ToString(), Name = x.name }).ToList(); + } + else { - qualities = sickRageSettings.Qualities.Select(x => new QualityModel() { Id = x.Key, Name = x.Value }).ToList(); + var sickRageSettings = SickRageSettings.GetSettings(); + if (sickRageSettings.Enabled) + { + qualities = sickRageSettings.Qualities.Select(x => new QualityModel() { Id = x.Key, Name = x.Value }).ToList(); + } } } + catch (Exception e) + { + Log.Info(e); + } + } var viewModel = dbTv.Select(tv =>