From c4e1a732ddb0c070a31e8f0022f2a76481b0090e Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 13 May 2015 08:01:39 -0700 Subject: [PATCH] Remove Kodi specific settings from PHT Settings --- .../ClientSchema/SchemaBuilder.cs | 4 +-- .../Annotations/FieldDefinitionAttribute.cs | 3 ++- .../Plex/PlexHomeTheaterSettings.cs | 26 +++++++++++++++++-- .../Notifications/Xbmc/XbmcSettings.cs | 1 - src/UI/Form/FormBuilder.js | 4 +++ src/UI/Form/HiddenTemplate.hbs | 8 ++++++ 6 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 src/UI/Form/HiddenTemplate.hbs diff --git a/src/NzbDrone.Api/ClientSchema/SchemaBuilder.cs b/src/NzbDrone.Api/ClientSchema/SchemaBuilder.cs index 1a2de1ee7..86ca9cc1a 100644 --- a/src/NzbDrone.Api/ClientSchema/SchemaBuilder.cs +++ b/src/NzbDrone.Api/ClientSchema/SchemaBuilder.cs @@ -53,11 +53,9 @@ public static List ToSchema(object model) } } - return result; - + return result.OrderBy(r => r.Order).ToList(); } - public static object ReadFormSchema(List fields, Type targetType, object defaults = null) { Ensure.That(targetType, () => targetType).IsNotNull(); diff --git a/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs b/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs index da6b88f1b..f34ca78b9 100644 --- a/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs +++ b/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs @@ -25,6 +25,7 @@ public enum FieldType Password, Checkbox, Select, - Path + Path, + Hidden } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Notifications/Plex/PlexHomeTheaterSettings.cs b/src/NzbDrone.Core/Notifications/Plex/PlexHomeTheaterSettings.cs index 07df9288c..ec4f197ef 100644 --- a/src/NzbDrone.Core/Notifications/Plex/PlexHomeTheaterSettings.cs +++ b/src/NzbDrone.Core/Notifications/Plex/PlexHomeTheaterSettings.cs @@ -1,4 +1,6 @@ -using NzbDrone.Core.Notifications.Xbmc; +using System; +using NzbDrone.Core.Annotations; +using NzbDrone.Core.Notifications.Xbmc; namespace NzbDrone.Core.Notifications.Plex { @@ -6,8 +8,28 @@ public class PlexHomeTheaterSettings : XbmcSettings { public PlexHomeTheaterSettings() { - DisplayTime = 5; Port = 3005; + Notify = true; } + + //These need to be kept in the same order as XBMC Settings, but we don't want them displayed + + [FieldDefinition(2, Label = "Username", Type = FieldType.Hidden)] + public String Username { get; set; } + + [FieldDefinition(3, Label = "Password", Type = FieldType.Hidden)] + public String Password { get; set; } + + [FieldDefinition(5, Label = "GUI Notification", Type = FieldType.Hidden)] + public Boolean Notify { get; set; } + + [FieldDefinition(6, Label = "Update Library", HelpText = "Update Library on Download & Rename?", Type = FieldType.Hidden)] + public Boolean UpdateLibrary { get; set; } + + [FieldDefinition(7, Label = "Clean Library", HelpText = "Clean Library after update?", Type = FieldType.Hidden)] + public Boolean CleanLibrary { get; set; } + + [FieldDefinition(8, Label = "Always Update", HelpText = "Update Library even when a video is playing?", Type = FieldType.Hidden)] + public Boolean AlwaysUpdate { get; set; } } } diff --git a/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs b/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs index e1507d9bb..b84cc6179 100644 --- a/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs +++ b/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs @@ -23,7 +23,6 @@ public class XbmcSettings : IProviderConfig public XbmcSettings() { - DisplayTime = 5; Port = 8080; } diff --git a/src/UI/Form/FormBuilder.js b/src/UI/Form/FormBuilder.js index e901cca5d..da3677f04 100644 --- a/src/UI/Form/FormBuilder.js +++ b/src/UI/Form/FormBuilder.js @@ -12,6 +12,10 @@ var _fieldBuilder = function(field) { return _templateRenderer.call(field, 'Form/TextboxTemplate'); } + if (field.type === 'hidden') { + return _templateRenderer.call(field, 'Form/HiddenTemplate'); + } + if (field.type === 'password') { return _templateRenderer.call(field, 'Form/PasswordTemplate'); } diff --git a/src/UI/Form/HiddenTemplate.hbs b/src/UI/Form/HiddenTemplate.hbs new file mode 100644 index 000000000..0de66c464 --- /dev/null +++ b/src/UI/Form/HiddenTemplate.hbs @@ -0,0 +1,8 @@ +