EpisodeSorting UI has descriptions, removed extra options.

Config for EpisodeSorting variables added.
This commit is contained in:
Mark McDowall 2011-05-18 16:10:25 -07:00
parent d6ae21506c
commit 0645a9e552
4 changed files with 116 additions and 51 deletions

View File

@ -188,6 +188,30 @@ namespace NzbDrone.Core.Providers.Core
set { SetValue("BlackholeDirectory", value); } set { SetValue("BlackholeDirectory", value); }
} }
public virtual bool SeriesName
{
get { return GetValueBoolean("Sorting_SeriesName", true); }
set { SetValue("Sorting_SeriesName", value); }
}
public virtual bool EpisodeName
{
get { return GetValueBoolean("Sorting_EpisodeName", true); }
set { SetValue("Sorting_EpisodeName", value); }
}
public virtual bool ReplaceSpaces
{
get { return GetValueBoolean("Sorting_ReplaceSpaces", true); }
set { SetValue("Sorting_ReplaceSpaces", value); }
}
public virtual bool AppendQuality
{
get { return GetValueBoolean("Sorting_AppendQaulity", true); }
set { SetValue("Sorting_AppendQaulity", value); }
}
public virtual bool UseSeasonFolder public virtual bool UseSeasonFolder
{ {
get { return GetValueBoolean("Sorting_SeasonFolder", true); } get { return GetValueBoolean("Sorting_SeasonFolder", true); }
@ -195,6 +219,30 @@ namespace NzbDrone.Core.Providers.Core
set { SetValue("Sorting_SeasonFolder", value); } set { SetValue("Sorting_SeasonFolder", value); }
} }
public virtual string SeasonFolderFormat
{
get { return GetValue("Sorting_SeasonFolderFormat", "Season %s", false); }
set { SetValue("Sorting_SeasonFolderFormat", value); }
}
public virtual int SeparatorStyle
{
get { return GetValueInt("Sorting_SeparatorStyle"); }
set { SetValue("Sorting_SeparatorStyle", value); }
}
public virtual int NumberStyle
{
get { return GetValueInt("Sorting_NumberStyle", 2); }
set { SetValue("Sorting_NumberStyle", value); }
}
public virtual int MultiEpisodeStyle
{
get { return GetValueInt("Sorting_MultiEpisodeStyle"); }
set { SetValue("Sorting_MultiEpisodeStyle", value); }
}
public virtual int DefaultQualityProfile public virtual int DefaultQualityProfile
{ {
get { return GetValueInt("DefaultQualityProfile", 1); } get { return GetValueInt("DefaultQualityProfile", 1); }

View File

@ -182,16 +182,15 @@ namespace NzbDrone.Web.Controllers
var model = new EpisodeSortingModel(); var model = new EpisodeSortingModel();
model.ShowName = Convert.ToBoolean(_configProvider.GetValue("Sorting_ShowName", true, true)); model.SeriesName = _configProvider.SeriesName;
model.EpisodeName = Convert.ToBoolean(_configProvider.GetValue("Sorting_EpisodeName", true, true)); model.EpisodeName = _configProvider.EpisodeName;
model.ReplaceSpaces = Convert.ToBoolean(_configProvider.GetValue("Sorting_ReplaceSpaces", false, true)); model.ReplaceSpaces = _configProvider.ReplaceSpaces;
model.AppendQuality = Convert.ToBoolean(_configProvider.GetValue("Sorting_AppendQuality", false, true)); model.AppendQuality = _configProvider.AppendQuality;
model.UseAirByDate = Convert.ToBoolean(_configProvider.GetValue("Sorting_UseAirByDate", true, true));
model.SeasonFolders = _configProvider.UseSeasonFolder; model.SeasonFolders = _configProvider.UseSeasonFolder;
model.SeasonFolderFormat = _configProvider.GetValue("Sorting_SeasonFolderFormat", "Season %s", true); model.SeasonFolderFormat = _configProvider.SeasonFolderFormat;
model.SeparatorStyle = Convert.ToInt32(_configProvider.GetValue("Sorting_SeparatorStyle", 0, true)); model.SeparatorStyle = _configProvider.SeparatorStyle;
model.NumberStyle = Convert.ToInt32(_configProvider.GetValue("Sorting_NumberStyle", 2, true)); model.NumberStyle = _configProvider.NumberStyle;
model.MultiEpisodeStyle = Convert.ToInt32(_configProvider.GetValue("Sorting_MultiEpisodeStyle", 0, true)); model.MultiEpisodeStyle = _configProvider.MultiEpisodeStyle;
model.SeparatorStyles = new SelectList(EpisodeSortingHelper.GetSeparatorStyles(), "Id", "Name"); model.SeparatorStyles = new SelectList(EpisodeSortingHelper.GetSeparatorStyles(), "Id", "Name");
model.NumberStyles = new SelectList(EpisodeSortingHelper.GetNumberStyles(), "Id", "Name"); model.NumberStyles = new SelectList(EpisodeSortingHelper.GetNumberStyles(), "Id", "Name");
@ -535,16 +534,15 @@ namespace NzbDrone.Web.Controllers
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
_configProvider.SetValue("Sorting_ShowName", data.ShowName.ToString()); _configProvider.SeriesName = data.SeriesName;
_configProvider.SetValue("Sorting_EpisodeName", data.EpisodeName.ToString()); _configProvider.EpisodeName = data.EpisodeName;
_configProvider.SetValue("Sorting_ReplaceSpaces", data.ReplaceSpaces.ToString()); _configProvider.ReplaceSpaces = data.ReplaceSpaces;
_configProvider.SetValue("Sorting_AppendQuality", data.AppendQuality.ToString()); _configProvider.AppendQuality = data.AppendQuality;
_configProvider.SetValue("Sorting_UseAirByDate", data.UseAirByDate.ToString()); _configProvider.UseSeasonFolder = data.SeasonFolders;
_configProvider.SetValue("Sorting_SeasonFolder", data.SeasonFolders.ToString()); _configProvider.SeasonFolderFormat = data.SeasonFolderFormat;
_configProvider.SetValue("Sorting_SeasonFolderFormat", data.SeasonFolderFormat); _configProvider.SeparatorStyle = data.SeparatorStyle;
_configProvider.SetValue("Sorting_SeparatorStyle", data.SeparatorStyle.ToString()); _configProvider.NumberStyle = data.NumberStyle;
_configProvider.SetValue("Sorting_NumberStyle", data.NumberStyle.ToString()); _configProvider.MultiEpisodeStyle = data.MultiEpisodeStyle;
_configProvider.SetValue("Sorting_MultiEpisodeStyle", data.MultiEpisodeStyle.ToString());
basicNotification.Title = SETTINGS_SAVED; basicNotification.Title = SETTINGS_SAVED;
_notificationProvider.Register(basicNotification); _notificationProvider.Register(basicNotification);

View File

@ -6,36 +6,41 @@ namespace NzbDrone.Web.Models
{ {
public class EpisodeSortingModel public class EpisodeSortingModel
{ {
[DisplayName("Show Name")] [DisplayName("Series Name")]
public bool ShowName { get; set; } [Description("Should filenames contain the series name when renamed?")]
public bool SeriesName { get; set; }
[DisplayName("Episode Name")] [DisplayName("Episode Name")]
[Description("Should filenames contain the episode name when renamed?")]
public bool EpisodeName { get; set; } public bool EpisodeName { get; set; }
[DisplayName("Replace Spaces")] [DisplayName("Replace Spaces")]
[Description("Do you want to replace spaces in the filename with periods?")]
public bool ReplaceSpaces { get; set; } public bool ReplaceSpaces { get; set; }
[DisplayName("Append Quality")] [DisplayName("Append Quality")]
[Description("Should filenames have the quality appended to the end?")]
public bool AppendQuality { get; set; } public bool AppendQuality { get; set; }
[DisplayName("Use Air By Date")]
public bool UseAirByDate { get; set; }
[DisplayName("Use Season Folders")] [DisplayName("Use Season Folders")]
[Description("Should files be stored in season folders?")]
public bool SeasonFolders { get; set; } public bool SeasonFolders { get; set; }
[DisplayName("Season Folder Format")] [DisplayName("Season Folder Format")]
[DisplayFormat(ConvertEmptyStringToNull = false)] [DisplayFormat(ConvertEmptyStringToNull = false)]
[Display(Description = "This is a Description")] [Description("How should season folders be named? (Use %0s to pad to two digits)")]
public string SeasonFolderFormat { get; set; } public string SeasonFolderFormat { get; set; }
[DisplayName("Separator Style")] [DisplayName("Separator Style")]
[Description("How should NzbDrone separate sections of the filename?")]
public int SeparatorStyle { get; set; } public int SeparatorStyle { get; set; }
[DisplayName("Numbering Style")] [DisplayName("Numbering Style")]
[Description("What numbering style do you want?")]
public int NumberStyle { get; set; } public int NumberStyle { get; set; }
[DisplayName("Multi-Episode Style")] [DisplayName("Multi-Episode Style")]
[Description("How will multi-episode files be named?")]
public int MultiEpisodeStyle { get; set; } public int MultiEpisodeStyle { get; set; }
public SelectList SeparatorStyles { get; set; } public SelectList SeparatorStyles { get; set; }

View File

@ -1,4 +1,5 @@
@model NzbDrone.Web.Models.EpisodeSortingModel @using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.EpisodeSortingModel
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
@ -33,56 +34,57 @@
<div class="config-section"> <div class="config-section">
<div class="config-group"> <div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.ShowName)</div> <div class="config-title">@Html.LabelFor(m => m.SeriesName)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.ShowName)</div> <div class="config-value">@Html.CheckBoxFor(m => m.SeriesName)</div>
</div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeriesName)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SeriesName)</div>
</div> </div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.ShowName)</div>
</div> </div>
<div class="config-section"> <div class="config-section">
<div class="config-group"> <div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.EpisodeName)</div> <div class="config-title">@Html.LabelFor(m => m.EpisodeName)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.EpisodeName)</div> <div class="config-value">@Html.CheckBoxFor(m => m.EpisodeName)</div>
</div> </div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.EpisodeName)</div> <div class="config-validation">@Html.ValidationMessageFor(m => m.EpisodeName)</div>
<div class="config-description">@Html.DescriptionFor(m => m.EpisodeName)</div>
</div>
</div> </div>
<div class="config-section"> <div class="config-section">
<div class="config-group"> <div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.ReplaceSpaces)</div> <div class="config-title">@Html.LabelFor(m => m.ReplaceSpaces)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.ReplaceSpaces)</div> <div class="config-value">@Html.CheckBoxFor(m => m.ReplaceSpaces)</div>
</div> </div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.ReplaceSpaces)</div> <div class="config-validation">@Html.ValidationMessageFor(m => m.ReplaceSpaces)</div>
<div class="config-description">@Html.DescriptionFor(m => m.ReplaceSpaces)</div>
</div>
</div> </div>
<div class="config-section"> <div class="config-section">
<div class="config-group"> <div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.AppendQuality)</div> <div class="config-title">@Html.LabelFor(m => m.AppendQuality)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.AppendQuality)</div> <div class="config-value">@Html.CheckBoxFor(m => m.AppendQuality)</div>
</div> </div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.AppendQuality)</div> <div class="config-validation">@Html.ValidationMessageFor(m => m.AppendQuality)</div>
<div class="config-description">@Html.DescriptionFor(m => m.AppendQuality)</div>
</div> </div>
<div class="config-section">
<div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.UseAirByDate)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.UseAirByDate)</div>
</div>
<div class="config-validation">@Html.ValidationMessageFor(m => m.UseAirByDate)</div>
</div> </div>
<div class="config-section"> <div class="config-section">
<div class="config-group"> <div class="config-group">
<div class="config-title">@Html.LabelFor(m => m.SeasonFolders)</div> <div class="config-title">@Html.LabelFor(m => m.SeasonFolders)</div>
<div class="config-value">@Html.CheckBoxFor(m => m.SeasonFolders)</div> <div class="config-value">@Html.CheckBoxFor(m => m.SeasonFolders)</div>
</div> </div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeasonFolders)</div> <div class="config-validation">@Html.ValidationMessageFor(m => m.SeasonFolders)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SeasonFolders)</div>
</div>
</div> </div>
<div class="config-section"> <div class="config-section">
@ -90,7 +92,10 @@
<div class="config-title">@Html.LabelFor(m => m.SeasonFolderFormat)</div> <div class="config-title">@Html.LabelFor(m => m.SeasonFolderFormat)</div>
<div class="config-value">@Html.TextBoxFor(m => m.SeasonFolderFormat)</div> <div class="config-value">@Html.TextBoxFor(m => m.SeasonFolderFormat)</div>
</div> </div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeasonFolderFormat)</div> <div class="config-validation">@Html.ValidationMessageFor(m => m.SeasonFolderFormat)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SeasonFolderFormat)</div>
</div>
</div> </div>
<div class="config-section"> <div class="config-section">
@ -98,7 +103,10 @@
<div class="config-title">@Html.LabelFor(m => m.SeparatorStyle)</div> <div class="config-title">@Html.LabelFor(m => m.SeparatorStyle)</div>
<div class="config-value">@Html.DropDownListFor(m => m.SeparatorStyle, Model.SeparatorStyles)</div> <div class="config-value">@Html.DropDownListFor(m => m.SeparatorStyle, Model.SeparatorStyles)</div>
</div> </div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.SeparatorStyle)</div> <div class="config-validation">@Html.ValidationMessageFor(m => m.SeparatorStyle)</div>
<div class="config-description">@Html.DescriptionFor(m => m.SeparatorStyle)</div>
</div>
</div> </div>
<div class="config-section"> <div class="config-section">
@ -106,7 +114,10 @@
<div class="config-title">@Html.LabelFor(m => m.NumberStyle)</div> <div class="config-title">@Html.LabelFor(m => m.NumberStyle)</div>
<div class="config-value">@Html.DropDownListFor(m => m.NumberStyle, Model.NumberStyles)</div> <div class="config-value">@Html.DropDownListFor(m => m.NumberStyle, Model.NumberStyles)</div>
</div> </div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.NumberStyle)</div> <div class="config-validation">@Html.ValidationMessageFor(m => m.NumberStyle)</div>
<div class="config-description">@Html.DescriptionFor(m => m.NumberStyle)</div>
</div>
</div> </div>
<div class="config-section"> <div class="config-section">
@ -114,7 +125,10 @@
<div class="config-title">@Html.LabelFor(m => m.MultiEpisodeStyle)</div> <div class="config-title">@Html.LabelFor(m => m.MultiEpisodeStyle)</div>
<div class="config-value">@Html.DropDownListFor(m => m.MultiEpisodeStyle, Model.MultiEpisodeStyles)</div> <div class="config-value">@Html.DropDownListFor(m => m.MultiEpisodeStyle, Model.MultiEpisodeStyles)</div>
</div> </div>
<div class="config-group2">
<div class="config-validation">@Html.ValidationMessageFor(m => m.MultiEpisodeStyle)</div> <div class="config-validation">@Html.ValidationMessageFor(m => m.MultiEpisodeStyle)</div>
<div class="config-description">@Html.DescriptionFor(m => m.MultiEpisodeStyle)</div>
</div>
</div> </div>
<div id="singleEpisodeExample"></div> <div id="singleEpisodeExample"></div>