New: Option to sync season monitoring state when importing from another Sonarr instance
Closes #6542
This commit is contained in:
parent
cb72e752f9
commit
33b44a8a53
|
@ -222,11 +222,14 @@ namespace NzbDrone.Core.ImportLists
|
||||||
QualityProfileId = importList.QualityProfileId,
|
QualityProfileId = importList.QualityProfileId,
|
||||||
SeriesType = importList.SeriesType,
|
SeriesType = importList.SeriesType,
|
||||||
SeasonFolder = importList.SeasonFolder,
|
SeasonFolder = importList.SeasonFolder,
|
||||||
|
Seasons = item.Seasons,
|
||||||
Tags = importList.Tags,
|
Tags = importList.Tags,
|
||||||
AddOptions = new AddSeriesOptions
|
AddOptions = new AddSeriesOptions
|
||||||
{
|
{
|
||||||
SearchForMissingEpisodes = importList.SearchForMissingEpisodes,
|
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 QualityProfileId { get; set; }
|
||||||
public int LanguageProfileId { get; set; }
|
public int LanguageProfileId { get; set; }
|
||||||
public string RootFolderPath { get; set; }
|
public string RootFolderPath { get; set; }
|
||||||
|
public List<SonarrSeason> Seasons { get; set; }
|
||||||
public HashSet<int> Tags { get; set; }
|
public HashSet<int> Tags { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,4 +36,10 @@ namespace NzbDrone.Core.ImportLists.Sonarr
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
public int Id { 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.Localization;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Validation;
|
using NzbDrone.Core.Validation;
|
||||||
|
|
||||||
namespace NzbDrone.Core.ImportLists.Sonarr
|
namespace NzbDrone.Core.ImportLists.Sonarr
|
||||||
|
@ -61,11 +62,22 @@ namespace NzbDrone.Core.ImportLists.Sonarr
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
series.Add(new ImportListItemInfo
|
var info = new ImportListItemInfo
|
||||||
{
|
{
|
||||||
TvdbId = item.TvdbId,
|
TvdbId = item.TvdbId,
|
||||||
Title = item.Title
|
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);
|
_importListStatusService.RecordSuccess(Definition.Id);
|
||||||
|
|
|
@ -35,12 +35,11 @@ namespace NzbDrone.Core.ImportLists.Sonarr
|
||||||
[FieldDefinition(1, Label = "ApiKey", HelpText = "ImportListsSonarrSettingsApiKeyHelpText")]
|
[FieldDefinition(1, Label = "ApiKey", HelpText = "ImportListsSonarrSettingsApiKeyHelpText")]
|
||||||
public string ApiKey { get; set; }
|
public string ApiKey { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(2, Type = FieldType.Select, SelectOptionsProviderAction = "getProfiles", Label = "QualityProfiles", HelpText = "ImportListsSonarrSettingsQualityProfilesHelpText")]
|
[FieldDefinition(2, Label = "ImportListsSonarrSettingsSyncSeasonMonitoring", HelpText = "ImportListsSonarrSettingsSyncSeasonMonitoringHelpText", Type = FieldType.Checkbox)]
|
||||||
public IEnumerable<int> ProfileIds { get; set; }
|
public bool SyncSeasonMonitoring { get; set; }
|
||||||
|
|
||||||
// TODO: Remove this eventually, no translation added as deprecated
|
[FieldDefinition(3, Type = FieldType.Select, SelectOptionsProviderAction = "getProfiles", Label = "QualityProfiles", HelpText = "ImportListsSonarrSettingsQualityProfilesHelpText")]
|
||||||
[FieldDefinition(3, Type = FieldType.Select, SelectOptionsProviderAction = "getLanguageProfiles", Label = "Language Profiles", HelpText = "Language Profiles from the source instance to import from")]
|
public IEnumerable<int> ProfileIds { get; set; }
|
||||||
public IEnumerable<int> LanguageProfileIds { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(4, Type = FieldType.Select, SelectOptionsProviderAction = "getTags", Label = "Tags", HelpText = "ImportListsSonarrSettingsTagsHelpText")]
|
[FieldDefinition(4, Type = FieldType.Select, SelectOptionsProviderAction = "getTags", Label = "Tags", HelpText = "ImportListsSonarrSettingsTagsHelpText")]
|
||||||
public IEnumerable<int> TagIds { get; set; }
|
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")]
|
[FieldDefinition(5, Type = FieldType.Select, SelectOptionsProviderAction = "getRootFolders", Label = "RootFolders", HelpText = "ImportListsSonarrSettingsRootFoldersHelpText")]
|
||||||
public IEnumerable<string> RootFolderPaths { get; set; }
|
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()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
|
|
@ -851,6 +851,8 @@
|
||||||
"ImportListsSimklSettingsUserListTypePlanToWatch": "Plan To Watch",
|
"ImportListsSimklSettingsUserListTypePlanToWatch": "Plan To Watch",
|
||||||
"ImportListsSimklSettingsUserListTypeWatching": "Watching",
|
"ImportListsSimklSettingsUserListTypeWatching": "Watching",
|
||||||
"ImportListsSonarrSettingsApiKeyHelpText": "API Key of the {appName} instance to import from",
|
"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",
|
"ImportListsSonarrSettingsFullUrl": "Full URL",
|
||||||
"ImportListsSonarrSettingsFullUrlHelpText": "URL, including port, of the {appName} instance to import from",
|
"ImportListsSonarrSettingsFullUrlHelpText": "URL, including port, of the {appName} instance to import from",
|
||||||
"ImportListsSonarrSettingsQualityProfilesHelpText": "Quality Profiles from the source instance to import from",
|
"ImportListsSonarrSettingsQualityProfilesHelpText": "Quality Profiles from the source instance to import from",
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Parser.Model
|
namespace NzbDrone.Core.Parser.Model
|
||||||
{
|
{
|
||||||
public class ImportListItemInfo : ModelBase
|
public class ImportListItemInfo : ModelBase
|
||||||
{
|
{
|
||||||
|
public ImportListItemInfo()
|
||||||
|
{
|
||||||
|
Seasons = new List<Season>();
|
||||||
|
}
|
||||||
|
|
||||||
public int ImportListId { get; set; }
|
public int ImportListId { get; set; }
|
||||||
public string ImportList { get; set; }
|
public string ImportList { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
@ -15,6 +22,7 @@ namespace NzbDrone.Core.Parser.Model
|
||||||
public int MalId { get; set; }
|
public int MalId { get; set; }
|
||||||
public int AniListId { get; set; }
|
public int AniListId { get; set; }
|
||||||
public DateTime ReleaseDate { get; set; }
|
public DateTime ReleaseDate { get; set; }
|
||||||
|
public List<Season> Seasons { get; set; }
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,6 +40,12 @@ namespace NzbDrone.Core.Tv
|
||||||
return;
|
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 firstSeason = series.Seasons.Select(s => s.SeasonNumber).Where(s => s > 0).MinOrDefault();
|
||||||
var lastSeason = series.Seasons.Select(s => s.SeasonNumber).MaxOrDefault();
|
var lastSeason = series.Seasons.Select(s => s.SeasonNumber).MaxOrDefault();
|
||||||
var episodes = _episodeService.GetEpisodeBySeries(series.Id);
|
var episodes = _episodeService.GetEpisodeBySeries(series.Id);
|
||||||
|
|
|
@ -27,7 +27,8 @@ namespace NzbDrone.Core.Tv
|
||||||
Recent,
|
Recent,
|
||||||
MonitorSpecials,
|
MonitorSpecials,
|
||||||
UnmonitorSpecials,
|
UnmonitorSpecials,
|
||||||
None
|
None,
|
||||||
|
Skip
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum NewItemMonitorTypes
|
public enum NewItemMonitorTypes
|
||||||
|
|
Loading…
Reference in New Issue