diff --git a/src/NzbDrone.Api/NetImport/NetImportModule.cs b/src/NzbDrone.Api/NetImport/NetImportModule.cs index 042b429d9..a382e5183 100644 --- a/src/NzbDrone.Api/NetImport/NetImportModule.cs +++ b/src/NzbDrone.Api/NetImport/NetImportModule.cs @@ -24,6 +24,7 @@ protected override void MapToResource(NetImportResource resource, NetImportDefin resource.RootFolderPath = definition.RootFolderPath; resource.ShouldMonitor = definition.ShouldMonitor; resource.MinimumAvailability = definition.MinimumAvailability; + resource.Tags = definition.Tags; } protected override void MapToModel(NetImportDefinition definition, NetImportResource resource) @@ -36,6 +37,7 @@ protected override void MapToModel(NetImportDefinition definition, NetImportReso definition.RootFolderPath = resource.RootFolderPath; definition.ShouldMonitor = resource.ShouldMonitor; definition.MinimumAvailability = resource.MinimumAvailability; + definition.Tags = resource.Tags; } protected override void Validate(NetImportDefinition definition, bool includeWarnings) diff --git a/src/NzbDrone.Api/NetImport/NetImportResource.cs b/src/NzbDrone.Api/NetImport/NetImportResource.cs index 360494d40..76716eaa9 100644 --- a/src/NzbDrone.Api/NetImport/NetImportResource.cs +++ b/src/NzbDrone.Api/NetImport/NetImportResource.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using NzbDrone.Core.Movies; namespace NzbDrone.Api.NetImport @@ -10,5 +11,6 @@ public class NetImportResource : ProviderResource public string RootFolderPath { get; set; } public int ProfileId { get; set; } public MovieStatusType MinimumAvailability { get; set; } + public HashSet Tags { get; set; } } } diff --git a/src/NzbDrone.Core/Datastore/Migration/151_add_tags_to_net_import.cs b/src/NzbDrone.Core/Datastore/Migration/151_add_tags_to_net_import.cs new file mode 100644 index 000000000..69e42c536 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/151_add_tags_to_net_import.cs @@ -0,0 +1,17 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(151)] + public class add_tags_to_net_import : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Alter.Table("NetImport") + .AddColumn("Tags").AsString().Nullable(); + + Execute.Sql("UPDATE NetImport SET Tags = '[]'"); + } + } +} diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupUnusedTags.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupUnusedTags.cs index 9b07f8319..f8ead0292 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupUnusedTags.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupUnusedTags.cs @@ -20,7 +20,7 @@ public void Clean() using (var mapper = _database.GetDataMapper()) { - var usedTags = new[] {"Movies", "Notifications", "DelayProfiles", "Restrictions"} + var usedTags = new[] {"Movies", "Notifications", "DelayProfiles", "Restrictions", "NetImport"} .SelectMany(v => GetUsedTags(v, mapper)) .Distinct() .ToArray(); diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index 89df9fc5c..e13d75eed 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -701,6 +701,7 @@ public Movie MapMovieToTmdbMovie(Movie movie) newMovie.Monitored = movie.Monitored; newMovie.MovieFile = movie.MovieFile; newMovie.MinimumAvailability = movie.MinimumAvailability; + newMovie.Tags = movie.Tags; return newMovie; } diff --git a/src/NzbDrone.Core/NetImport/HttpNetImportBase.cs b/src/NzbDrone.Core/NetImport/HttpNetImportBase.cs index 92e53b994..7564c448e 100644 --- a/src/NzbDrone.Core/NetImport/HttpNetImportBase.cs +++ b/src/NzbDrone.Core/NetImport/HttpNetImportBase.cs @@ -118,6 +118,7 @@ protected virtual IList FetchPage(NetImportRequest request, IParseNetImpo m.ProfileId = ((NetImportDefinition) Definition).ProfileId; m.Monitored = ((NetImportDefinition) Definition).ShouldMonitor; m.MinimumAvailability = ((NetImportDefinition) Definition).MinimumAvailability; + m.Tags = ((NetImportDefinition) Definition).Tags; return m; }).ToList(); } @@ -170,6 +171,5 @@ protected virtual ValidationFailure TestConnection() return null; } } - } diff --git a/src/NzbDrone.Core/NetImport/NetImportDefinition.cs b/src/NzbDrone.Core/NetImport/NetImportDefinition.cs index 6462fb008..176db1773 100644 --- a/src/NzbDrone.Core/NetImport/NetImportDefinition.cs +++ b/src/NzbDrone.Core/NetImport/NetImportDefinition.cs @@ -1,4 +1,5 @@ -using Marr.Data; +using System.Collections.Generic; +using Marr.Data; using NzbDrone.Core.Profiles; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Movies; @@ -7,6 +8,11 @@ namespace NzbDrone.Core.NetImport { public class NetImportDefinition : ProviderDefinition { + public NetImportDefinition() + { + Tags = new HashSet(); + } + public bool Enabled { get; set; } public bool EnableAuto { get; set; } public bool ShouldMonitor { get; set; } @@ -15,5 +21,6 @@ public class NetImportDefinition : ProviderDefinition public LazyLoaded Profile { get; set; } public string RootFolderPath { get; set; } public override bool Enable => Enabled; + public HashSet Tags { get; set; } } } diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 90f2ded6c..a22017c03 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -146,6 +146,7 @@ + @@ -1335,4 +1336,4 @@ --> - \ No newline at end of file + diff --git a/src/UI/Settings/NetImport/Edit/NetImportEditView.js b/src/UI/Settings/NetImport/Edit/NetImportEditView.js index 8d31ef693..a407ef2d4 100644 --- a/src/UI/Settings/NetImport/Edit/NetImportEditView.js +++ b/src/UI/Settings/NetImport/Edit/NetImportEditView.js @@ -22,6 +22,7 @@ var view = Marionette.ItemView.extend({ profile : '.x-profile', minimumAvailability : '.x-minimumavailability', rootFolder : '.x-root-folder', + tags : '.x-tags' }, events : { @@ -53,6 +54,10 @@ var view = Marionette.ItemView.extend({ this.ui.rootFolder.val(defaultRoot); } } + this.ui.tags.tagInput({ + model : this.model, + property : 'tags' + }); }, _onBeforeSave : function() { diff --git a/src/UI/Settings/NetImport/Edit/NetImportEditViewTemplate.hbs b/src/UI/Settings/NetImport/Edit/NetImportEditViewTemplate.hbs index 46fd5292f..89349fd16 100644 --- a/src/UI/Settings/NetImport/Edit/NetImportEditViewTemplate.hbs +++ b/src/UI/Settings/NetImport/Edit/NetImportEditViewTemplate.hbs @@ -101,6 +101,14 @@ +
+ + +
+ +
+
+ {{formBuilder}}