Added metadata options to settings #ND-21

New: Metadata file creation for XBMC
This commit is contained in:
Mark McDowall 2012-07-12 19:02:30 -07:00
parent 2e9cf66b57
commit 5c49ac6b29
7 changed files with 108 additions and 62 deletions

View File

@ -501,20 +501,6 @@ namespace NzbDrone.Core.Providers.Core
set { SetValue("PlexPassword", value); }
}
public virtual Boolean MetadataEnabled
{
get { return GetValueBoolean("MetadataEnabled"); }
set { SetValue("MetadataEnabled", value); }
}
public virtual Boolean MetadataXbmcEnabled
{
get { return GetValueBoolean("MetadataXbmcEnabled"); }
set { SetValue("MetadataXbmcEnabled", value); }
}
public virtual Boolean MetadataUseBanners
{
get { return GetValueBoolean("MetadataUseBanners"); }

View File

@ -31,17 +31,19 @@ namespace NzbDrone.Web.Controllers
private readonly QualityTypeProvider _qualityTypeProvider;
private readonly ConfigFileProvider _configFileProvider;
private readonly NewznabProvider _newznabProvider;
private readonly MetadataProvider _metadataProvider;
public SettingsController(ConfigProvider configProvider, IndexerProvider indexerProvider,
QualityProvider qualityProvider, AutoConfigureProvider autoConfigureProvider,
SeriesProvider seriesProvider, ExternalNotificationProvider externalNotificationProvider,
QualityTypeProvider qualityTypeProvider,
ConfigFileProvider configFileProvider, NewznabProvider newznabProvider)
QualityProvider qualityProvider, AutoConfigureProvider autoConfigureProvider,
SeriesProvider seriesProvider, ExternalNotificationProvider externalNotificationProvider,
QualityTypeProvider qualityTypeProvider, ConfigFileProvider configFileProvider,
NewznabProvider newznabProvider, MetadataProvider metadataProvider)
{
_externalNotificationProvider = externalNotificationProvider;
_qualityTypeProvider = qualityTypeProvider;
_configFileProvider = configFileProvider;
_newznabProvider = newznabProvider;
_metadataProvider = metadataProvider;
_configProvider = configProvider;
_indexerProvider = indexerProvider;
_qualityProvider = qualityProvider;
@ -207,6 +209,10 @@ namespace NzbDrone.Web.Controllers
model.SeparatorStyles = new SelectList(EpisodeSortingHelper.GetSeparatorStyles(), "Id", "Name");
model.NumberStyles = new SelectList(EpisodeSortingHelper.GetNumberStyles(), "Id", "Name");
model.MultiEpisodeStyles = new SelectList(EpisodeSortingHelper.GetMultiEpisodeStyles(), "Id", "Name");
//Metadata
model.MetadataXbmcEnabled = _metadataProvider.GetSettings(typeof(Core.Providers.Metadata.Xbmc)).Enable;
model.MetadataUseBanners = _configProvider.MetadataUseBanners;
return View(model);
}
@ -589,6 +595,14 @@ namespace NzbDrone.Web.Controllers
_configProvider.SortingNumberStyle = data.NumberStyle;
_configProvider.SortingMultiEpisodeStyle = data.MultiEpisodeStyle;
//Metadata
_configProvider.MetadataUseBanners = data.MetadataUseBanners;
//Xbmc
var xbmc = _metadataProvider.GetSettings(typeof(Core.Providers.Metadata.Xbmc));
xbmc.Enable = data.MetadataXbmcEnabled;
_metadataProvider.SaveSettings(xbmc);
return GetSuccessResult();
}

View File

@ -43,6 +43,14 @@ namespace NzbDrone.Web.Models
[Description("How will multi-episode files be named?")]
public int MultiEpisodeStyle { get; set; }
[DisplayName("XBMC")]
[Description("Enable creating metadata for XBMC")]
public bool MetadataXbmcEnabled { get; set; }
[DisplayName("Use Banners")]
[Description("Use banners instead of posters?")]
public bool MetadataUseBanners { get; set; }
public SelectList SeparatorStyles { get; set; }
public SelectList NumberStyles { get; set; }
public SelectList MultiEpisodeStyles { get; set; }

View File

@ -543,6 +543,12 @@
<ItemGroup>
<Content Include="Views\System\Stats.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Settings\EpisodeNamingPartial.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Settings\MetadataPartial.cshtml" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View File

