New: Option to sync season monitoring state when importing from another Sonarr instance

Closes #6542
pull/6556/head
Mark McDowall 3 months ago committed by Mark McDowall
parent cb72e752f9
commit 33b44a8a53

@ -222,11 +222,14 @@ namespace NzbDrone.Core.ImportLists
QualityProfileId = importList.QualityProfileId,
SeriesType = importList.SeriesType,
SeasonFolder = importList.SeasonFolder,
Seasons = item.Seasons,
Tags = importList.Tags,
AddOptions = new AddSeriesOptions
{
SearchForMissingEpisodes = importList.SearchForMissingEpisodes,
Monitor = importList.ShouldMonitor
// If seasons are provided use them for syncing monitored status, otherwise use the list setting.
Monitor = item.Seasons.Any() ? MonitorTypes.Skip : importList.ShouldMonitor
}
});
}

@ -15,6 +15,7 @@ namespace NzbDrone.Core.ImportLists.Sonarr
public int QualityProfileId { get; set; }
public int LanguageProfileId { get; set; }
public string RootFolderPath { get; set; }
public List<SonarrSeason> Seasons { get; set; }
public HashSet<int> Tags { get; set; }
}
@ -35,4 +36,10 @@ namespace NzbDrone.Core.ImportLists.Sonarr
public string Path { get; set; }
public int Id { get; set; }
}
public class SonarrSeason
{
public int SeasonNumber { get; set; }
public bool Monitored { get; set; }
}
}

@ -8,6 +8,7 @@ using NzbDrone.Core.Configuration;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.ImportLists.Sonarr
@ -61,11 +62,22 @@ namespace NzbDrone.Core.ImportLists.Sonarr
continue;
}
series.Add(new ImportListItemInfo
var info = new ImportListItemInfo
{
TvdbId = item.TvdbId,
Title = item.Title
});
};
if (Settings.SyncSeasonMonitoring)
{
info.Seasons = item.Seasons.Select(s => new Season
{
SeasonNumber = s.SeasonNumber,
Monitored = s.Monitored
}).ToList();
}
series.Add(info);
}
_importListStatusService.RecordSuccess(Definition.Id);

@ -35,12 +35,11 @@ namespace NzbDrone.Core.ImportLists.Sonarr
[FieldDefinition(1, Label = "ApiKey", HelpText = "ImportListsSonarrSettingsApiKeyHelpText")]
public string ApiKey { get; set; }
[FieldDefinition(2, Type = FieldType.Select, SelectOptionsProviderAction = "getProfiles", Label = "QualityProfiles", HelpText = "ImportListsSonarrSettingsQualityProfilesHelpText")]
public IEnumerable<int> ProfileIds { get; set; }
[FieldDefinition(2, Label = "ImportListsSonarrSettingsSyncSeasonMonitoring", HelpText = "ImportListsSonarrSettingsSyncSeasonMonitoringHelpText", Type = FieldType.Checkbox)]
public bool SyncSeasonMonitoring { get; set; }
// TODO: Remove this eventually, no translation added as deprecated
[FieldDefinition(3, Type = FieldType.Select, SelectOptionsProviderAction = "getLanguageProfiles", Label = "Language Profiles", HelpText = "Language Profiles from the source instance to import from")]
public IEnumerable<int> LanguageProfileIds { get; set; }
[FieldDefinition(3, Type = FieldType.Select, SelectOptionsProviderAction = "getProfiles", Label = "QualityProfiles", HelpText = "ImportListsSonarrSettingsQualityProfilesHelpText")]
public IEnumerable<int> ProfileIds { get; set; }
[FieldDefinition(4, Type = FieldType.Select, SelectOptionsProviderAction = "getTags", Label = "Tags", HelpText = "ImportListsSonarrSettingsTagsHelpText")]
public IEnumerable<int> TagIds { get; set; }
@ -48,6 +47,10 @@ namespace NzbDrone.Core.ImportLists.Sonarr
[FieldDefinition(5, Type = FieldType.Select, SelectOptionsProviderAction = "getRootFolders", Label = "RootFolders", HelpText = "ImportListsSonarrSettingsRootFoldersHelpText")]
public IEnumerable<string> RootFolderPaths { get; set; }
// TODO: Remove this eventually, no translation added as deprecated
[FieldDefinition(6, Type = FieldType.Select, SelectOptionsProviderAction = "getLanguageProfiles", Label = "Language Profiles", HelpText = "Language Profiles from the source instance to import from")]
public IEnumerable<int> LanguageProfileIds { get; set; }
public NzbDroneValidationResult Validate()
{
return new NzbDroneValidationResult(Validator.Validate(this));

@ -851,6 +851,8 @@
"ImportListsSimklSettingsUserListTypePlanToWatch": "Plan To Watch",
"ImportListsSimklSettingsUserListTypeWatching": "Watching",
"ImportListsSonarrSettingsApiKeyHelpText": "API Key of the {appName} instance to import from",
"ImportListsSonarrSettingsSyncSeasonMonitoring": "Sync Season Monitoring",
"ImportListsSonarrSettingsSyncSeasonMonitoringHelpText": "Sync season monitoring from {appName} instance, if enabled 'Monitor' will be ignored",
"ImportListsSonarrSettingsFullUrl": "Full URL",
"ImportListsSonarrSettingsFullUrlHelpText": "URL, including port, of the {appName} instance to import from",
"ImportListsSonarrSettingsQualityProfilesHelpText": "Quality Profiles from the source instance to import from",

@ -1,10 +1,17 @@
using System;
using System.Collections.Generic;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Parser.Model
{
public class ImportListItemInfo : ModelBase
{
public ImportListItemInfo()
{
Seasons = new List<Season>();
}
public int ImportListId { get; set; }
public string ImportList { get; set; }
public string Title { get; set; }
@ -15,6 +22,7 @@ namespace NzbDrone.Core.Parser.Model
public int MalId { get; set; }
public int AniListId { get; set; }
public DateTime ReleaseDate { get; set; }
public List<Season> Seasons { get; set; }
public override string ToString()
{

@ -40,6 +40,12 @@ namespace NzbDrone.Core.Tv
return;
}
// Skip episode level monitoring and use season information when series was added
if (monitoringOptions.Monitor == MonitorTypes.Skip)
{
return;
}
var firstSeason = series.Seasons.Select(s => s.SeasonNumber).Where(s => s > 0).MinOrDefault();
var lastSeason = series.Seasons.Select(s => s.SeasonNumber).MaxOrDefault();
var episodes = _episodeService.GetEpisodeBySeries(series.Id);

@ -27,7 +27,8 @@ namespace NzbDrone.Core.Tv
Recent,
MonitorSpecials,
UnmonitorSpecials,
None
None,
Skip
}
public enum NewItemMonitorTypes

Loading…
Cancel
Save