1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-21 22:05:43 -04:00

Add reason enum to decision engine rejections

Co-authored-by: Mark McDowall <mark@mcdowall.ca>
This commit is contained in:
Bogdan
2025-02-02 19:15:46 +02:00
parent cd836fef38
commit 7977e0be05
70 changed files with 560 additions and 430 deletions
@@ -3,6 +3,7 @@ using System.Linq;
using NzbDrone.Common.Crypto;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Languages;
using NzbDrone.Core.MediaFiles.MovieImport;
using NzbDrone.Core.MediaFiles.MovieImport.Manual;
using NzbDrone.Core.Qualities;
using Radarr.Api.V3.CustomFormats;
@@ -27,7 +28,7 @@ namespace Radarr.Api.V3.ManualImport
public List<CustomFormatResource> CustomFormats { get; set; }
public int CustomFormatScore { get; set; }
public int IndexerFlags { get; set; }
public IEnumerable<Rejection> Rejections { get; set; }
public IEnumerable<ImportRejectionResource> Rejections { get; set; }
}
public static class ManualImportResourceMapper
@@ -60,7 +61,7 @@ namespace Radarr.Api.V3.ManualImport
// QualityWeight
DownloadId = model.DownloadId,
IndexerFlags = model.IndexerFlags,
Rejections = model.Rejections
Rejections = model.Rejections.Select(r => r.ToResource())
};
}
@@ -69,4 +70,27 @@ namespace Radarr.Api.V3.ManualImport
return models.Select(ToResource).ToList();
}
}
public class ImportRejectionResource
{
public string Reason { get; set; }
public RejectionType Type { get; set; }
}
public static class ImportRejectionResourceMapper
{
public static ImportRejectionResource ToResource(this ImportRejection rejection)
{
if (rejection == null)
{
return null;
}
return new ImportRejectionResource
{
Reason = rejection.Message,
Type = rejection.Type
};
}
}
}