pull/332/head
tidusjar 9 years ago
parent 9ffe184dd3
commit 41b439d3bb

@ -27,11 +27,15 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace PlexRequests.Api.Models.Movie namespace PlexRequests.Api.Models.Movie
{ {
public class ProfileList public class ProfileList
{ {
public bool core { get; set; } public bool core { get; set; }
public bool hide { get; set; }
public string _rev { get; set; } public string _rev { get; set; }
public List<bool> finish { get; set; } public List<bool> finish { get; set; }
public List<string> qualities { get; set; } public List<string> qualities { get; set; }
@ -42,7 +46,8 @@ namespace PlexRequests.Api.Models.Movie
public List<int> stop_after { get; set; } public List<int> stop_after { get; set; }
public List<int> wait_for { get; set; } public List<int> wait_for { get; set; }
public int order { get; set; } public int order { get; set; }
public List<object> __invalid_name__3d { get; set; } [JsonProperty(PropertyName = "3d")]
public List<object> threeD { get; set; }
} }
public class CouchPotatoProfiles public class CouchPotatoProfiles

@ -143,8 +143,8 @@ namespace PlexRequests.Api
request.AddUrlSegment("status", string.Join(",", status)); request.AddUrlSegment("status", string.Join(",", status));
try try
{ {
var obj = RetryHandler.Execute<CouchPotatoMovies>(() => Api.Execute<CouchPotatoMovies> (request, baseUrl), var obj = RetryHandler.Execute(() => Api.Execute<CouchPotatoMovies> (request, baseUrl),
new TimeSpan[] { new[] {
TimeSpan.FromSeconds (5), TimeSpan.FromSeconds (5),
TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10),
TimeSpan.FromSeconds(30) TimeSpan.FromSeconds(30)

@ -44,6 +44,8 @@ using System.Collections.Generic;
using PlexRequests.Api.Interfaces; using PlexRequests.Api.Interfaces;
using System.Threading.Tasks; using System.Threading.Tasks;
using NLog;
namespace PlexRequests.UI.Modules namespace PlexRequests.UI.Modules
{ {
public class RequestsModule : BaseAuthModule public class RequestsModule : BaseAuthModule
@ -87,6 +89,7 @@ namespace PlexRequests.UI.Modules
Post["/addnote", true] = async (x, ct) => await AddNote((int)Request.Form.requestId, (string)Request.Form.noteArea); Post["/addnote", true] = async (x, ct) => await AddNote((int)Request.Form.requestId, (string)Request.Form.noteArea);
} }
private static Logger Log = LogManager.GetCurrentClassLogger();
private IRequestService Service { get; } private IRequestService Service { get; }
private INotificationService NotificationService { get; } private INotificationService NotificationService { get; }
private ISettingsService<PlexRequestSettings> PrSettings { get; } private ISettingsService<PlexRequestSettings> PrSettings { get; }
@ -126,13 +129,20 @@ namespace PlexRequests.UI.Modules
var cpSettings = CpSettings.GetSettings(); var cpSettings = CpSettings.GetSettings();
if (cpSettings.Enabled) if (cpSettings.Enabled)
{ {
try
var result = await Cache.GetOrSetAsync(CacheKeys.CouchPotatoQualityProfiles, async () =>
{ {
return await Task.Run(() => CpApi.GetProfiles(cpSettings.FullUri, cpSettings.ApiKey)).ConfigureAwait(false); var result = await Cache.GetOrSetAsync(CacheKeys.CouchPotatoQualityProfiles, async () =>
}); {
return await Task.Run(() => CpApi.GetProfiles(cpSettings.FullUri, cpSettings.ApiKey)).ConfigureAwait(false);
});
qualities = result.list.Select(x => new QualityModel() { Id = x._id, Name = x.label }).ToList();
qualities = result.list.Select(x => new QualityModel() { Id = x._id, Name = x.label }).ToList(); }
catch (Exception e)
{
Log.Info(e);
}
} }
} }

Loading…
Cancel
Save