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).
pull/6/head
markus101 14 years ago
parent 48e5b36936
commit d083d653db

@ -281,7 +281,8 @@ namespace NzbDrone.Core
//Add or Update SDTV
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));
repository.Add(sdtv);
@ -290,12 +291,14 @@ namespace NzbDrone.Core
else
{
Logger.Debug(String.Format("Updating default QualityProfile: {0}", sdtv.Name));
sdtv.ProfileId = sdtvDb.ProfileId;
repository.Update(sdtv);
}
//Add or Update DVD
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));
repository.Add(dvd);
@ -304,12 +307,14 @@ namespace NzbDrone.Core
else
{
Logger.Debug(String.Format("Updating default QualityProfile: {0}", dvd.Name));
dvd.ProfileId = dvdDb.ProfileId;
repository.Update(dvd);
}
//Add or Update BDRip
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));
repository.Add(bdrip);
@ -318,12 +323,14 @@ namespace NzbDrone.Core
else
{
Logger.Debug(String.Format("Updating default QualityProfile: {0}", bdrip.Name));
bdrip.ProfileId = bdripDb.ProfileId;
repository.Update(bdrip);
}
//Add or Update HDTV
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));
repository.Add(hdtv);
@ -332,12 +339,14 @@ namespace NzbDrone.Core
else
{
Logger.Debug(String.Format("Updating default QualityProfile: {0}", hdtv.Name));
hdtv.ProfileId = hdtvDb.ProfileId;
repository.Update(hdtv);
}
//Add or Update WEBDL
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));
repository.Add(webdl);
@ -346,12 +355,14 @@ namespace NzbDrone.Core
else
{
Logger.Debug(String.Format("Updating default QualityProfile: {0}", webdl.Name));
webdl.ProfileId = webdlDb.ProfileId;
repository.Update(webdl);
}
//Add or Update Bluray
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));
repository.Add(bluray);
@ -360,6 +371,7 @@ namespace NzbDrone.Core
else
{
Logger.Debug(String.Format("Updating default QualityProfile: {0}", bluray.Name));
bluray.ProfileId = blurayDb.ProfileId;
repository.Update(bluray);
}
}

@ -12,5 +12,6 @@ namespace NzbDrone.Core.Providers
void Update(QualityProfile profile);
void Delete(int profileId);
List<QualityProfile> GetAllProfiles();
QualityProfile Find(int profileId);
}
}

@ -48,6 +48,11 @@ namespace NzbDrone.Core.Providers
return profiles;
}
public QualityProfile Find(int profileId)
{
return _sonicRepo.Single<QualityProfile>(q => q.ProfileId == profileId);
}
#endregion
}
}

@ -21,19 +21,19 @@ namespace NzbDrone.Core.Repository.Quality
/// <summary>
/// SD File (HD Source)
/// </summary>
BDRip = 2,
BDRip = 3,
/// <summary>
/// HD File (HDTV Source)
/// </summary>
HDTV = 3,
HDTV = 4,
/// <summary>
/// HD File (Online Source)
/// </summary>
WEBDL = 4,
WEBDL = 5,
/// <summary>
/// HD File (Blu-ray Source could be 1080p or 720p)
/// </summary>
Bluray = 5,
Bluray = 6,
}
}

@ -215,13 +215,13 @@ input[type="text"]:hover
background: #ff6;
}
.submitButton
.button
{
border: 1px solid #006;
background: #ccf;
}
.submitButton:hover
.button:hover
{
border: 1px solid #f00;
background: #eef;

@ -5,7 +5,8 @@ using System.Threading;
using System.Web;
using System.Web.Mvc;
using NLog;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository.Quality;
using NzbDrone.Web.Models;
namespace NzbDrone.Web.Controllers
@ -98,9 +99,26 @@ namespace NzbDrone.Web.Controllers
ViewData["viewName"] = "Quality";
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);
}
@ -264,9 +282,9 @@ namespace NzbDrone.Web.Controllers
{
try
{
_configProvider.SetValue("DefaultQualityProfile", data.DefaultProfileId.ToString());
}
catch (Exception e)
{
Logger.ErrorException(e.Message, e);

@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NzbDrone.Core.Repository.Quality;
namespace NzbDrone.Web.Models
@ -10,5 +12,11 @@ namespace NzbDrone.Web.Models
{
public List<QualityProfile> Profiles { 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" }))
{%>
<%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>
<div id="dropdown1">
<ul>
<li>Quality</li>
<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 />
<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>
<br />
<input type="submit" class="button" value="Save" />
</fieldset>
<%}%>
<div id="result"></div>
Loading…
Cancel
Save