mirror of https://github.com/Radarr/Radarr
Added: Tags support to NetImport (Lists) (#3127)
* Add tags support to NetImport (Lists) * Keep indentation consistent with current code * Initialize set of empty tags * Add tags from list to movie * Prevent tags used by lists from being removed
This commit is contained in:
parent
84fab25af7
commit
7a43bf3f60
|
@ -24,6 +24,7 @@ namespace NzbDrone.Api.NetImport
|
||||||
resource.RootFolderPath = definition.RootFolderPath;
|
resource.RootFolderPath = definition.RootFolderPath;
|
||||||
resource.ShouldMonitor = definition.ShouldMonitor;
|
resource.ShouldMonitor = definition.ShouldMonitor;
|
||||||
resource.MinimumAvailability = definition.MinimumAvailability;
|
resource.MinimumAvailability = definition.MinimumAvailability;
|
||||||
|
resource.Tags = definition.Tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void MapToModel(NetImportDefinition definition, NetImportResource resource)
|
protected override void MapToModel(NetImportDefinition definition, NetImportResource resource)
|
||||||
|
@ -36,6 +37,7 @@ namespace NzbDrone.Api.NetImport
|
||||||
definition.RootFolderPath = resource.RootFolderPath;
|
definition.RootFolderPath = resource.RootFolderPath;
|
||||||
definition.ShouldMonitor = resource.ShouldMonitor;
|
definition.ShouldMonitor = resource.ShouldMonitor;
|
||||||
definition.MinimumAvailability = resource.MinimumAvailability;
|
definition.MinimumAvailability = resource.MinimumAvailability;
|
||||||
|
definition.Tags = resource.Tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Validate(NetImportDefinition definition, bool includeWarnings)
|
protected override void Validate(NetImportDefinition definition, bool includeWarnings)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
|
|
||||||
namespace NzbDrone.Api.NetImport
|
namespace NzbDrone.Api.NetImport
|
||||||
|
@ -10,5 +11,6 @@ namespace NzbDrone.Api.NetImport
|
||||||
public string RootFolderPath { get; set; }
|
public string RootFolderPath { get; set; }
|
||||||
public int ProfileId { get; set; }
|
public int ProfileId { get; set; }
|
||||||
public MovieStatusType MinimumAvailability { get; set; }
|
public MovieStatusType MinimumAvailability { get; set; }
|
||||||
|
public HashSet<int> Tags { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 = '[]'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
|
||||||
using (var mapper = _database.GetDataMapper())
|
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))
|
.SelectMany(v => GetUsedTags(v, mapper))
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
|
@ -701,6 +701,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
newMovie.Monitored = movie.Monitored;
|
newMovie.Monitored = movie.Monitored;
|
||||||
newMovie.MovieFile = movie.MovieFile;
|
newMovie.MovieFile = movie.MovieFile;
|
||||||
newMovie.MinimumAvailability = movie.MinimumAvailability;
|
newMovie.MinimumAvailability = movie.MinimumAvailability;
|
||||||
|
newMovie.Tags = movie.Tags;
|
||||||
|
|
||||||
return newMovie;
|
return newMovie;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,6 +118,7 @@ namespace NzbDrone.Core.NetImport
|
||||||
m.ProfileId = ((NetImportDefinition) Definition).ProfileId;
|
m.ProfileId = ((NetImportDefinition) Definition).ProfileId;
|
||||||
m.Monitored = ((NetImportDefinition) Definition).ShouldMonitor;
|
m.Monitored = ((NetImportDefinition) Definition).ShouldMonitor;
|
||||||
m.MinimumAvailability = ((NetImportDefinition) Definition).MinimumAvailability;
|
m.MinimumAvailability = ((NetImportDefinition) Definition).MinimumAvailability;
|
||||||
|
m.Tags = ((NetImportDefinition) Definition).Tags;
|
||||||
return m;
|
return m;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
@ -170,6 +171,5 @@ namespace NzbDrone.Core.NetImport
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Marr.Data;
|
using System.Collections.Generic;
|
||||||
|
using Marr.Data;
|
||||||
using NzbDrone.Core.Profiles;
|
using NzbDrone.Core.Profiles;
|
||||||
using NzbDrone.Core.ThingiProvider;
|
using NzbDrone.Core.ThingiProvider;
|
||||||
using NzbDrone.Core.Movies;
|
using NzbDrone.Core.Movies;
|
||||||
|
@ -7,6 +8,11 @@ namespace NzbDrone.Core.NetImport
|
||||||
{
|
{
|
||||||
public class NetImportDefinition : ProviderDefinition
|
public class NetImportDefinition : ProviderDefinition
|
||||||
{
|
{
|
||||||
|
public NetImportDefinition()
|
||||||
|
{
|
||||||
|
Tags = new HashSet<int>();
|
||||||
|
}
|
||||||
|
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
public bool EnableAuto { get; set; }
|
public bool EnableAuto { get; set; }
|
||||||
public bool ShouldMonitor { get; set; }
|
public bool ShouldMonitor { get; set; }
|
||||||
|
@ -15,5 +21,6 @@ namespace NzbDrone.Core.NetImport
|
||||||
public LazyLoaded<Profile> Profile { get; set; }
|
public LazyLoaded<Profile> Profile { get; set; }
|
||||||
public string RootFolderPath { get; set; }
|
public string RootFolderPath { get; set; }
|
||||||
public override bool Enable => Enabled;
|
public override bool Enable => Enabled;
|
||||||
|
public HashSet<int> Tags { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,6 +146,7 @@
|
||||||
<Compile Include="Datastore\Migration\144_add_cookies_to_indexer_status.cs" />
|
<Compile Include="Datastore\Migration\144_add_cookies_to_indexer_status.cs" />
|
||||||
<Compile Include="Datastore\Migration\149_convert_regex_required_tags.cs" />
|
<Compile Include="Datastore\Migration\149_convert_regex_required_tags.cs" />
|
||||||
<Compile Include="Datastore\Migration\150_fix_format_tags_double_underscore.cs" />
|
<Compile Include="Datastore\Migration\150_fix_format_tags_double_underscore.cs" />
|
||||||
|
<Compile Include="Datastore\Migration\151_add_tags_to_net_import.cs" />
|
||||||
<Compile Include="DecisionEngine\Specifications\CustomFormatAllowedByProfileSpecification.cs" />
|
<Compile Include="DecisionEngine\Specifications\CustomFormatAllowedByProfileSpecification.cs" />
|
||||||
<Compile Include="DecisionEngine\Specifications\MaximumSizeSpecification.cs" />
|
<Compile Include="DecisionEngine\Specifications\MaximumSizeSpecification.cs" />
|
||||||
<Compile Include="DecisionEngine\Specifications\RequiredIndexerFlagsSpecification.cs" />
|
<Compile Include="DecisionEngine\Specifications\RequiredIndexerFlagsSpecification.cs" />
|
||||||
|
@ -1335,4 +1336,4 @@
|
||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -22,6 +22,7 @@ var view = Marionette.ItemView.extend({
|
||||||
profile : '.x-profile',
|
profile : '.x-profile',
|
||||||
minimumAvailability : '.x-minimumavailability',
|
minimumAvailability : '.x-minimumavailability',
|
||||||
rootFolder : '.x-root-folder',
|
rootFolder : '.x-root-folder',
|
||||||
|
tags : '.x-tags'
|
||||||
},
|
},
|
||||||
|
|
||||||
events : {
|
events : {
|
||||||
|
@ -53,6 +54,10 @@ var view = Marionette.ItemView.extend({
|
||||||
this.ui.rootFolder.val(defaultRoot);
|
this.ui.rootFolder.val(defaultRoot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.ui.tags.tagInput({
|
||||||
|
model : this.model,
|
||||||
|
property : 'tags'
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_onBeforeSave : function() {
|
_onBeforeSave : function() {
|
||||||
|
|
|
@ -101,6 +101,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">Tags</label>
|
||||||
|
|
||||||
|
<div class="col-sm-5">
|
||||||
|
<input type="text" class="form-control x-tags">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{formBuilder}}
|
{{formBuilder}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue