mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-04-24 22:37:06 -04:00
Fixed updating of Default Qualities in CentralDispatch.
Default Quality can now be set through Settings/Quality using a drop down list. Fixed QualityType for BDRip (was sharing a value with DVD).
This commit is contained in:
parent
48e5b36936
commit
d083d653db
8 changed files with 75 additions and 42 deletions
|
@ -281,7 +281,8 @@ namespace NzbDrone.Core
|
||||||
|
|
||||||
//Add or Update SDTV
|
//Add or Update SDTV
|
||||||
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", sdtv.Name));
|
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", sdtv.Name));
|
||||||
if (!repository.Exists<QualityProfile>(i => i.Name == sdtv.Name))
|
var sdtvDb = repository.Single<QualityProfile>(i => i.Name == sdtv.Name);
|
||||||
|
if (sdtvDb == null)
|
||||||
{
|
{
|
||||||
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", sdtv.Name));
|
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", sdtv.Name));
|
||||||
repository.Add(sdtv);
|
repository.Add(sdtv);
|
||||||
|
@ -290,12 +291,14 @@ namespace NzbDrone.Core
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Debug(String.Format("Updating default QualityProfile: {0}", sdtv.Name));
|
Logger.Debug(String.Format("Updating default QualityProfile: {0}", sdtv.Name));
|
||||||
|
sdtv.ProfileId = sdtvDb.ProfileId;
|
||||||
repository.Update(sdtv);
|
repository.Update(sdtv);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add or Update DVD
|
//Add or Update DVD
|
||||||
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", dvd.Name));
|
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", dvd.Name));
|
||||||
if (!repository.Exists<QualityProfile>(i => i.Name == dvd.Name))
|
var dvdDb = repository.Single<QualityProfile>(i => i.Name == dvd.Name);
|
||||||
|
if (dvdDb == null)
|
||||||
{
|
{
|
||||||
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", dvd.Name));
|
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", dvd.Name));
|
||||||
repository.Add(dvd);
|
repository.Add(dvd);
|
||||||
|
@ -304,12 +307,14 @@ namespace NzbDrone.Core
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Debug(String.Format("Updating default QualityProfile: {0}", dvd.Name));
|
Logger.Debug(String.Format("Updating default QualityProfile: {0}", dvd.Name));
|
||||||
|
dvd.ProfileId = dvdDb.ProfileId;
|
||||||
repository.Update(dvd);
|
repository.Update(dvd);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add or Update BDRip
|
//Add or Update BDRip
|
||||||
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", bdrip.Name));
|
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", bdrip.Name));
|
||||||
if (!repository.Exists<QualityProfile>(i => i.Name == bdrip.Name))
|
var bdripDb = repository.Single<QualityProfile>(i => i.Name == bdrip.Name);
|
||||||
|
if (bdripDb == null)
|
||||||
{
|
{
|
||||||
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", bdrip.Name));
|
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", bdrip.Name));
|
||||||
repository.Add(bdrip);
|
repository.Add(bdrip);
|
||||||
|
@ -318,12 +323,14 @@ namespace NzbDrone.Core
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Debug(String.Format("Updating default QualityProfile: {0}", bdrip.Name));
|
Logger.Debug(String.Format("Updating default QualityProfile: {0}", bdrip.Name));
|
||||||
|
bdrip.ProfileId = bdripDb.ProfileId;
|
||||||
repository.Update(bdrip);
|
repository.Update(bdrip);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add or Update HDTV
|
//Add or Update HDTV
|
||||||
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", hdtv.Name));
|
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", hdtv.Name));
|
||||||
if (!repository.Exists<QualityProfile>(i => i.Name == hdtv.Name))
|
var hdtvDb = repository.Single<QualityProfile>(i => i.Name == hdtv.Name);
|
||||||
|
if (hdtvDb == null)
|
||||||
{
|
{
|
||||||
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", hdtv.Name));
|
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", hdtv.Name));
|
||||||
repository.Add(hdtv);
|
repository.Add(hdtv);
|
||||||
|
@ -332,12 +339,14 @@ namespace NzbDrone.Core
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Debug(String.Format("Updating default QualityProfile: {0}", hdtv.Name));
|
Logger.Debug(String.Format("Updating default QualityProfile: {0}", hdtv.Name));
|
||||||
|
hdtv.ProfileId = hdtvDb.ProfileId;
|
||||||
repository.Update(hdtv);
|
repository.Update(hdtv);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add or Update WEBDL
|
//Add or Update WEBDL
|
||||||
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", webdl.Name));
|
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", webdl.Name));
|
||||||
if (!repository.Exists<QualityProfile>(i => i.Name == webdl.Name))
|
var webdlDb = repository.Single<QualityProfile>(i => i.Name == webdl.Name);
|
||||||
|
if (webdlDb == null)
|
||||||
{
|
{
|
||||||
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", webdl.Name));
|
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", webdl.Name));
|
||||||
repository.Add(webdl);
|
repository.Add(webdl);
|
||||||
|
@ -346,12 +355,14 @@ namespace NzbDrone.Core
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Debug(String.Format("Updating default QualityProfile: {0}", webdl.Name));
|
Logger.Debug(String.Format("Updating default QualityProfile: {0}", webdl.Name));
|
||||||
|
webdl.ProfileId = webdlDb.ProfileId;
|
||||||
repository.Update(webdl);
|
repository.Update(webdl);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add or Update Bluray
|
//Add or Update Bluray
|
||||||
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", bluray.Name));
|
Logger.Debug(String.Format("Checking for default QualityProfile: {0}", bluray.Name));
|
||||||
if (!repository.Exists<QualityProfile>(i => i.Name == bluray.Name))
|
var blurayDb = repository.Single<QualityProfile>(i => i.Name == bluray.Name);
|
||||||
|
if (blurayDb == null)
|
||||||
{
|
{
|
||||||
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", bluray.Name));
|
Logger.Debug(String.Format("Adding new default QualityProfile: {0}", bluray.Name));
|
||||||
repository.Add(bluray);
|
repository.Add(bluray);
|
||||||
|
@ -360,6 +371,7 @@ namespace NzbDrone.Core
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Debug(String.Format("Updating default QualityProfile: {0}", bluray.Name));
|
Logger.Debug(String.Format("Updating default QualityProfile: {0}", bluray.Name));
|
||||||
|
bluray.ProfileId = blurayDb.ProfileId;
|
||||||
repository.Update(bluray);
|
repository.Update(bluray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,6 @@ namespace NzbDrone.Core.Providers
|
||||||
void Update(QualityProfile profile);
|
void Update(QualityProfile profile);
|
||||||
void Delete(int profileId);
|
void Delete(int profileId);
|
||||||
List<QualityProfile> GetAllProfiles();
|
List<QualityProfile> GetAllProfiles();
|
||||||
|
QualityProfile Find(int profileId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,11 @@ namespace NzbDrone.Core.Providers
|
||||||
return profiles;
|
return profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public QualityProfile Find(int profileId)
|
||||||
|
{
|
||||||
|
return _sonicRepo.Single<QualityProfile>(q => q.ProfileId == profileId);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,19 +21,19 @@ namespace NzbDrone.Core.Repository.Quality
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SD File (HD Source)
|
/// SD File (HD Source)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BDRip = 2,
|
BDRip = 3,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// HD File (HDTV Source)
|
/// HD File (HDTV Source)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
HDTV = 3,
|
HDTV = 4,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// HD File (Online Source)
|
/// HD File (Online Source)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
WEBDL = 4,
|
WEBDL = 5,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// HD File (Blu-ray Source could be 1080p or 720p)
|
/// HD File (Blu-ray Source could be 1080p or 720p)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Bluray = 5,
|
Bluray = 6,
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -215,13 +215,13 @@ input[type="text"]:hover
|
||||||
background: #ff6;
|
background: #ff6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.submitButton
|
.button
|
||||||
{
|
{
|
||||||
border: 1px solid #006;
|
border: 1px solid #006;
|
||||||
background: #ccf;
|
background: #ccf;
|
||||||
}
|
}
|
||||||
|
|
||||||
.submitButton:hover
|
.button:hover
|
||||||
{
|
{
|
||||||
border: 1px solid #f00;
|
border: 1px solid #f00;
|
||||||
background: #eef;
|
background: #eef;
|
||||||
|
|
|
@ -5,7 +5,8 @@ using System.Threading;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
using NzbDrone.Core.Repository.Quality;
|
||||||
using NzbDrone.Web.Models;
|
using NzbDrone.Web.Models;
|
||||||
|
|
||||||
namespace NzbDrone.Web.Controllers
|
namespace NzbDrone.Web.Controllers
|
||||||
|
@ -98,9 +99,26 @@ namespace NzbDrone.Web.Controllers
|
||||||
ViewData["viewName"] = "Quality";
|
ViewData["viewName"] = "Quality";
|
||||||
|
|
||||||
var userProfiles = _qualityProvider.GetAllProfiles().Where(q => q.UserProfile).ToList();
|
var userProfiles = _qualityProvider.GetAllProfiles().Where(q => q.UserProfile).ToList();
|
||||||
var profiles = _qualityProvider.GetAllProfiles().Where(q => q.UserProfile == false).ToList();
|
var profiles = _qualityProvider.GetAllProfiles().ToList();
|
||||||
|
var qualityTypes = new List<QualityTypes>();
|
||||||
|
|
||||||
QualityModel model = new QualityModel {Profiles = profiles, UserProfiles = userProfiles};
|
foreach (QualityTypes qual in Enum.GetValues(typeof(QualityTypes)))
|
||||||
|
{
|
||||||
|
qualityTypes.Add(qual);
|
||||||
|
}
|
||||||
|
|
||||||
|
var defaultQualityProfileId = Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", profiles[0].ProfileId, true));
|
||||||
|
|
||||||
|
var selectList = new SelectList(profiles, "ProfileId", "Name");
|
||||||
|
|
||||||
|
var model = new QualityModel
|
||||||
|
{
|
||||||
|
Profiles = profiles,
|
||||||
|
UserProfiles = userProfiles,
|
||||||
|
Qualities = qualityTypes,
|
||||||
|
DefaultProfileId = defaultQualityProfileId,
|
||||||
|
SelectList = selectList
|
||||||
|
};
|
||||||
|
|
||||||
return View("Index", model);
|
return View("Index", model);
|
||||||
}
|
}
|
||||||
|
@ -264,9 +282,9 @@ namespace NzbDrone.Web.Controllers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
_configProvider.SetValue("DefaultQualityProfile", data.DefaultProfileId.ToString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.ErrorException(e.Message, e);
|
Logger.ErrorException(e.Message, e);
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
using NzbDrone.Core.Repository.Quality;
|
using NzbDrone.Core.Repository.Quality;
|
||||||
|
|
||||||
namespace NzbDrone.Web.Models
|
namespace NzbDrone.Web.Models
|
||||||
|
@ -10,5 +12,11 @@ namespace NzbDrone.Web.Models
|
||||||
{
|
{
|
||||||
public List<QualityProfile> Profiles { get; set; }
|
public List<QualityProfile> Profiles { get; set; }
|
||||||
public List<QualityProfile> UserProfiles { get; set; }
|
public List<QualityProfile> UserProfiles { get; set; }
|
||||||
|
public List<QualityTypes> Qualities { get; set; }
|
||||||
|
|
||||||
|
[DisplayName("Default Quality Profile")]
|
||||||
|
public int DefaultProfileId { get; set; }
|
||||||
|
|
||||||
|
public SelectList SelectList { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -60,32 +60,21 @@
|
||||||
|
|
||||||
<% using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new { id = "form", name = "form" }))
|
<% using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new { id = "form", name = "form" }))
|
||||||
{%>
|
{%>
|
||||||
<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>
|
<fieldset>
|
||||||
|
<legend>Indexers</legend>
|
||||||
|
<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>
|
||||||
|
|
||||||
|
<div class="editor-label">
|
||||||
|
<%= Html.LabelFor(m => m.DefaultProfileId) %>
|
||||||
|
</div>
|
||||||
|
<div class="editor-field">
|
||||||
|
<%: Html.DropDownListFor(m => m.DefaultProfileId, Model.SelectList)%>
|
||||||
|
<%= Html.ValidationMessageFor(m => m.DefaultProfileId)%>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="dropdown1">
|
<br />
|
||||||
<ul>
|
<input type="submit" class="button" value="Save" />
|
||||||
<li>Quality</li>
|
</fieldset>
|
||||||
<li>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#">Argentina</a></li>
|
|
||||||
<li><a href="#">Brazil</a></li>
|
|
||||||
<li><a href="#">Uruguay</a></li>
|
|
||||||
<li><a href="#">France</a></li>
|
|
||||||
<li><a href="#">United Kingdon</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
|
|
||||||
<%}%>
|
<%}%>
|
||||||
<div id="result"></div>
|
<div id="result"></div>
|
Loading…
Add table
Add a link
Reference in a new issue