mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-12 16:13:58 -07:00
Quality config complete (needs to look better, but it is functional, minus deleting).
This commit is contained in:
parent
6d790f8939
commit
2ba6057ec7
6 changed files with 80 additions and 20 deletions
|
@ -127,7 +127,16 @@ namespace NzbDrone.Web.Controllers
|
|||
|
||||
public ViewResult AddUserProfile()
|
||||
{
|
||||
return View("UserProfileSection", new QualityProfile());
|
||||
var qualityTypes = new List<QualityTypes>();
|
||||
|
||||
foreach (QualityTypes qual in Enum.GetValues(typeof(QualityTypes)))
|
||||
{
|
||||
qualityTypes.Add(qual);
|
||||
}
|
||||
|
||||
ViewData["Qualities"] = qualityTypes;
|
||||
|
||||
return View("UserProfileSection", new QualityProfile { Name = "New Profile", UserProfile = true });
|
||||
}
|
||||
|
||||
public ActionResult SubMenu()
|
||||
|
@ -290,6 +299,27 @@ namespace NzbDrone.Web.Controllers
|
|||
try
|
||||
{
|
||||
_configProvider.SetValue("DefaultQualityProfile", data.DefaultProfileId.ToString());
|
||||
|
||||
foreach (var profile in data.UserProfiles)
|
||||
{
|
||||
profile.Allowed = new List<QualityTypes>();
|
||||
foreach (var quality in profile.AllowedString.Split(','))
|
||||
{
|
||||
var qType = (QualityTypes)Enum.Parse(typeof (QualityTypes), quality);
|
||||
profile.Allowed.Add(qType);
|
||||
}
|
||||
|
||||
//If the Cutoff value selected is not in the allowed list then use the last allowed value, this should be validated on submit
|
||||
if (!profile.Allowed.Contains(profile.Cutoff))
|
||||
profile.Cutoff = profile.Allowed.Last();
|
||||
|
||||
if (profile.ProfileId > 0)
|
||||
_qualityProvider.Update(profile);
|
||||
|
||||
else
|
||||
_qualityProvider.Add(profile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue