pull/470/head
tidusjar 8 years ago
parent 5a96bd2a15
commit f9af1dc12b

@ -67,16 +67,13 @@ namespace PlexRequests.Api
TimeSpan.FromSeconds(5),
TimeSpan.FromSeconds(10)},
(exception, timespan) => Log.Error(exception, "Exception when calling AddMovie for CP, Retrying {0}", timespan));
Log.Trace("CP movie Add result count {0}", obj.Count);
if (obj.Count > 0)
{
try
{
Log.Trace("CP movie obj[\"success\"] = {0}", obj["success"]);
var result = (bool)obj["success"];
Log.Trace("CP movie Add result {0}", result);
return result;
}
catch (Exception e)
@ -96,7 +93,6 @@ namespace PlexRequests.Api
/// <returns></returns>
public CouchPotatoStatus GetStatus(Uri url, string apiKey)
{
Log.Trace("Getting CP Status, ApiKey = {0}", apiKey);
var request = new RestRequest
{
Resource = "api/{apikey}/app.available/",

@ -170,7 +170,7 @@ namespace PlexRequests.UI.Modules
Post["/sickrage"] = _ => SaveSickrage();
Post["/sonarrprofiles"] = _ => GetSonarrQualityProfiles();
Post["/cpprofiles"] = _ => GetCpProfiles();
Post["/cpprofiles", true] = async (x,ct) => await GetCpProfiles();
Get["/emailnotification"] = _ => EmailNotifications();
Post["/emailnotification"] = _ => SaveEmailNotifications();
@ -673,7 +673,7 @@ namespace PlexRequests.UI.Modules
return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully sent a test Pushover Notification!" });
}
private Response GetCpProfiles()
private async Task<Response> GetCpProfiles()
{
var settings = this.Bind<CouchPotatoSettings>();
var valid = this.Validate(settings);
@ -689,6 +689,10 @@ namespace PlexRequests.UI.Modules
Cache.Set(CacheKeys.CouchPotatoQualityProfiles, profiles);
}
// Save the first profile found (user might not press save...)
settings.ProfileId = profiles?.list?.FirstOrDefault()?._id;
await CpService.SaveSettingsAsync(settings);
return Response.AsJson(profiles);
}

Loading…
Cancel
Save