From 25baf7bb45d92bdeb51063d5a14f8d1d9bc02253 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 2 Oct 2020 16:14:00 -0700 Subject: [PATCH] New: Series type and season folder options for import lists Closes #3982 --- .../ImportLists/EditImportListModalContent.js | 45 +++++++++++++++++-- .../src/Store/Actions/Settings/importLists.js | 2 + .../Datastore/Migration/144_import_lists.cs | 15 +++++++ .../ImportLists/ImportListDefinition.cs | 2 + .../ImportLists/ImportListSyncService.cs | 11 ++--- .../ImportLists/ImportListResource.cs | 6 +++ 6 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 src/NzbDrone.Core/Datastore/Migration/144_import_lists.cs diff --git a/frontend/src/Settings/ImportLists/ImportLists/EditImportListModalContent.js b/frontend/src/Settings/ImportLists/ImportLists/EditImportListModalContent.js index 1bbae4177..d577851a1 100644 --- a/frontend/src/Settings/ImportLists/ImportLists/EditImportListModalContent.js +++ b/frontend/src/Settings/ImportLists/ImportLists/EditImportListModalContent.js @@ -1,5 +1,6 @@ import PropTypes from 'prop-types'; import React from 'react'; +import SeriesTypePopoverContent from 'AddSeries/SeriesTypePopoverContent'; import SeriesMonitoringOptionsPopoverContent from 'AddSeries/SeriesMonitoringOptionsPopoverContent'; import { icons, inputTypes, kinds, tooltipPositions } from 'Helpers/Props'; import Icon from 'Components/Icon'; @@ -46,6 +47,8 @@ function EditImportListModalContent(props) { rootFolderPath, qualityProfileId, languageProfileId, + seriesType, + seasonFolder, tags, fields } = item; @@ -138,7 +141,7 @@ function EditImportListModalContent(props) { @@ -150,19 +153,55 @@ function EditImportListModalContent(props) { + + + Series Type + + + } + title="Series Types" + body={} + position={tooltipPositions.RIGHT} + /> + + + + + + + Season Folder + + + + Sonarr Tags diff --git a/frontend/src/Store/Actions/Settings/importLists.js b/frontend/src/Store/Actions/Settings/importLists.js index e819299e2..ca163d64d 100644 --- a/frontend/src/Store/Actions/Settings/importLists.js +++ b/frontend/src/Store/Actions/Settings/importLists.js @@ -109,6 +109,8 @@ export default { return selectProviderSchema(state, section, payload, (selectedSchema) => { selectedSchema.enableAutomaticAdd = true; selectedSchema.shouldMonitor = 'all'; + selectedSchema.seriesType = 'standard'; + selectedSchema.seasonFolder = true; return selectedSchema; }); diff --git a/src/NzbDrone.Core/Datastore/Migration/144_import_lists.cs b/src/NzbDrone.Core/Datastore/Migration/144_import_lists.cs new file mode 100644 index 000000000..66939a6d5 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/144_import_lists.cs @@ -0,0 +1,15 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(144)] + public class import_lists_series_type_and_season_folder : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Alter.Table("ImportLists").AddColumn("SeriesType").AsInt32().WithDefaultValue(0); + Alter.Table("ImportLists").AddColumn("SeasonFolder").AsBoolean().WithDefaultValue(true); + } + } +} \ No newline at end of file diff --git a/src/NzbDrone.Core/ImportLists/ImportListDefinition.cs b/src/NzbDrone.Core/ImportLists/ImportListDefinition.cs index e185452d2..ae746d5c4 100644 --- a/src/NzbDrone.Core/ImportLists/ImportListDefinition.cs +++ b/src/NzbDrone.Core/ImportLists/ImportListDefinition.cs @@ -9,6 +9,8 @@ namespace NzbDrone.Core.ImportLists public MonitorTypes ShouldMonitor { get; set; } public int QualityProfileId { get; set; } public int LanguageProfileId { get; set; } + public SeriesTypes SeriesType { get; set; } + public bool SeasonFolder { get; set; } public string RootFolderPath { get; set; } public override bool Enable => EnableAutomaticAdd; diff --git a/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs b/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs index e5d83a351..5db20193c 100644 --- a/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs +++ b/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs @@ -125,13 +125,14 @@ namespace NzbDrone.Core.ImportLists RootFolderPath = importList.RootFolderPath, QualityProfileId = importList.QualityProfileId, LanguageProfileId = importList.LanguageProfileId, + SeriesType = importList.SeriesType, + SeasonFolder = importList.SeasonFolder, Tags = importList.Tags, - SeasonFolder = true, AddOptions = new AddSeriesOptions - { - SearchForMissingEpisodes = monitored, - Monitor = importList.ShouldMonitor - } + { + SearchForMissingEpisodes = monitored, + Monitor = importList.ShouldMonitor + } }); } } diff --git a/src/Sonarr.Api.V3/ImportLists/ImportListResource.cs b/src/Sonarr.Api.V3/ImportLists/ImportListResource.cs index 17b2e1ada..6f708b3e1 100644 --- a/src/Sonarr.Api.V3/ImportLists/ImportListResource.cs +++ b/src/Sonarr.Api.V3/ImportLists/ImportListResource.cs @@ -10,6 +10,8 @@ namespace Sonarr.Api.V3.ImportLists public string RootFolderPath { get; set; } public int QualityProfileId { get; set; } public int LanguageProfileId { get; set; } + public SeriesTypes SeriesType { get; set; } + public bool SeasonFolder { get; set; } public ImportListType ListType { get; set; } public int ListOrder { get; set; } } @@ -30,6 +32,8 @@ namespace Sonarr.Api.V3.ImportLists resource.RootFolderPath = definition.RootFolderPath; resource.QualityProfileId = definition.QualityProfileId; resource.LanguageProfileId = definition.LanguageProfileId; + resource.SeriesType = definition.SeriesType; + resource.SeasonFolder = definition.SeasonFolder; resource.ListType = definition.ListType; resource.ListOrder = (int) definition.ListType; @@ -50,6 +54,8 @@ namespace Sonarr.Api.V3.ImportLists definition.RootFolderPath = resource.RootFolderPath; definition.QualityProfileId = resource.QualityProfileId; definition.LanguageProfileId = resource.LanguageProfileId; + definition.SeriesType = resource.SeriesType; + definition.SeasonFolder = resource.SeasonFolder; definition.ListType = resource.ListType; return definition;