mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Quality config complete (needs to look better, but it is functional, minus deleting).
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user