Added Qualties to Settings

This commit is contained in:
Devin Buhl 2017-01-17 20:30:21 -05:00
commit b02944a3b2
7 changed files with 20 additions and 7 deletions

View file

@ -9,10 +9,11 @@ namespace NzbDrone.Core.Datastore.Migration
protected override void MainDbUpgrade() protected override void MainDbUpgrade()
{ {
Create.TableForModel("NetImport") Create.TableForModel("NetImport")
.WithColumn("Enabled").AsBoolean() .WithColumn("Enabled").AsBoolean()
.WithColumn("Name").AsString().Unique() .WithColumn("ProfileId").AsInt32()
.WithColumn("Implementation").AsString() .WithColumn("Name").AsString().Unique()
.WithColumn("Settings").AsString().Nullable(); .WithColumn("Implementation").AsString()
.WithColumn("Settings").AsString().Nullable();
} }
} }
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml.Serialization;
using FluentValidation.Results; using FluentValidation.Results;
using NLog; using NLog;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
@ -15,9 +16,9 @@ namespace NzbDrone.Core.NetImport.IMDbWatchList
{ {
public override string Name => "IMDbWatchList"; public override string Name => "IMDbWatchList";
public override string Link => "http://rss.imdb.com/list/"; public override string Link => "http://rss.imdb.com/list/";
public override int ProfileId => 1;
public override bool Enabled => true; public override bool Enabled => true;
public IMDbWatchList(IHttpClient httpClient, IConfigService configService, IParsingService parsingService, Logger logger) public IMDbWatchList(IHttpClient httpClient, IConfigService configService, IParsingService parsingService, Logger logger)
: base(httpClient, configService, parsingService, logger) : base(httpClient, configService, parsingService, logger)
{ } { }

View file

@ -46,6 +46,7 @@ namespace NzbDrone.Core.NetImport.IMDbWatchList
{ {
Title = title.MovieTitle, Title = title.MovieTitle,
Year = title.Year, Year = title.Year,
ProfileId = _settings.ProfileId,
ImdbId = Parser.Parser.ParseImdbId(result.Link) ImdbId = Parser.Parser.ParseImdbId(result.Link)
}); });
} }

View file

@ -1,5 +1,6 @@
using FluentValidation; using FluentValidation;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation; using NzbDrone.Core.Validation;
@ -20,10 +21,14 @@ namespace NzbDrone.Core.NetImport.IMDbWatchList
public IMDbWatchListSettings() public IMDbWatchListSettings()
{ {
Link = "http://rss.imdb.com/list/"; Link = "http://rss.imdb.com/list/";
ProfileId = 1;
} }
[FieldDefinition(0, Label = "Watch List RSS link", HelpLink = "http://rss.imdb.com/list/")] [FieldDefinition(0, Label = "Watch List RSS link", HelpLink = "http://rss.imdb.com/list/")]
public string Link { get; set; } 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); public bool IsValid => !string.IsNullOrWhiteSpace(Link);

View file

@ -22,6 +22,7 @@ namespace NzbDrone.Core.NetImport
public abstract string Name { get; } public abstract string Name { get; }
public abstract string Link { get; } public abstract string Link { get; }
public abstract int ProfileId { get; }
public abstract bool Enabled { get; } public abstract bool Enabled { get; }
@ -46,6 +47,7 @@ namespace NzbDrone.Core.NetImport
{ {
Name = GetType().Name, Name = GetType().Name,
Link = Link, Link = Link,
ProfileId = ProfileId,
Enabled = config.Validate().IsValid && Enabled, Enabled = config.Validate().IsValid && Enabled,
Implementation = GetType().Name, Implementation = GetType().Name,
Settings = config Settings = config

View file

@ -4,8 +4,9 @@ namespace NzbDrone.Core.NetImport
{ {
public class NetImportDefinition : ProviderDefinition public class NetImportDefinition : ProviderDefinition
{ {
public bool Enabled { get; set; }
public string Link { get; set; } public string Link { get; set; }
public int ProfileId { get; set; }
public bool Enabled { get; set; }
public override bool Enable => Enabled; public override bool Enable => Enabled;
} }
} }

View file

@ -1273,7 +1273,9 @@
</Content> </Content>
<Compile Include="Notifications\Telegram\TelegramError.cs" /> <Compile Include="Notifications\Telegram\TelegramError.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<Folder Include="NetImport\CouchPotato\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent> <PostBuildEvent>