-
-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The beginning of grabbing Sonarr root folders and approving requests with sepecific root folders #535
The beginning of grabbing Sonarr root folders and approving requests with sepecific root folders #535
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,6 +186,37 @@ private async Task<Response> GetTvShows() | |
|
||
} | ||
|
||
IEnumerable<RootFolderModel> rootFolders = new List<RootFolderModel>(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This module is not being used yet just a FYI, there is no code being used in this class There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I figured as much, I just copied what I wrote in the RequestModule.cs :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @onedr0p Ok that's fine :) |
||
if (IsAdmin) | ||
{ | ||
try | ||
{ | ||
var sonarrSettings = await SonarrSettings.GetSettingsAsync(); | ||
if (sonarrSettings.Enabled) | ||
{ | ||
var result = Cache.GetOrSetAsync(CacheKeys.SonarrRootFolders, async () => | ||
{ | ||
return await Task.Run(() => SonarrApi.GetRootFolders(sonarrSettings.ApiKey, sonarrSettings.FullUri)); | ||
}); | ||
rootFolders = result.Result.Select(x => new RootFolderModel { Id = x.id.ToString(), Path = x.path }).ToList(); | ||
} | ||
// @TODO Sick Rage Root Folders | ||
//else | ||
//{ | ||
// var sickRageSettings = await SickRageSettings.GetSettingsAsync(); | ||
// 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 => new RequestViewModel | ||
{ | ||
ProviderId = tv.ProviderId, | ||
|
@@ -209,6 +240,7 @@ private async Task<Response> GetTvShows() | |
IssueId = tv.IssueId, | ||
TvSeriesRequestType = tv.SeasonsRequested, | ||
Qualities = qualities.ToArray(), | ||
RootFolders = rootFolders.ToArray(), | ||
Episodes = tv.Episodes.ToArray(), | ||
}).ToList(); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing the validation in the Javascript, you can check if the binding is valid. There are a bunch of validators e.g. SonarrSettingsValidator (If you look at some of the POST requests you should be able to see how we validate, and when there is invalid data we return the invalid message)