mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
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 @@ 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)
|
||||
|
@ -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<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 @@ 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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -118,6 +118,7 @@ protected virtual IList<Movie> 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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<int>();
|
||||
}
|
||||
|
||||
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> Profile { get; set; }
|
||||
public string RootFolderPath { get; set; }
|
||||
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\149_convert_regex_required_tags.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\MaximumSizeSpecification.cs" />
|
||||
<Compile Include="DecisionEngine\Specifications\RequiredIndexerFlagsSpecification.cs" />
|
||||
@ -1335,4 +1336,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -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() {
|
||||
|
@ -101,6 +101,14 @@
|
||||
</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}}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user