mirror of
https://github.com/Radarr/Radarr
synced 2025-12-06 16:32:36 +01:00
WIP: New: Exclusion Lists
This commit is contained in:
parent
76cabb4927
commit
793cf22c3b
30 changed files with 100 additions and 84 deletions
|
|
@ -49,6 +49,12 @@ function EditImportListModalContent(props) {
|
||||||
fields
|
fields
|
||||||
} = item;
|
} = item;
|
||||||
|
|
||||||
|
const importListTypeOptions = [
|
||||||
|
{ key: 'manual', value: 'Manual' },
|
||||||
|
{ key: 'automatic', value: 'Automatic Add' },
|
||||||
|
{ key: 'exclusion', value: 'Exclusion List' }
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalContent onModalClose={onModalClose}>
|
<ModalContent onModalClose={onModalClose}>
|
||||||
<ModalHeader>
|
<ModalHeader>
|
||||||
|
|
@ -100,8 +106,9 @@ function EditImportListModalContent(props) {
|
||||||
<FormLabel>{translate('EnableAutomaticAdd')}</FormLabel>
|
<FormLabel>{translate('EnableAutomaticAdd')}</FormLabel>
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.CHECK}
|
type={inputTypes.SELECT}
|
||||||
name="enableAuto"
|
name="enableAuto"
|
||||||
|
values={importListTypeOptions}
|
||||||
helpText={translate('EnableAutoHelpText')}
|
helpText={translate('EnableAutoHelpText')}
|
||||||
{...enableAuto}
|
{...enableAuto}
|
||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ protected override void MapToResource(ImportListResource resource, ImportListDef
|
||||||
base.MapToResource(resource, definition);
|
base.MapToResource(resource, definition);
|
||||||
|
|
||||||
resource.Enabled = definition.Enabled;
|
resource.Enabled = definition.Enabled;
|
||||||
resource.EnableAuto = definition.EnableAuto;
|
resource.EnableAuto = (int)definition.EnableAuto;
|
||||||
resource.ProfileId = definition.ProfileId;
|
resource.ProfileId = definition.ProfileId;
|
||||||
resource.RootFolderPath = definition.RootFolderPath;
|
resource.RootFolderPath = definition.RootFolderPath;
|
||||||
resource.ShouldMonitor = definition.ShouldMonitor;
|
resource.ShouldMonitor = definition.ShouldMonitor;
|
||||||
|
|
@ -34,7 +34,7 @@ protected override void MapToModel(ImportListDefinition definition, ImportListRe
|
||||||
base.MapToModel(definition, resource);
|
base.MapToModel(definition, resource);
|
||||||
|
|
||||||
definition.Enabled = resource.Enabled;
|
definition.Enabled = resource.Enabled;
|
||||||
definition.EnableAuto = resource.EnableAuto;
|
definition.EnableAuto = (ImportListType)resource.EnableAuto;
|
||||||
definition.ProfileId = resource.ProfileId;
|
definition.ProfileId = resource.ProfileId;
|
||||||
definition.RootFolderPath = resource.RootFolderPath;
|
definition.RootFolderPath = resource.RootFolderPath;
|
||||||
definition.ShouldMonitor = resource.ShouldMonitor;
|
definition.ShouldMonitor = resource.ShouldMonitor;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ namespace NzbDrone.Api.ImportList
|
||||||
public class ImportListResource : ProviderResource
|
public class ImportListResource : ProviderResource
|
||||||
{
|
{
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
public bool EnableAuto { get; set; }
|
public int EnableAuto { get; set; }
|
||||||
public bool ShouldMonitor { get; set; }
|
public bool ShouldMonitor { get; set; }
|
||||||
public string RootFolderPath { get; set; }
|
public string RootFolderPath { get; set; }
|
||||||
public int ProfileId { get; set; }
|
public int ProfileId { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ private Mock<IImportList> GivenList(int i, double backoffHours, double failureHo
|
||||||
|
|
||||||
var mockList = new Mock<IImportList>();
|
var mockList = new Mock<IImportList>();
|
||||||
mockList.SetupGet(s => s.Definition).Returns(new ImportListDefinition { Id = id });
|
mockList.SetupGet(s => s.Definition).Returns(new ImportListDefinition { Id = id });
|
||||||
mockList.SetupGet(s => s.EnableAuto).Returns(true);
|
mockList.SetupGet(s => s.EnableAuto).Returns(ImportListType.Automatic);
|
||||||
|
|
||||||
_lists.Add(mockList.Object);
|
_lists.Add(mockList.Object);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,12 @@ public void Setup()
|
||||||
.Returns<Movie>(m => new Movie { TmdbId = m.TmdbId });
|
.Returns<Movie>(m => new Movie { TmdbId = m.TmdbId });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenList(int id, bool enabled, bool enabledAuto, ImportListFetchResult fetchResult)
|
private void GivenList(int id, bool enabled, ImportListType enabledAuto, ImportListFetchResult fetchResult)
|
||||||
{
|
{
|
||||||
CreateListResult(id, enabled, enabledAuto, fetchResult);
|
CreateListResult(id, enabled, enabledAuto, fetchResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mock<IImportList> CreateListResult(int id, bool enabled, bool enabledAuto, ImportListFetchResult fetchResult)
|
private Mock<IImportList> CreateListResult(int id, bool enabled, ImportListType enabledAuto, ImportListFetchResult fetchResult)
|
||||||
{
|
{
|
||||||
var importListDefinition = new ImportListDefinition { Id = id, EnableAuto = enabledAuto };
|
var importListDefinition = new ImportListDefinition { Id = id, EnableAuto = enabledAuto };
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ private void GivenBlockedList(int id)
|
||||||
public void should_return_failure_if_blocked_list()
|
public void should_return_failure_if_blocked_list()
|
||||||
{
|
{
|
||||||
var fetchResult = new ImportListFetchResult();
|
var fetchResult = new ImportListFetchResult();
|
||||||
GivenList(1, true, true, fetchResult);
|
GivenList(1, true, ImportListType.Automatic, fetchResult);
|
||||||
GivenBlockedList(1);
|
GivenBlockedList(1);
|
||||||
|
|
||||||
var listResult = Subject.Fetch();
|
var listResult = Subject.Fetch();
|
||||||
|
|
@ -82,11 +82,11 @@ public void should_return_failure_if_blocked_list()
|
||||||
public void should_return_failure_if_one_blocked_list_one_good_list()
|
public void should_return_failure_if_one_blocked_list_one_good_list()
|
||||||
{
|
{
|
||||||
var fetchResult1 = new ImportListFetchResult();
|
var fetchResult1 = new ImportListFetchResult();
|
||||||
GivenList(1, true, true, fetchResult1);
|
GivenList(1, true, ImportListType.Automatic, fetchResult1);
|
||||||
GivenBlockedList(1);
|
GivenBlockedList(1);
|
||||||
|
|
||||||
var fetchResult2 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = true };
|
var fetchResult2 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = true };
|
||||||
GivenList(2, true, true, fetchResult2);
|
GivenList(2, true, ImportListType.Automatic, fetchResult2);
|
||||||
|
|
||||||
var listResult = Subject.Fetch();
|
var listResult = Subject.Fetch();
|
||||||
listResult.AnyFailure.Should().BeTrue();
|
listResult.AnyFailure.Should().BeTrue();
|
||||||
|
|
@ -96,7 +96,7 @@ public void should_return_failure_if_one_blocked_list_one_good_list()
|
||||||
public void should_return_failure_if_single_list_fails()
|
public void should_return_failure_if_single_list_fails()
|
||||||
{
|
{
|
||||||
var fetchResult = new ImportListFetchResult { Movies = _listMovies, AnyFailure = true };
|
var fetchResult = new ImportListFetchResult { Movies = _listMovies, AnyFailure = true };
|
||||||
GivenList(1, true, true, fetchResult);
|
GivenList(1, true, ImportListType.Automatic, fetchResult);
|
||||||
|
|
||||||
var listResult = Subject.Fetch();
|
var listResult = Subject.Fetch();
|
||||||
listResult.AnyFailure.Should().BeTrue();
|
listResult.AnyFailure.Should().BeTrue();
|
||||||
|
|
@ -106,9 +106,9 @@ public void should_return_failure_if_single_list_fails()
|
||||||
public void should_return_failure_if_any_list_fails()
|
public void should_return_failure_if_any_list_fails()
|
||||||
{
|
{
|
||||||
var fetchResult1 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = true };
|
var fetchResult1 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = true };
|
||||||
GivenList(1, true, true, fetchResult1);
|
GivenList(1, true, ImportListType.Automatic, fetchResult1);
|
||||||
var fetchResult2 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = false };
|
var fetchResult2 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = false };
|
||||||
GivenList(2, true, true, fetchResult2);
|
GivenList(2, true, ImportListType.Automatic, fetchResult2);
|
||||||
|
|
||||||
var listResult = Subject.Fetch();
|
var listResult = Subject.Fetch();
|
||||||
listResult.AnyFailure.Should().BeTrue();
|
listResult.AnyFailure.Should().BeTrue();
|
||||||
|
|
@ -131,7 +131,7 @@ public void should_store_movies_if_list_doesnt_fail()
|
||||||
{
|
{
|
||||||
var listId = 1;
|
var listId = 1;
|
||||||
var fetchResult = new ImportListFetchResult { Movies = _listMovies, AnyFailure = false };
|
var fetchResult = new ImportListFetchResult { Movies = _listMovies, AnyFailure = false };
|
||||||
GivenList(listId, true, true, fetchResult);
|
GivenList(listId, true, ImportListType.Automatic, fetchResult);
|
||||||
|
|
||||||
var listResult = Subject.Fetch();
|
var listResult = Subject.Fetch();
|
||||||
listResult.AnyFailure.Should().BeFalse();
|
listResult.AnyFailure.Should().BeFalse();
|
||||||
|
|
@ -145,7 +145,7 @@ public void should_not_store_movies_if_list_fails()
|
||||||
{
|
{
|
||||||
var listId = 1;
|
var listId = 1;
|
||||||
var fetchResult = new ImportListFetchResult { Movies = _listMovies, AnyFailure = true };
|
var fetchResult = new ImportListFetchResult { Movies = _listMovies, AnyFailure = true };
|
||||||
GivenList(listId, true, true, fetchResult);
|
GivenList(listId, true, ImportListType.Automatic, fetchResult);
|
||||||
|
|
||||||
var listResult = Subject.Fetch();
|
var listResult = Subject.Fetch();
|
||||||
listResult.AnyFailure.Should().BeTrue();
|
listResult.AnyFailure.Should().BeTrue();
|
||||||
|
|
@ -159,10 +159,10 @@ public void should_only_store_movies_for_lists_that_dont_fail()
|
||||||
{
|
{
|
||||||
var passedListId = 1;
|
var passedListId = 1;
|
||||||
var fetchResult1 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = false };
|
var fetchResult1 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = false };
|
||||||
GivenList(passedListId, true, true, fetchResult1);
|
GivenList(passedListId, true, ImportListType.Automatic, fetchResult1);
|
||||||
var failedListId = 2;
|
var failedListId = 2;
|
||||||
var fetchResult2 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = true };
|
var fetchResult2 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = true };
|
||||||
GivenList(failedListId, true, true, fetchResult2);
|
GivenList(failedListId, true, ImportListType.Automatic, fetchResult2);
|
||||||
|
|
||||||
var listResult = Subject.Fetch();
|
var listResult = Subject.Fetch();
|
||||||
listResult.AnyFailure.Should().BeTrue();
|
listResult.AnyFailure.Should().BeTrue();
|
||||||
|
|
@ -176,10 +176,10 @@ public void should_return_all_results_for_all_lists()
|
||||||
{
|
{
|
||||||
var passedListId = 1;
|
var passedListId = 1;
|
||||||
var fetchResult1 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = false };
|
var fetchResult1 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = false };
|
||||||
GivenList(passedListId, true, true, fetchResult1);
|
GivenList(passedListId, true, ImportListType.Automatic, fetchResult1);
|
||||||
var failedListId = 2;
|
var failedListId = 2;
|
||||||
var fetchResult2 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = false };
|
var fetchResult2 = new ImportListFetchResult { Movies = _listMovies, AnyFailure = false };
|
||||||
GivenList(failedListId, true, true, fetchResult2);
|
GivenList(failedListId, true, ImportListType.Automatic, fetchResult2);
|
||||||
|
|
||||||
var listResult = Subject.Fetch();
|
var listResult = Subject.Fetch();
|
||||||
listResult.AnyFailure.Should().BeFalse();
|
listResult.AnyFailure.Should().BeFalse();
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ private void GivenCleanLevel(string cleanLevel)
|
||||||
.Returns(cleanLevel);
|
.Returns(cleanLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenList(int id, bool enabledAuto)
|
private void GivenList(int id, ImportListType enabledAuto)
|
||||||
{
|
{
|
||||||
var importListDefinition = new ImportListDefinition { Id = id, EnableAuto = enabledAuto };
|
var importListDefinition = new ImportListDefinition { Id = id, EnableAuto = enabledAuto };
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ private void GivenList(int id, bool enabledAuto)
|
||||||
CreateListResult(id, enabledAuto);
|
CreateListResult(id, enabledAuto);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mock<IImportList> CreateListResult(int id, bool enabledAuto)
|
private Mock<IImportList> CreateListResult(int id, ImportListType enabledAuto)
|
||||||
{
|
{
|
||||||
var importListDefinition = new ImportListDefinition { Id = id, EnableAuto = enabledAuto };
|
var importListDefinition = new ImportListDefinition { Id = id, EnableAuto = enabledAuto };
|
||||||
|
|
||||||
|
|
@ -133,7 +133,7 @@ private Mock<IImportList> CreateListResult(int id, bool enabledAuto)
|
||||||
public void should_not_clean_library_if_config_value_disable()
|
public void should_not_clean_library_if_config_value_disable()
|
||||||
{
|
{
|
||||||
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenCleanLevel("disabled");
|
GivenCleanLevel("disabled");
|
||||||
|
|
||||||
Subject.Execute(_commandAll);
|
Subject.Execute(_commandAll);
|
||||||
|
|
@ -149,7 +149,7 @@ public void should_not_clean_library_if_config_value_disable()
|
||||||
public void should_log_only_on_clean_library_if_config_value_logonly()
|
public void should_log_only_on_clean_library_if_config_value_logonly()
|
||||||
{
|
{
|
||||||
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenCleanLevel("logOnly");
|
GivenCleanLevel("logOnly");
|
||||||
|
|
||||||
Mocker.GetMock<IMovieService>()
|
Mocker.GetMock<IMovieService>()
|
||||||
|
|
@ -172,7 +172,7 @@ public void should_log_only_on_clean_library_if_config_value_logonly()
|
||||||
public void should_unmonitor_on_clean_library_if_config_value_keepAndUnmonitor()
|
public void should_unmonitor_on_clean_library_if_config_value_keepAndUnmonitor()
|
||||||
{
|
{
|
||||||
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenCleanLevel("keepAndUnmonitor");
|
GivenCleanLevel("keepAndUnmonitor");
|
||||||
|
|
||||||
Mocker.GetMock<IMovieService>()
|
Mocker.GetMock<IMovieService>()
|
||||||
|
|
@ -197,7 +197,7 @@ public void should_not_clean_on_clean_library_if_tmdb_match()
|
||||||
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
||||||
_importListFetch.Movies[0].TmdbId = 6;
|
_importListFetch.Movies[0].TmdbId = 6;
|
||||||
|
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenCleanLevel("keepAndUnmonitor");
|
GivenCleanLevel("keepAndUnmonitor");
|
||||||
|
|
||||||
Mocker.GetMock<IMovieService>()
|
Mocker.GetMock<IMovieService>()
|
||||||
|
|
@ -217,7 +217,7 @@ public void should_fallback_to_imdbid_on_clean_library_if_tmdb_not_found()
|
||||||
_importListFetch.Movies[0].TmdbId = 0;
|
_importListFetch.Movies[0].TmdbId = 0;
|
||||||
_importListFetch.Movies[0].ImdbId = "6";
|
_importListFetch.Movies[0].ImdbId = "6";
|
||||||
|
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenCleanLevel("keepAndUnmonitor");
|
GivenCleanLevel("keepAndUnmonitor");
|
||||||
|
|
||||||
Mocker.GetMock<IMovieService>()
|
Mocker.GetMock<IMovieService>()
|
||||||
|
|
@ -234,7 +234,7 @@ public void should_fallback_to_imdbid_on_clean_library_if_tmdb_not_found()
|
||||||
public void should_delete_movies_not_files_on_clean_library_if_config_value_logonly()
|
public void should_delete_movies_not_files_on_clean_library_if_config_value_logonly()
|
||||||
{
|
{
|
||||||
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenCleanLevel("removeAndKeep");
|
GivenCleanLevel("removeAndKeep");
|
||||||
|
|
||||||
Mocker.GetMock<IMovieService>()
|
Mocker.GetMock<IMovieService>()
|
||||||
|
|
@ -260,7 +260,7 @@ public void should_delete_movies_not_files_on_clean_library_if_config_value_logo
|
||||||
public void should_delete_movies_and_files_on_clean_library_if_config_value_logonly()
|
public void should_delete_movies_and_files_on_clean_library_if_config_value_logonly()
|
||||||
{
|
{
|
||||||
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenCleanLevel("removeAndDelete");
|
GivenCleanLevel("removeAndDelete");
|
||||||
|
|
||||||
Mocker.GetMock<IMovieService>()
|
Mocker.GetMock<IMovieService>()
|
||||||
|
|
@ -288,7 +288,7 @@ public void should_not_clean_if_list_failures()
|
||||||
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
||||||
GivenListFailure();
|
GivenListFailure();
|
||||||
|
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenCleanLevel("disabled");
|
GivenCleanLevel("disabled");
|
||||||
|
|
||||||
Subject.Execute(_commandAll);
|
Subject.Execute(_commandAll);
|
||||||
|
|
@ -301,7 +301,7 @@ public void should_not_clean_if_list_failures()
|
||||||
public void should_add_new_movies_from_single_list_to_library()
|
public void should_add_new_movies_from_single_list_to_library()
|
||||||
{
|
{
|
||||||
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenCleanLevel("disabled");
|
GivenCleanLevel("disabled");
|
||||||
|
|
||||||
Subject.Execute(_commandAll);
|
Subject.Execute(_commandAll);
|
||||||
|
|
@ -317,8 +317,8 @@ public void should_add_new_movies_from_multiple_list_to_library()
|
||||||
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
||||||
_importListFetch.Movies.AddRange(_list2Movies);
|
_importListFetch.Movies.AddRange(_list2Movies);
|
||||||
|
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenList(2, true);
|
GivenList(2, ImportListType.Automatic);
|
||||||
|
|
||||||
GivenCleanLevel("disabled");
|
GivenCleanLevel("disabled");
|
||||||
|
|
||||||
|
|
@ -335,8 +335,8 @@ public void should_add_new_movies_from_enabled_lists_to_library()
|
||||||
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
||||||
_importListFetch.Movies.AddRange(_list2Movies);
|
_importListFetch.Movies.AddRange(_list2Movies);
|
||||||
|
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenList(2, false);
|
GivenList(2, ImportListType.Manual);
|
||||||
|
|
||||||
GivenCleanLevel("disabled");
|
GivenCleanLevel("disabled");
|
||||||
|
|
||||||
|
|
@ -354,8 +354,8 @@ public void should_not_add_duplicate_movies_from_seperate_lists()
|
||||||
_importListFetch.Movies.AddRange(_list2Movies);
|
_importListFetch.Movies.AddRange(_list2Movies);
|
||||||
_importListFetch.Movies[0].TmdbId = 4;
|
_importListFetch.Movies[0].TmdbId = 4;
|
||||||
|
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenList(2, true);
|
GivenList(2, ImportListType.Automatic);
|
||||||
|
|
||||||
GivenCleanLevel("disabled");
|
GivenCleanLevel("disabled");
|
||||||
|
|
||||||
|
|
@ -372,8 +372,8 @@ public void should_not_add_movie_from_on_exclusion_list()
|
||||||
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
||||||
_importListFetch.Movies.AddRange(_list2Movies);
|
_importListFetch.Movies.AddRange(_list2Movies);
|
||||||
|
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenList(2, true);
|
GivenList(2, ImportListType.Automatic);
|
||||||
|
|
||||||
GivenCleanLevel("disabled");
|
GivenCleanLevel("disabled");
|
||||||
|
|
||||||
|
|
@ -394,8 +394,8 @@ public void should_not_add_movie_that_exists_in_library()
|
||||||
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
_importListFetch.Movies.ForEach(m => m.ListId = 1);
|
||||||
_importListFetch.Movies.AddRange(_list2Movies);
|
_importListFetch.Movies.AddRange(_list2Movies);
|
||||||
|
|
||||||
GivenList(1, true);
|
GivenList(1, ImportListType.Automatic);
|
||||||
GivenList(2, true);
|
GivenList(2, ImportListType.Automatic);
|
||||||
|
|
||||||
GivenCleanLevel("disabled");
|
GivenCleanLevel("disabled");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ public class CouchPotatoImport : HttpImportListBase<CouchPotatoSettings>
|
||||||
{
|
{
|
||||||
public override string Name => "CouchPotato";
|
public override string Name => "CouchPotato";
|
||||||
|
|
||||||
public override ImportListType ListType => ImportListType.Program;
|
public override ImportListSource ListType => ImportListSource.Program;
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public CouchPotatoImport(IHttpClient httpClient, IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
public CouchPotatoImport(IHttpClient httpClient, IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||||
: base(httpClient, importListStatusService, configService, parsingService, logger)
|
: base(httpClient, importListStatusService, configService, parsingService, logger)
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ namespace NzbDrone.Core.ImportLists
|
||||||
public interface IImportList : IProvider
|
public interface IImportList : IProvider
|
||||||
{
|
{
|
||||||
bool Enabled { get; }
|
bool Enabled { get; }
|
||||||
bool EnableAuto { get; }
|
ImportListType EnableAuto { get; }
|
||||||
|
|
||||||
ImportListType ListType { get; }
|
ImportListSource ListType { get; }
|
||||||
ImportListFetchResult Fetch();
|
ImportListFetchResult Fetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@ public abstract class ImportListBase<TSettings> : IImportList
|
||||||
|
|
||||||
public abstract string Name { get; }
|
public abstract string Name { get; }
|
||||||
|
|
||||||
public abstract ImportListType ListType { get; }
|
public abstract ImportListSource ListType { get; }
|
||||||
public abstract bool Enabled { get; }
|
public abstract bool Enabled { get; }
|
||||||
public abstract bool EnableAuto { get; }
|
public abstract ImportListType EnableAuto { get; }
|
||||||
|
|
||||||
public abstract ImportListFetchResult Fetch();
|
public abstract ImportListFetchResult Fetch();
|
||||||
|
|
||||||
|
|
@ -59,7 +59,7 @@ public virtual IEnumerable<ProviderDefinition> DefaultDefinitions
|
||||||
{
|
{
|
||||||
Name = GetType().Name,
|
Name = GetType().Name,
|
||||||
Enabled = config.Validate().IsValid && Enabled,
|
Enabled = config.Validate().IsValid && Enabled,
|
||||||
EnableAuto = true,
|
EnableAuto = ImportListType.Automatic,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = config
|
Settings = config
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public ImportListDefinition()
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
public bool EnableAuto { get; set; }
|
public ImportListType EnableAuto { get; set; }
|
||||||
public bool ShouldMonitor { get; set; }
|
public bool ShouldMonitor { get; set; }
|
||||||
public MovieStatusType MinimumAvailability { get; set; }
|
public MovieStatusType MinimumAvailability { get; set; }
|
||||||
public int ProfileId { get; set; }
|
public int ProfileId { get; set; }
|
||||||
|
|
@ -20,6 +20,6 @@ public ImportListDefinition()
|
||||||
public bool SearchOnAdd { get; set; }
|
public bool SearchOnAdd { get; set; }
|
||||||
public override bool Enable => Enabled;
|
public override bool Enable => Enabled;
|
||||||
|
|
||||||
public ImportListType ListType { get; set; }
|
public ImportListSource ListType { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
src/NzbDrone.Core/ImportLists/ImportListSource.cs
Normal file
11
src/NzbDrone.Core/ImportLists/ImportListSource.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace NzbDrone.Core.ImportLists
|
||||||
|
{
|
||||||
|
public enum ImportListSource
|
||||||
|
{
|
||||||
|
Program,
|
||||||
|
TMDB,
|
||||||
|
Trakt,
|
||||||
|
Other,
|
||||||
|
Advanced
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -51,7 +51,7 @@ private void SyncAll()
|
||||||
{
|
{
|
||||||
var result = _listFetcherAndParser.Fetch();
|
var result = _listFetcherAndParser.Fetch();
|
||||||
|
|
||||||
if (_importListFactory.Enabled().Where(a => ((ImportListDefinition)a.Definition).EnableAuto).Empty())
|
if (_importListFactory.Enabled().Where(a => ((ImportListDefinition)a.Definition).EnableAuto == ImportListType.Automatic).Empty())
|
||||||
{
|
{
|
||||||
_logger.Info("No auto enabled lists, skipping sync and cleaning");
|
_logger.Info("No auto enabled lists, skipping sync and cleaning");
|
||||||
return;
|
return;
|
||||||
|
|
@ -67,7 +67,7 @@ private void SyncAll()
|
||||||
|
|
||||||
private void ProcessMovieReport(ImportListDefinition importList, ImportListMovie report, List<ImportExclusion> listExclusions, List<int> dbMovies, List<Movie> moviesToAdd)
|
private void ProcessMovieReport(ImportListDefinition importList, ImportListMovie report, List<ImportExclusion> listExclusions, List<int> dbMovies, List<Movie> moviesToAdd)
|
||||||
{
|
{
|
||||||
if (report.TmdbId == 0 || !importList.EnableAuto)
|
if (report.TmdbId == 0 || importList.EnableAuto != ImportListType.Automatic)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,8 @@ namespace NzbDrone.Core.ImportLists
|
||||||
{
|
{
|
||||||
public enum ImportListType
|
public enum ImportListType
|
||||||
{
|
{
|
||||||
Program,
|
Manual,
|
||||||
TMDB,
|
Automatic,
|
||||||
Trakt,
|
Exclusion
|
||||||
Other,
|
|
||||||
Advanced
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ public class RSSImport : HttpImportListBase<RSSImportSettings>
|
||||||
{
|
{
|
||||||
public override string Name => "RSS List";
|
public override string Name => "RSS List";
|
||||||
|
|
||||||
public override ImportListType ListType => ImportListType.Advanced;
|
public override ImportListSource ListType => ImportListSource.Advanced;
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public RSSImport(IHttpClient httpClient, IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
public RSSImport(IHttpClient httpClient, IImportListStatusService importListStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||||
: base(httpClient, importListStatusService, configService, parsingService, logger)
|
: base(httpClient, importListStatusService, configService, parsingService, logger)
|
||||||
|
|
@ -33,7 +33,7 @@ public override IEnumerable<ProviderDefinition> DefaultDefinitions
|
||||||
{
|
{
|
||||||
Name = "IMDb List",
|
Name = "IMDb List",
|
||||||
Enabled = Enabled,
|
Enabled = Enabled,
|
||||||
EnableAuto = true,
|
EnableAuto = ImportListType.Automatic,
|
||||||
ProfileId = 1,
|
ProfileId = 1,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = new RSSImportSettings { Link = "https://rss.imdb.com/list/YOURLISTID" },
|
Settings = new RSSImportSettings { Link = "https://rss.imdb.com/list/YOURLISTID" },
|
||||||
|
|
@ -42,7 +42,7 @@ public override IEnumerable<ProviderDefinition> DefaultDefinitions
|
||||||
{
|
{
|
||||||
Name = "IMDb Watchlist",
|
Name = "IMDb Watchlist",
|
||||||
Enabled = Enabled,
|
Enabled = Enabled,
|
||||||
EnableAuto = true,
|
EnableAuto = ImportListType.Automatic,
|
||||||
ProfileId = 1,
|
ProfileId = 1,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = new RSSImportSettings { Link = "https://rss.imdb.com/user/IMDBUSERID/watchlist" },
|
Settings = new RSSImportSettings { Link = "https://rss.imdb.com/user/IMDBUSERID/watchlist" },
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ public class RadarrImport : ImportListBase<RadarrSettings>
|
||||||
private readonly IRadarrV3Proxy _radarrV3Proxy;
|
private readonly IRadarrV3Proxy _radarrV3Proxy;
|
||||||
public override string Name => "Radarr";
|
public override string Name => "Radarr";
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public override ImportListType ListType => ImportListType.Program;
|
public override ImportListSource ListType => ImportListSource.Program;
|
||||||
|
|
||||||
public RadarrImport(IRadarrV3Proxy radarrV3Proxy,
|
public RadarrImport(IRadarrV3Proxy radarrV3Proxy,
|
||||||
IImportListStatusService importListStatusService,
|
IImportListStatusService importListStatusService,
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ public class RadarrListImport : HttpImportListBase<RadarrListSettings>
|
||||||
{
|
{
|
||||||
public override string Name => "Custom Lists";
|
public override string Name => "Custom Lists";
|
||||||
|
|
||||||
public override ImportListType ListType => ImportListType.Advanced;
|
public override ImportListSource ListType => ImportListSource.Advanced;
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public RadarrListImport(IHttpClient httpClient,
|
public RadarrListImport(IHttpClient httpClient,
|
||||||
IImportListStatusService importListStatusService,
|
IImportListStatusService importListStatusService,
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ public class IMDbListImport : HttpImportListBase<IMDbListSettings>
|
||||||
|
|
||||||
public override string Name => "IMDb Lists";
|
public override string Name => "IMDb Lists";
|
||||||
|
|
||||||
public override ImportListType ListType => ImportListType.Other;
|
public override ImportListSource ListType => ImportListSource.Other;
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public IMDbListImport(IRadarrCloudRequestBuilder requestBuilder,
|
public IMDbListImport(IRadarrCloudRequestBuilder requestBuilder,
|
||||||
IHttpClient httpClient,
|
IHttpClient httpClient,
|
||||||
|
|
@ -42,7 +42,7 @@ public override IEnumerable<ProviderDefinition> DefaultDefinitions
|
||||||
{
|
{
|
||||||
Name = "IMDb Top 250",
|
Name = "IMDb Top 250",
|
||||||
Enabled = Enabled,
|
Enabled = Enabled,
|
||||||
EnableAuto = true,
|
EnableAuto = ImportListType.Automatic,
|
||||||
ProfileId = 1,
|
ProfileId = 1,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = new IMDbListSettings { ListId = "top250" },
|
Settings = new IMDbListSettings { ListId = "top250" },
|
||||||
|
|
@ -51,7 +51,7 @@ public override IEnumerable<ProviderDefinition> DefaultDefinitions
|
||||||
{
|
{
|
||||||
Name = "IMDb Popular Movies",
|
Name = "IMDb Popular Movies",
|
||||||
Enabled = Enabled,
|
Enabled = Enabled,
|
||||||
EnableAuto = true,
|
EnableAuto = ImportListType.Automatic,
|
||||||
ProfileId = 1,
|
ProfileId = 1,
|
||||||
Implementation = GetType().Name,
|
Implementation = GetType().Name,
|
||||||
Settings = new IMDbListSettings { ListId = "popular" },
|
Settings = new IMDbListSettings { ListId = "popular" },
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ public class StevenLu2Import : HttpImportListBase<StevenLu2Settings>
|
||||||
|
|
||||||
public override string Name => "StevenLu List";
|
public override string Name => "StevenLu List";
|
||||||
|
|
||||||
public override ImportListType ListType => ImportListType.Other;
|
public override ImportListSource ListType => ImportListSource.Other;
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public StevenLu2Import(IRadarrCloudRequestBuilder requestBuilder,
|
public StevenLu2Import(IRadarrCloudRequestBuilder requestBuilder,
|
||||||
IHttpClient httpClient,
|
IHttpClient httpClient,
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ public class StevenLuImport : HttpImportListBase<StevenLuSettings>
|
||||||
{
|
{
|
||||||
public override string Name => "StevenLu Custom";
|
public override string Name => "StevenLu Custom";
|
||||||
|
|
||||||
public override ImportListType ListType => ImportListType.Advanced;
|
public override ImportListSource ListType => ImportListSource.Advanced;
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public StevenLuImport(IHttpClient httpClient,
|
public StevenLuImport(IHttpClient httpClient,
|
||||||
IImportListStatusService importListStatusService,
|
IImportListStatusService importListStatusService,
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public TMDbCollectionImport(IRadarrCloudRequestBuilder requestBuilder,
|
||||||
|
|
||||||
public override string Name => "TMDb Collection";
|
public override string Name => "TMDb Collection";
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public override IParseImportListResponse GetParser()
|
public override IParseImportListResponse GetParser()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public TMDbListImport(IRadarrCloudRequestBuilder requestBuilder,
|
||||||
|
|
||||||
public override string Name => "TMDb List";
|
public override string Name => "TMDb List";
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public override IParseImportListResponse GetParser()
|
public override IParseImportListResponse GetParser()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public TMDbPersonImport(IRadarrCloudRequestBuilder requestBuilder,
|
||||||
|
|
||||||
public override string Name => "TMDb Person";
|
public override string Name => "TMDb Person";
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public override IParseImportListResponse GetParser()
|
public override IParseImportListResponse GetParser()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public TMDbPopularImport(IRadarrCloudRequestBuilder requestBuilder,
|
||||||
|
|
||||||
public override string Name => "TMDb Popular";
|
public override string Name => "TMDb Popular";
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public override IParseImportListResponse GetParser()
|
public override IParseImportListResponse GetParser()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace NzbDrone.Core.ImportLists.TMDb
|
||||||
public abstract class TMDbImportListBase<TSettings> : HttpImportListBase<TSettings>
|
public abstract class TMDbImportListBase<TSettings> : HttpImportListBase<TSettings>
|
||||||
where TSettings : TMDbSettingsBase<TSettings>, new()
|
where TSettings : TMDbSettingsBase<TSettings>, new()
|
||||||
{
|
{
|
||||||
public override ImportListType ListType => ImportListType.TMDB;
|
public override ImportListSource ListType => ImportListSource.TMDB;
|
||||||
|
|
||||||
public readonly ISearchForNewMovie _skyhookProxy;
|
public readonly ISearchForNewMovie _skyhookProxy;
|
||||||
public readonly IHttpRequestBuilderFactory _requestBuilder;
|
public readonly IHttpRequestBuilderFactory _requestBuilder;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public TMDbUserImport(IRadarrCloudRequestBuilder requestBuilder,
|
||||||
|
|
||||||
public override string Name => "TMDb User";
|
public override string Name => "TMDb User";
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public override IParseImportListResponse GetParser()
|
public override IParseImportListResponse GetParser()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public TraktListImport(IImportListRepository importListRepository,
|
||||||
|
|
||||||
public override string Name => "Trakt List";
|
public override string Name => "Trakt List";
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public override IImportListRequestGenerator GetRequestGenerator()
|
public override IImportListRequestGenerator GetRequestGenerator()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public TraktPopularImport(IImportListRepository importListRepository,
|
||||||
|
|
||||||
public override string Name => "Trakt Popular List";
|
public override string Name => "Trakt Popular List";
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public override IParseImportListResponse GetParser()
|
public override IParseImportListResponse GetParser()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ public abstract class TraktImportBase<TSettings> : HttpImportListBase<TSettings>
|
||||||
{
|
{
|
||||||
public ITraktProxy _traktProxy;
|
public ITraktProxy _traktProxy;
|
||||||
private readonly IImportListRepository _importListRepository;
|
private readonly IImportListRepository _importListRepository;
|
||||||
public override ImportListType ListType => ImportListType.Trakt;
|
public override ImportListSource ListType => ImportListSource.Trakt;
|
||||||
|
|
||||||
protected TraktImportBase(IImportListRepository importListRepository,
|
protected TraktImportBase(IImportListRepository importListRepository,
|
||||||
ITraktProxy traktProxy,
|
ITraktProxy traktProxy,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public TraktUserImport(IImportListRepository importListRepository,
|
||||||
|
|
||||||
public override string Name => "Trakt User";
|
public override string Name => "Trakt User";
|
||||||
public override bool Enabled => true;
|
public override bool Enabled => true;
|
||||||
public override bool EnableAuto => false;
|
public override ImportListType EnableAuto => ImportListType.Manual;
|
||||||
|
|
||||||
public override IImportListRequestGenerator GetRequestGenerator()
|
public override IImportListRequestGenerator GetRequestGenerator()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@ namespace Radarr.Api.V3.ImportLists
|
||||||
public class ImportListResource : ProviderResource
|
public class ImportListResource : ProviderResource
|
||||||
{
|
{
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
public bool EnableAuto { get; set; }
|
public ImportListType EnableAuto { get; set; }
|
||||||
public bool ShouldMonitor { get; set; }
|
public bool ShouldMonitor { get; set; }
|
||||||
public string RootFolderPath { get; set; }
|
public string RootFolderPath { get; set; }
|
||||||
public int QualityProfileId { get; set; }
|
public int QualityProfileId { get; set; }
|
||||||
public bool SearchOnAdd { get; set; }
|
public bool SearchOnAdd { get; set; }
|
||||||
public MovieStatusType MinimumAvailability { get; set; }
|
public MovieStatusType MinimumAvailability { get; set; }
|
||||||
public ImportListType ListType { get; set; }
|
public ImportListSource ListType { get; set; }
|
||||||
public int ListOrder { get; set; }
|
public int ListOrder { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue