From 45619a1df3702e9c1edea6397f67a17f24074cc9 Mon Sep 17 00:00:00 2001 From: Arthur Melton Date: Mon, 1 Jul 2024 19:09:16 -0400 Subject: [PATCH] Start of adding indexer to specifications This will get renamed and squashed later dw --- src/NzbDrone.Core/Blocklisting/Blocklist.cs | 1 + .../Blocklisting/BlocklistService.cs | 2 + .../CustomFormatCalculationService.cs | 10 ++++- .../CustomFormats/CustomFormatInput.cs | 1 + .../Specifications/IndexerSpecification.cs | 44 +++++++++++++++++++ src/NzbDrone.Core/History/HistoryService.cs | 4 ++ src/NzbDrone.Core/Indexers/IndexerFactory.cs | 12 +++++ src/NzbDrone.Core/Localization/Core/en.json | 1 + src/NzbDrone.Core/MediaFiles/EpisodeFile.cs | 1 + .../EpisodeImport/ImportApprovedEpisodes.cs | 1 + .../EpisodeImport/Manual/ManualImportFile.cs | 1 + .../EpisodeImport/Manual/ManualImportItem.cs | 1 + .../Manual/ManualImportService.cs | 10 ++++- .../CustomScript/CustomScript.cs | 1 + .../Parser/Model/GrabbedReleaseInfo.cs | 4 ++ .../Parser/Model/LocalEpisode.cs | 1 + .../EpisodeFiles/EpisodeFileResource.cs | 2 + .../ManualImport/ManualImportController.cs | 2 +- .../ManualImportReprocessResource.cs | 1 + .../ManualImport/ManualImportResource.cs | 2 + 20 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 src/NzbDrone.Core/CustomFormats/Specifications/IndexerSpecification.cs diff --git a/src/NzbDrone.Core/Blocklisting/Blocklist.cs b/src/NzbDrone.Core/Blocklisting/Blocklist.cs index 8941f42fd..85577e6c5 100644 --- a/src/NzbDrone.Core/Blocklisting/Blocklist.cs +++ b/src/NzbDrone.Core/Blocklisting/Blocklist.cs @@ -21,6 +21,7 @@ namespace NzbDrone.Core.Blocklisting public long? Size { get; set; } public DownloadProtocol Protocol { get; set; } public string Indexer { get; set; } + public int IndexerId { get; set; } public IndexerFlags IndexerFlags { get; set; } public ReleaseType ReleaseType { get; set; } public string Message { get; set; } diff --git a/src/NzbDrone.Core/Blocklisting/BlocklistService.cs b/src/NzbDrone.Core/Blocklisting/BlocklistService.cs index 0ec53522c..659001847 100644 --- a/src/NzbDrone.Core/Blocklisting/BlocklistService.cs +++ b/src/NzbDrone.Core/Blocklisting/BlocklistService.cs @@ -83,6 +83,7 @@ namespace NzbDrone.Core.Blocklisting PublishedDate = remoteEpisode.Release.PublishDate, Size = remoteEpisode.Release.Size, Indexer = remoteEpisode.Release.Indexer, + IndexerId = remoteEpisode.Release.IndexerId, Protocol = remoteEpisode.Release.DownloadProtocol, Message = message, Languages = remoteEpisode.ParsedEpisodeInfo.Languages @@ -183,6 +184,7 @@ namespace NzbDrone.Core.Blocklisting PublishedDate = DateTime.Parse(message.Data.GetValueOrDefault("publishedDate")), Size = long.Parse(message.Data.GetValueOrDefault("size", "0")), Indexer = message.Data.GetValueOrDefault("indexer"), + IndexerId = int.Parse(message.Data.GetValueOrDefault("indexerId")), Protocol = (DownloadProtocol)Convert.ToInt32(message.Data.GetValueOrDefault("protocol")), Message = message.Message, TorrentInfoHash = message.Data.GetValueOrDefault("torrentInfoHash"), diff --git a/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs b/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs index 1f0cb296b..f11efff9f 100644 --- a/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs +++ b/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs @@ -42,7 +42,8 @@ namespace NzbDrone.Core.CustomFormats Size = size, Languages = remoteEpisode.Languages, IndexerFlags = remoteEpisode.Release?.IndexerFlags ?? 0, - ReleaseType = remoteEpisode.ParsedEpisodeInfo.ReleaseType + ReleaseType = remoteEpisode.ParsedEpisodeInfo.ReleaseType, + IndexerId = remoteEpisode.Release?.IndexerId ?? 0, }; return ParseCustomFormat(input); @@ -78,7 +79,8 @@ namespace NzbDrone.Core.CustomFormats Size = blocklist.Size ?? 0, Languages = blocklist.Languages, IndexerFlags = blocklist.IndexerFlags, - ReleaseType = blocklist.ReleaseType + ReleaseType = blocklist.ReleaseType, + IndexerId = blocklist.IndexerId, }; return ParseCustomFormat(input); @@ -89,6 +91,7 @@ namespace NzbDrone.Core.CustomFormats var parsed = Parser.Parser.ParseTitle(history.SourceTitle); long.TryParse(history.Data.GetValueOrDefault("size"), out var size); + int.TryParse(history.Data.GetValueOrDefault("indexerId"), out var indexerId); Enum.TryParse(history.Data.GetValueOrDefault("indexerFlags"), true, out IndexerFlags indexerFlags); Enum.TryParse(history.Data.GetValueOrDefault("releaseType"), out ReleaseType releaseType); @@ -108,6 +111,7 @@ namespace NzbDrone.Core.CustomFormats Size = size, Languages = history.Languages, IndexerFlags = indexerFlags, + IndexerId = indexerId, ReleaseType = releaseType }; @@ -132,6 +136,7 @@ namespace NzbDrone.Core.CustomFormats Size = localEpisode.Size, Languages = localEpisode.Languages, IndexerFlags = localEpisode.IndexerFlags, + IndexerId = localEpisode.Release.IndexerId, ReleaseType = localEpisode.ReleaseType, Filename = Path.GetFileName(localEpisode.Path) }; @@ -203,6 +208,7 @@ namespace NzbDrone.Core.CustomFormats Size = episodeFile.Size, Languages = episodeFile.Languages, IndexerFlags = episodeFile.IndexerFlags, + IndexerId = episodeFile.IndexerId, ReleaseType = episodeFile.ReleaseType, Filename = Path.GetFileName(episodeFile.RelativePath), }; diff --git a/src/NzbDrone.Core/CustomFormats/CustomFormatInput.cs b/src/NzbDrone.Core/CustomFormats/CustomFormatInput.cs index 465fbfef5..51f39de6a 100644 --- a/src/NzbDrone.Core/CustomFormats/CustomFormatInput.cs +++ b/src/NzbDrone.Core/CustomFormats/CustomFormatInput.cs @@ -11,6 +11,7 @@ namespace NzbDrone.Core.CustomFormats public Series Series { get; set; } public long Size { get; set; } public IndexerFlags IndexerFlags { get; set; } + public int IndexerId { get; set; } public List Languages { get; set; } public string Filename { get; set; } public ReleaseType ReleaseType { get; set; } diff --git a/src/NzbDrone.Core/CustomFormats/Specifications/IndexerSpecification.cs b/src/NzbDrone.Core/CustomFormats/Specifications/IndexerSpecification.cs new file mode 100644 index 000000000..3140b7001 --- /dev/null +++ b/src/NzbDrone.Core/CustomFormats/Specifications/IndexerSpecification.cs @@ -0,0 +1,44 @@ +using FluentValidation; +using NzbDrone.Core.Annotations; +using NzbDrone.Core.Validation; + +namespace NzbDrone.Core.CustomFormats +{ + public class IndexerSpecificationValidator : AbstractValidator + { + public IndexerSpecificationValidator(/*IIndexerFactory indexerFactory*/) + { + RuleFor(c => c.Value).NotEmpty(); + /* + RuleFor(c => c.Value).Custom((indexerId, context) => + { + if (indexerId != 0 && !indexerFactory.Exists(indexerId)) + { + context.AddFailure($"Invalid indexer value: {indexerId}"); + } + }); + */ + } + } + + public class IndexerSpecification : CustomFormatSpecificationBase + { + private static readonly IndexerSpecificationValidator Validator = new (); + + public override int Order => 11; + public override string ImplementationName => "Indexer"; + + [FieldDefinition(1, Label = "CustomFormatsSpecificationIndexer", Type = FieldType.Select, SelectOptionsProviderAction = "getIndexersList")] + public int Value { get; set; } + + protected override bool IsSatisfiedByWithoutNegate(CustomFormatInput input) + { + return input.IndexerId == Value; + } + + public override NzbDroneValidationResult Validate() + { + return new NzbDroneValidationResult(Validator.Validate(this)); + } + } +} diff --git a/src/NzbDrone.Core/History/HistoryService.cs b/src/NzbDrone.Core/History/HistoryService.cs index d7e76d94f..e6830eadb 100644 --- a/src/NzbDrone.Core/History/HistoryService.cs +++ b/src/NzbDrone.Core/History/HistoryService.cs @@ -170,6 +170,7 @@ namespace NzbDrone.Core.History history.Data.Add("SeriesMatchType", message.Episode.SeriesMatchType.ToString()); history.Data.Add("ReleaseSource", message.Episode.ReleaseSource.ToString()); history.Data.Add("IndexerFlags", message.Episode.Release.IndexerFlags.ToString()); + history.Data.Add("IndexerId", message.Episode.Release.IndexerId.ToString()); history.Data.Add("ReleaseType", message.Episode.ParsedEpisodeInfo.ReleaseType.ToString()); if (!message.Episode.ParsedEpisodeInfo.ReleaseHash.IsNullOrWhiteSpace()) @@ -223,6 +224,7 @@ namespace NzbDrone.Core.History history.Data.Add("CustomFormatScore", message.EpisodeInfo.CustomFormatScore.ToString()); history.Data.Add("Size", message.EpisodeInfo.Size.ToString()); history.Data.Add("IndexerFlags", message.ImportedEpisode.IndexerFlags.ToString()); + history.Data.Add("IndexerId", message.ImportedEpisode.IndexerId.ToString()); history.Data.Add("ReleaseType", message.ImportedEpisode.ReleaseType.ToString()); _historyRepository.Insert(history); @@ -284,6 +286,7 @@ namespace NzbDrone.Core.History history.Data.Add("Reason", message.Reason.ToString()); history.Data.Add("ReleaseGroup", message.EpisodeFile.ReleaseGroup); history.Data.Add("Size", message.EpisodeFile.Size.ToString()); + history.Data.Add("IndexerId", message.EpisodeFile.IndexerId.ToString()); history.Data.Add("IndexerFlags", message.EpisodeFile.IndexerFlags.ToString()); history.Data.Add("ReleaseType", message.EpisodeFile.ReleaseType.ToString()); @@ -318,6 +321,7 @@ namespace NzbDrone.Core.History history.Data.Add("ReleaseGroup", message.EpisodeFile.ReleaseGroup); history.Data.Add("Size", message.EpisodeFile.Size.ToString()); history.Data.Add("IndexerFlags", message.EpisodeFile.IndexerFlags.ToString()); + history.Data.Add("IndexerId", message.EpisodeFile.IndexerId.ToString()); history.Data.Add("ReleaseType", message.EpisodeFile.ReleaseType.ToString()); _historyRepository.Insert(history); diff --git a/src/NzbDrone.Core/Indexers/IndexerFactory.cs b/src/NzbDrone.Core/Indexers/IndexerFactory.cs index d26ed6b56..0a25789dd 100644 --- a/src/NzbDrone.Core/Indexers/IndexerFactory.cs +++ b/src/NzbDrone.Core/Indexers/IndexerFactory.cs @@ -37,6 +37,18 @@ namespace NzbDrone.Core.Indexers return base.Active().Where(c => c.Enable).ToList(); } + public virtual object RequestAction(string action, IDictionary query) + { + _logger.Info("HELLO WORLD"); + + if (action == "getIndexerList") + { + return GetAvailableProviders(); + } + + return new { }; + } + public override void SetProviderCharacteristics(IIndexer provider, IndexerDefinition definition) { base.SetProviderCharacteristics(provider, definition); diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index b60cecb2e..99dcebe18 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -284,6 +284,7 @@ "CustomFormatsSettingsSummary": "Custom Formats and Settings", "CustomFormatsSettingsTriggerInfo": "A Custom Format will be applied to a release or file when it matches at least one of each of the different condition types chosen.", "CustomFormatsSpecificationFlag": "Flag", + "CustomFormatsSpecificationIndexer": "Indexer", "CustomFormatsSpecificationLanguage": "Language", "CustomFormatsSpecificationMaximumSize": "Maximum Size", "CustomFormatsSpecificationMaximumSizeHelpText": "Release must be less than or equal to this size", diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeFile.cs b/src/NzbDrone.Core/MediaFiles/EpisodeFile.cs index cd810a457..cc51d7161 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeFile.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeFile.cs @@ -23,6 +23,7 @@ namespace NzbDrone.Core.MediaFiles public string ReleaseGroup { get; set; } public string ReleaseHash { get; set; } public QualityModel Quality { get; set; } + public int IndexerId { get; set; } public IndexerFlags IndexerFlags { get; set; } public MediaInfoModel MediaInfo { get; set; } public LazyLoaded> Episodes { get; set; } diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs index 39c3c849f..f080c6d14 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs @@ -97,6 +97,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport episodeFile.ReleaseGroup = localEpisode.ReleaseGroup; episodeFile.ReleaseHash = localEpisode.ReleaseHash; episodeFile.Languages = localEpisode.Languages; + episodeFile.IndexerId = localEpisode.IndexerId; // Prefer the release type from the download client, folder and finally the file so we have the most accurate information. episodeFile.ReleaseType = localEpisode.DownloadClientEpisodeInfo?.ReleaseType ?? diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportFile.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportFile.cs index 365d0ae31..047a2f64f 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportFile.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportFile.cs @@ -18,6 +18,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual public List Languages { get; set; } public string ReleaseGroup { get; set; } public int IndexerFlags { get; set; } + public int IndexerId { get; set; } public ReleaseType ReleaseType { get; set; } public string DownloadId { get; set; } diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportItem.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportItem.cs index 9f690474b..c41a2952b 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportItem.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportItem.cs @@ -26,6 +26,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual public List CustomFormats { get; set; } public int CustomFormatScore { get; set; } public int IndexerFlags { get; set; } + public int IndexerId { get; set; } public ReleaseType ReleaseType { get; set; } public IEnumerable Rejections { get; set; } diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs index f1fcd03cf..64005e69b 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs @@ -25,7 +25,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual { List GetMediaFiles(int seriesId, int? seasonNumber); List GetMediaFiles(string path, string downloadId, int? seriesId, bool filterExistingFiles); - ManualImportItem ReprocessItem(string path, string downloadId, int seriesId, int? seasonNumber, List episodeIds, string releaseGroup, QualityModel quality, List languages, int indexerFlags, ReleaseType releaseType); + ManualImportItem ReprocessItem(string path, string downloadId, int seriesId, int? seasonNumber, List episodeIds, string releaseGroup, QualityModel quality, List languages, int indexerFlags, int indexerId, ReleaseType releaseType); } public class ManualImportService : IExecute, IManualImportService @@ -139,7 +139,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual return ProcessFolder(path, path, downloadId, seriesId, filterExistingFiles); } - public ManualImportItem ReprocessItem(string path, string downloadId, int seriesId, int? seasonNumber, List episodeIds, string releaseGroup, QualityModel quality, List languages, int indexerFlags, ReleaseType releaseType) + public ManualImportItem ReprocessItem(string path, string downloadId, int seriesId, int? seasonNumber, List episodeIds, string releaseGroup, QualityModel quality, List languages, int indexerFlags, int indexerId, ReleaseType releaseType) { var rootFolder = Path.GetDirectoryName(path); var series = _seriesService.GetSeries(seriesId); @@ -170,6 +170,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual localEpisode.Languages = languages?.Count <= 1 && (languages?.SingleOrDefault() ?? Language.Unknown) == Language.Unknown ? languageParse : languages; localEpisode.Quality = quality.Quality == Quality.Unknown ? QualityParser.ParseQuality(path) : quality; localEpisode.IndexerFlags = (IndexerFlags)indexerFlags; + localEpisode.IndexerId = indexerId; localEpisode.ReleaseType = releaseType; localEpisode.CustomFormats = _formatCalculator.ParseCustomFormat(localEpisode); @@ -202,6 +203,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual Languages = languages?.Count <= 1 && (languages?.SingleOrDefault() ?? Language.Unknown) == Language.Unknown ? LanguageParser.ParseLanguages(path) : languages, Quality = quality.Quality == Quality.Unknown ? QualityParser.ParseQuality(path) : quality, IndexerFlags = (IndexerFlags)indexerFlags, + IndexerId = indexerId, ReleaseType = releaseType }; @@ -428,6 +430,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual item.Size = _diskProvider.GetFileSize(decision.LocalEpisode.Path); item.Rejections = decision.Rejections; item.IndexerFlags = (int)decision.LocalEpisode.IndexerFlags; + item.IndexerId = decision.LocalEpisode.IndexerId; item.ReleaseType = decision.LocalEpisode.ReleaseType; return item; @@ -448,6 +451,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual item.Quality = episodeFile.Quality; item.Languages = episodeFile.Languages; item.IndexerFlags = (int)episodeFile.IndexerFlags; + item.IndexerId = episodeFile.IndexerId; item.ReleaseType = episodeFile.ReleaseType; item.Size = _diskProvider.GetFileSize(item.Path); item.Rejections = Enumerable.Empty(); @@ -486,6 +490,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual Quality = file.Quality, Languages = file.Languages, IndexerFlags = (IndexerFlags)file.IndexerFlags, + IndexerId = file.IndexerId, ReleaseType = file.ReleaseType, Series = series, Size = 0 @@ -516,6 +521,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual localEpisode.Quality = file.Quality; localEpisode.Languages = file.Languages; localEpisode.IndexerFlags = (IndexerFlags)file.IndexerFlags; + localEpisode.IndexerId = file.IndexerId; localEpisode.ReleaseType = file.ReleaseType; // TODO: Cleanup non-tracked downloads diff --git a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs index 1df4f95a8..aa2902d71 100644 --- a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs +++ b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs @@ -91,6 +91,7 @@ namespace NzbDrone.Core.Notifications.CustomScript environmentVariables.Add("Sonarr_Release_QualityVersion", remoteEpisode.ParsedEpisodeInfo.Quality.Revision.Version.ToString()); environmentVariables.Add("Sonarr_Release_ReleaseGroup", releaseGroup ?? string.Empty); environmentVariables.Add("Sonarr_Release_IndexerFlags", remoteEpisode.Release.IndexerFlags.ToString()); + environmentVariables.Add("Sonarr_Release_IndexerId", remoteEpisode.Release.IndexerId.ToString()); environmentVariables.Add("Sonarr_Download_Client", message.DownloadClientName ?? string.Empty); environmentVariables.Add("Sonarr_Download_Client_Type", message.DownloadClientType ?? string.Empty); environmentVariables.Add("Sonarr_Download_Id", message.DownloadId ?? string.Empty); diff --git a/src/NzbDrone.Core/Parser/Model/GrabbedReleaseInfo.cs b/src/NzbDrone.Core/Parser/Model/GrabbedReleaseInfo.cs index 5ac847bea..a40d323ab 100644 --- a/src/NzbDrone.Core/Parser/Model/GrabbedReleaseInfo.cs +++ b/src/NzbDrone.Core/Parser/Model/GrabbedReleaseInfo.cs @@ -8,6 +8,7 @@ namespace NzbDrone.Core.Parser.Model { public string Title { get; set; } public string Indexer { get; set; } + public int IndexerId { get; set; } public long Size { get; set; } public List EpisodeIds { get; set; } @@ -18,11 +19,14 @@ namespace NzbDrone.Core.Parser.Model var episodeIds = grabbedHistories.Select(h => h.EpisodeId).Distinct().ToList(); grabbedHistory.Data.TryGetValue("indexer", out var indexer); + grabbedHistory.Data.TryGetValue("indexerId", out var indexerIdString); grabbedHistory.Data.TryGetValue("size", out var sizeString); long.TryParse(sizeString, out var size); + int.TryParse(indexerIdString, out var indexerId); Title = grabbedHistory.SourceTitle; Indexer = indexer; + IndexerId = indexerId; Size = size; EpisodeIds = episodeIds; } diff --git a/src/NzbDrone.Core/Parser/Model/LocalEpisode.cs b/src/NzbDrone.Core/Parser/Model/LocalEpisode.cs index 0129c5d0c..bca8c3e24 100644 --- a/src/NzbDrone.Core/Parser/Model/LocalEpisode.cs +++ b/src/NzbDrone.Core/Parser/Model/LocalEpisode.cs @@ -32,6 +32,7 @@ namespace NzbDrone.Core.Parser.Model public QualityModel Quality { get; set; } public List Languages { get; set; } public IndexerFlags IndexerFlags { get; set; } + public int IndexerId { get; set; } public ReleaseType ReleaseType { get; set; } public MediaInfoModel MediaInfo { get; set; } public bool ExistingFile { get; set; } diff --git a/src/Sonarr.Api.V3/EpisodeFiles/EpisodeFileResource.cs b/src/Sonarr.Api.V3/EpisodeFiles/EpisodeFileResource.cs index 552a34326..22592f2cb 100644 --- a/src/Sonarr.Api.V3/EpisodeFiles/EpisodeFileResource.cs +++ b/src/Sonarr.Api.V3/EpisodeFiles/EpisodeFileResource.cs @@ -27,6 +27,7 @@ namespace Sonarr.Api.V3.EpisodeFiles public List CustomFormats { get; set; } public int CustomFormatScore { get; set; } public int? IndexerFlags { get; set; } + public int IndexerId { get; set; } public ReleaseType? ReleaseType { get; set; } public MediaInfoResource MediaInfo { get; set; } @@ -65,6 +66,7 @@ namespace Sonarr.Api.V3.EpisodeFiles CustomFormats = customFormats.ToResource(false), CustomFormatScore = customFormatScore, IndexerFlags = (int)model.IndexerFlags, + IndexerId = model.IndexerId, ReleaseType = model.ReleaseType, }; } diff --git a/src/Sonarr.Api.V3/ManualImport/ManualImportController.cs b/src/Sonarr.Api.V3/ManualImport/ManualImportController.cs index 46ab91a95..7cc1157bd 100644 --- a/src/Sonarr.Api.V3/ManualImport/ManualImportController.cs +++ b/src/Sonarr.Api.V3/ManualImport/ManualImportController.cs @@ -39,7 +39,7 @@ namespace Sonarr.Api.V3.ManualImport { foreach (var item in items) { - var processedItem = _manualImportService.ReprocessItem(item.Path, item.DownloadId, item.SeriesId, item.SeasonNumber, item.EpisodeIds ?? new List(), item.ReleaseGroup, item.Quality, item.Languages, item.IndexerFlags, item.ReleaseType); + var processedItem = _manualImportService.ReprocessItem(item.Path, item.DownloadId, item.SeriesId, item.SeasonNumber, item.EpisodeIds ?? new List(), item.ReleaseGroup, item.Quality, item.Languages, item.IndexerFlags, item.IndexerId, item.ReleaseType); item.SeasonNumber = processedItem.SeasonNumber; item.Episodes = processedItem.Episodes.ToResource(); diff --git a/src/Sonarr.Api.V3/ManualImport/ManualImportReprocessResource.cs b/src/Sonarr.Api.V3/ManualImport/ManualImportReprocessResource.cs index 4eb2bbe4b..6952a1e3b 100644 --- a/src/Sonarr.Api.V3/ManualImport/ManualImportReprocessResource.cs +++ b/src/Sonarr.Api.V3/ManualImport/ManualImportReprocessResource.cs @@ -23,6 +23,7 @@ namespace Sonarr.Api.V3.ManualImport public List CustomFormats { get; set; } public int CustomFormatScore { get; set; } public int IndexerFlags { get; set; } + public int IndexerId { get; set; } public ReleaseType ReleaseType { get; set; } public IEnumerable Rejections { get; set; } } diff --git a/src/Sonarr.Api.V3/ManualImport/ManualImportResource.cs b/src/Sonarr.Api.V3/ManualImport/ManualImportResource.cs index a65e6bdf3..4c268c267 100644 --- a/src/Sonarr.Api.V3/ManualImport/ManualImportResource.cs +++ b/src/Sonarr.Api.V3/ManualImport/ManualImportResource.cs @@ -32,6 +32,7 @@ namespace Sonarr.Api.V3.ManualImport public List CustomFormats { get; set; } public int CustomFormatScore { get; set; } public int IndexerFlags { get; set; } + public int IndexerId { get; set; } public ReleaseType ReleaseType { get; set; } public IEnumerable Rejections { get; set; } } @@ -62,6 +63,7 @@ namespace Sonarr.Api.V3.ManualImport EpisodeFileId = model.EpisodeFileId, ReleaseGroup = model.ReleaseGroup, Quality = model.Quality, + IndexerId = model.IndexerId, Languages = model.Languages, CustomFormats = customFormats.ToResource(false), CustomFormatScore = customFormatScore,