mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
#114 first pass at choosing quality profile when approving + focus search input by default and when switching tabs
This commit is contained in:
commit
08b14d0164
13 changed files with 223 additions and 131 deletions
|
@ -43,7 +43,7 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
|
||||
public ApplicationTesterModule(ICouchPotatoApi cpApi, ISonarrApi sonarrApi, IPlexApi plexApi,
|
||||
ISettingsService<AuthenticationSettings> authSettings, ISickRageApi srApi) : base("test")
|
||||
ISettingsService<AuthenticationSettings> authSettings, ISickRageApi srApi, IHeadphonesApi hpApi) : base("test")
|
||||
{
|
||||
this.RequiresAuthentication();
|
||||
|
||||
|
@ -52,6 +52,7 @@ namespace PlexRequests.UI.Modules
|
|||
PlexApi = plexApi;
|
||||
AuthSettings = authSettings;
|
||||
SickRageApi = srApi;
|
||||
HeadphonesApi = hpApi;
|
||||
|
||||
Post["/cp"] = _ => CouchPotatoTest();
|
||||
Post["/sonarr"] = _ => SonarrTest();
|
||||
|
@ -66,6 +67,7 @@ namespace PlexRequests.UI.Modules
|
|||
private ICouchPotatoApi CpApi { get; }
|
||||
private IPlexApi PlexApi { get; }
|
||||
private ISickRageApi SickRageApi { get; }
|
||||
private IHeadphonesApi HeadphonesApi { get; }
|
||||
private ISettingsService<AuthenticationSettings> AuthSettings { get; }
|
||||
|
||||
private Response CouchPotatoTest()
|
||||
|
@ -172,7 +174,32 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
private Response HeadphonesTest()
|
||||
{
|
||||
throw new NotImplementedException(); //TODO
|
||||
var settings = this.Bind<HeadphonesSettings>();
|
||||
try
|
||||
{
|
||||
var result = HeadphonesApi.GetVersion(settings.ApiKey, settings.FullUri);
|
||||
if (!string.IsNullOrEmpty(result.latest_version))
|
||||
{
|
||||
return
|
||||
Response.AsJson(new JsonResponseModel
|
||||
{
|
||||
Result = true,
|
||||
Message = "Connected to Headphones successfully!"
|
||||
});
|
||||
}
|
||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Could not connect to Headphones, please check your settings." });
|
||||
}
|
||||
catch (ApplicationException e)
|
||||
{
|
||||
Log.Warn("Exception thrown when attempting to get Headphones's status: ");
|
||||
Log.Warn(e);
|
||||
var message = $"Could not connect to Headphones, please check your settings. <strong>Exception Message:</strong> {e.Message}";
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
message = $"Could not connect to Headphones, please check your settings. <strong>Exception Message:</strong> {e.InnerException.Message}";
|
||||
}
|
||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = message }); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -503,6 +503,9 @@ namespace PlexRequests.UI.Modules
|
|||
Log.Trace("CoverArt Details:");
|
||||
Log.Trace(img.DumpJson());
|
||||
|
||||
DateTime release;
|
||||
DateTimeHelper.CustomParse(albumInfo.ReleaseEvents?.FirstOrDefault()?.date, out release);
|
||||
|
||||
var model = new RequestedModel
|
||||
{
|
||||
Title = albumInfo.title,
|
||||
|
@ -513,7 +516,10 @@ namespace PlexRequests.UI.Modules
|
|||
ProviderId = 0,
|
||||
RequestedUsers = new List<string>() { Username },
|
||||
Status = albumInfo.status,
|
||||
Issues = IssueState.None
|
||||
Issues = IssueState.None,
|
||||
RequestedDate = DateTime.UtcNow,
|
||||
ReleaseDate = release,
|
||||
// Artist = albumInfo.
|
||||
};
|
||||
|
||||
|
||||
|
@ -580,4 +586,4 @@ namespace PlexRequests.UI.Modules
|
|||
return img;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue