From b02944a3b2eec7d5ff6b80ea0e9bbe3b10895a3a Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Tue, 17 Jan 2017 20:30:21 -0500 Subject: [PATCH] Added Qualties to Settings --- .../Datastore/Migration/119_create_netimport_table.cs | 9 +++++---- .../NetImport/IMDbWatchList/IMDbWatchList.cs | 3 ++- .../NetImport/IMDbWatchList/IMDbWatchListParser.cs | 1 + .../NetImport/IMDbWatchList/IMDbWatchListSettings.cs | 5 +++++ src/NzbDrone.Core/NetImport/NetImportBase.cs | 2 ++ src/NzbDrone.Core/NetImport/NetImportDefinition.cs | 3 ++- src/NzbDrone.Core/NzbDrone.Core.csproj | 4 +++- 7 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/NzbDrone.Core/Datastore/Migration/119_create_netimport_table.cs b/src/NzbDrone.Core/Datastore/Migration/119_create_netimport_table.cs index 7784ad1c4..086464746 100644 --- a/src/NzbDrone.Core/Datastore/Migration/119_create_netimport_table.cs +++ b/src/NzbDrone.Core/Datastore/Migration/119_create_netimport_table.cs @@ -9,10 +9,11 @@ namespace NzbDrone.Core.Datastore.Migration protected override void MainDbUpgrade() { Create.TableForModel("NetImport") - .WithColumn("Enabled").AsBoolean() - .WithColumn("Name").AsString().Unique() - .WithColumn("Implementation").AsString() - .WithColumn("Settings").AsString().Nullable(); + .WithColumn("Enabled").AsBoolean() + .WithColumn("ProfileId").AsInt32() + .WithColumn("Name").AsString().Unique() + .WithColumn("Implementation").AsString() + .WithColumn("Settings").AsString().Nullable(); } } } diff --git a/src/NzbDrone.Core/NetImport/IMDbWatchList/IMDbWatchList.cs b/src/NzbDrone.Core/NetImport/IMDbWatchList/IMDbWatchList.cs index d97fb99c2..ed5c06da4 100644 --- a/src/NzbDrone.Core/NetImport/IMDbWatchList/IMDbWatchList.cs +++ b/src/NzbDrone.Core/NetImport/IMDbWatchList/IMDbWatchList.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Xml.Serialization; using FluentValidation.Results; using NLog; using NzbDrone.Common.Http; @@ -15,9 +16,9 @@ namespace NzbDrone.Core.NetImport.IMDbWatchList { public override string Name => "IMDbWatchList"; public override string Link => "http://rss.imdb.com/list/"; + public override int ProfileId => 1; public override bool Enabled => true; - public IMDbWatchList(IHttpClient httpClient, IConfigService configService, IParsingService parsingService, Logger logger) : base(httpClient, configService, parsingService, logger) { } diff --git a/src/NzbDrone.Core/NetImport/IMDbWatchList/IMDbWatchListParser.cs b/src/NzbDrone.Core/NetImport/IMDbWatchList/IMDbWatchListParser.cs index 4042eff95..20fb368ec 100644 --- a/src/NzbDrone.Core/NetImport/IMDbWatchList/IMDbWatchListParser.cs +++ b/src/NzbDrone.Core/NetImport/IMDbWatchList/IMDbWatchListParser.cs @@ -46,6 +46,7 @@ namespace NzbDrone.Core.NetImport.IMDbWatchList { Title = title.MovieTitle, Year = title.Year, + ProfileId = _settings.ProfileId, ImdbId = Parser.Parser.ParseImdbId(result.Link) }); } diff --git a/src/NzbDrone.Core/NetImport/IMDbWatchList/IMDbWatchListSettings.cs b/src/NzbDrone.Core/NetImport/IMDbWatchList/IMDbWatchListSettings.cs index f63e7206f..3ca24faf3 100644 --- a/src/NzbDrone.Core/NetImport/IMDbWatchList/IMDbWatchListSettings.cs +++ b/src/NzbDrone.Core/NetImport/IMDbWatchList/IMDbWatchListSettings.cs @@ -1,5 +1,6 @@ using FluentValidation; using NzbDrone.Core.Annotations; +using NzbDrone.Core.Profiles; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; @@ -20,10 +21,14 @@ namespace NzbDrone.Core.NetImport.IMDbWatchList public IMDbWatchListSettings() { Link = "http://rss.imdb.com/list/"; + ProfileId = 1; } [FieldDefinition(0, Label = "Watch List RSS link", HelpLink = "http://rss.imdb.com/list/")] public string Link { get; set; } + + [FieldDefinition(1, Label = "Quality", Type = FieldType.Select, SelectOptions = typeof(Profile), HelpText = "Quality of all imported movies")] + public int ProfileId { get; set; } public bool IsValid => !string.IsNullOrWhiteSpace(Link); diff --git a/src/NzbDrone.Core/NetImport/NetImportBase.cs b/src/NzbDrone.Core/NetImport/NetImportBase.cs index a3d2723e2..0f3f6fc0f 100644 --- a/src/NzbDrone.Core/NetImport/NetImportBase.cs +++ b/src/NzbDrone.Core/NetImport/NetImportBase.cs @@ -22,6 +22,7 @@ namespace NzbDrone.Core.NetImport public abstract string Name { get; } public abstract string Link { get; } + public abstract int ProfileId { get; } public abstract bool Enabled { get; } @@ -46,6 +47,7 @@ namespace NzbDrone.Core.NetImport { Name = GetType().Name, Link = Link, + ProfileId = ProfileId, Enabled = config.Validate().IsValid && Enabled, Implementation = GetType().Name, Settings = config diff --git a/src/NzbDrone.Core/NetImport/NetImportDefinition.cs b/src/NzbDrone.Core/NetImport/NetImportDefinition.cs index 6d2442eb7..b4af0c4a2 100644 --- a/src/NzbDrone.Core/NetImport/NetImportDefinition.cs +++ b/src/NzbDrone.Core/NetImport/NetImportDefinition.cs @@ -4,8 +4,9 @@ namespace NzbDrone.Core.NetImport { public class NetImportDefinition : ProviderDefinition { - public bool Enabled { get; set; } public string Link { get; set; } + public int ProfileId { get; set; } + public bool Enabled { get; set; } public override bool Enable => Enabled; } } diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index f26bca9f4..d09f0a840 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -1273,7 +1273,9 @@ - + + +