@ -0,0 +1,53 @@
@using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.EpisodeNamingModel
@{
Layout = null;
}
<div class="settingsContainer">
@Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.")
<label class="labelClass">@Html.LabelFor(m => m.SeriesName)
<span class="small">@Html.DescriptionFor(m => m.SeriesName)</span>
</label>
@Html.CheckBoxFor(m => m.SeriesName, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.EpisodeName)
<span class="small">@Html.DescriptionFor(m => m.EpisodeName)</span>
</label>
@Html.CheckBoxFor(m => m.EpisodeName, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.ReplaceSpaces)
<span class="small">@Html.DescriptionFor(m => m.ReplaceSpaces)</span>
</label>
@Html.CheckBoxFor(m => m.ReplaceSpaces, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.AppendQuality)
<span class="small">@Html.DescriptionFor(m => m.AppendQuality)</span>
</label>
@Html.CheckBoxFor(m => m.AppendQuality, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.SeasonFolders)
<span class="small">@Html.DescriptionFor(m => m.SeasonFolders)</span>
</label>
@Html.CheckBoxFor(m => m.SeasonFolders, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.SeasonFolderFormat)
<span class="small">@Html.DescriptionFor(m => m.SeasonFolderFormat)</span>
</label>
@Html.TextBoxFor(m => m.SeasonFolderFormat, new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.SeparatorStyle)
<span class="small">@Html.DescriptionFor(m => m.SeparatorStyle)</span>
</label>
@Html.DropDownListFor(m => m.SeparatorStyle, Model.SeparatorStyles, new { @class = "inputClass selectClass" })
<label class="labelClass">@Html.LabelFor(m => m.NumberStyle)
<span class="small">@Html.DescriptionFor(m => m.NumberStyle)</span>
</label>
@Html.DropDownListFor(m => m.NumberStyle, Model.NumberStyles, new { @class = "inputClass selectClass" })
<label class="labelClass">@Html.LabelFor(m => m.MultiEpisodeStyle)
<span class="small">@Html.DescriptionFor(m => m.MultiEpisodeStyle)</span>
</label>
@Html.DropDownListFor(m => m.MultiEpisodeStyle, Model.MultiEpisodeStyles, new { @class = "inputClass selectClass" })
</div>
<div id="examples">
<div id="singleEpisodeExample">
<b>Single Episode Example: </b><span class="result"></span>
</div>
<div id="multiEpisodeExample">
<b>Multi-Episode Example: </b><span class="result"></span>
</div>
</div>

View File

@ -0,0 +1,15 @@
@using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.EpisodeNamingModel
@{
Layout = null;
}
<label class="labelClass">@Html.LabelFor(m => m.MetadataXbmcEnabled)
<span class="small">@Html.DescriptionFor(m => m.MetadataXbmcEnabled)</span>
</label>
@Html.CheckBoxFor(m => m.MetadataXbmcEnabled, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.MetadataUseBanners)
<span class="small">@Html.DescriptionFor(m => m.MetadataUseBanners)</span>
</label>
@Html.CheckBoxFor(m => m.MetadataUseBanners, new { @class = "inputClass checkClass" })

View File

@ -20,51 +20,15 @@
<div id="stylized">
@using (Html.BeginForm("SaveNaming", "Settings", FormMethod.Post, new { id = "NamingForm", name = "NamingForm", @class = "settingsForm" }))
{
<div class="settingsContainer">
@Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.")
<label class="labelClass">@Html.LabelFor(m => m.SeriesName)
<span class="small">@Html.DescriptionFor(m => m.SeriesName)</span>
</label>
@Html.CheckBoxFor(m => m.SeriesName, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.EpisodeName)
<span class="small">@Html.DescriptionFor(m => m.EpisodeName)</span>
</label>
@Html.CheckBoxFor(m => m.EpisodeName, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.ReplaceSpaces)
<span class="small">@Html.DescriptionFor(m => m.ReplaceSpaces)</span>
</label>
@Html.CheckBoxFor(m => m.ReplaceSpaces, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.AppendQuality)
<span class="small">@Html.DescriptionFor(m => m.AppendQuality)</span>
</label>
@Html.CheckBoxFor(m => m.AppendQuality, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.SeasonFolders)
<span class="small">@Html.DescriptionFor(m => m.SeasonFolders)</span>
</label>
@Html.CheckBoxFor(m => m.SeasonFolders, new { @class = "inputClass checkClass" })
<label class="labelClass">@Html.LabelFor(m => m.SeasonFolderFormat)
<span class="small">@Html.DescriptionFor(m => m.SeasonFolderFormat)</span>
</label>
@Html.TextBoxFor(m => m.SeasonFolderFormat, new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.SeparatorStyle)
<span class="small">@Html.DescriptionFor(m => m.SeparatorStyle)</span>
</label>
@Html.DropDownListFor(m => m.SeparatorStyle, Model.SeparatorStyles, new { @class = "inputClass selectClass" })
<label class="labelClass">@Html.LabelFor(m => m.NumberStyle)
<span class="small">@Html.DescriptionFor(m => m.NumberStyle)</span>
</label>
@Html.DropDownListFor(m => m.NumberStyle, Model.NumberStyles, new { @class = "inputClass selectClass" })
<label class="labelClass">@Html.LabelFor(m => m.MultiEpisodeStyle)
<span class="small">@Html.DescriptionFor(m => m.MultiEpisodeStyle)</span>
</label>
@Html.DropDownListFor(m => m.MultiEpisodeStyle, Model.MultiEpisodeStyles, new { @class = "inputClass selectClass" })
</div>
<div id="examples">
<div id="singleEpisodeExample">
<b>Single Episode Example: </b><span class="result"></span>
<div class="jquery-accordion">
<h3><a href="#">Episode Naming</a></h3>
<div id="episodeNamingContainer">
@{Html.RenderPartial("EpisodeNamingPartial", Model);}
</div>
<div id="multiEpisodeExample">
<b>Multi-Episode Example: </b><span class="result"></span>
<h3><a href="#">Metadata</a></h3>
<div id="metadataContainer">
@{Html.RenderPartial("MetaDataPartial", Model);}
</div>
</div>