1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-23 22:25:14 -04:00

New: Set Indexer flags in Manual Import

This commit is contained in:
Bogdan
2023-08-01 20:28:12 +03:00
parent 25ab396a2c
commit 9dd31be7b3
36 changed files with 444 additions and 97 deletions
@@ -78,8 +78,8 @@ namespace NzbDrone.Core.CustomFormats
MovieInfo = movieInfo,
Movie = movie,
Size = blocklist.Size ?? 0,
IndexerFlags = blocklist.IndexerFlags,
Languages = blocklist.Languages
Languages = blocklist.Languages,
IndexerFlags = blocklist.IndexerFlags
};
return ParseCustomFormat(input);
@@ -90,7 +90,7 @@ namespace NzbDrone.Core.CustomFormats
var parsed = Parser.Parser.ParseMovieTitle(history.SourceTitle);
long.TryParse(history.Data.GetValueOrDefault("size"), out var size);
Enum.TryParse(history.Data.GetValueOrDefault("indexerFlags"), true, out IndexerFlags flags);
Enum.TryParse(history.Data.GetValueOrDefault("indexerFlags"), true, out IndexerFlags indexerFlags);
var movieInfo = new ParsedMovieInfo
{
@@ -108,8 +108,8 @@ namespace NzbDrone.Core.CustomFormats
MovieInfo = movieInfo,
Movie = movie,
Size = size,
IndexerFlags = flags,
Languages = history.Languages
Languages = history.Languages,
IndexerFlags = indexerFlags
};
return ParseCustomFormat(input);
@@ -117,7 +117,7 @@ namespace NzbDrone.Core.CustomFormats
public List<CustomFormat> ParseCustomFormat(LocalMovie localMovie)
{
var episodeInfo = new ParsedMovieInfo
var movieInfo = new ParsedMovieInfo
{
MovieTitles = new List<string>() { localMovie.Movie.Title },
SimpleReleaseTitle = localMovie.SceneName.IsNotNullOrWhiteSpace() ? localMovie.SceneName.SimplifyReleaseTitle() : Path.GetFileName(localMovie.Path).SimplifyReleaseTitle(),
@@ -130,10 +130,11 @@ namespace NzbDrone.Core.CustomFormats
var input = new CustomFormatInput
{
MovieInfo = episodeInfo,
MovieInfo = movieInfo,
Movie = localMovie.Movie,
Size = localMovie.Size,
Languages = localMovie.Languages,
IndexerFlags = localMovie.IndexerFlags,
Filename = Path.GetFileName(localMovie.Path)
};
@@ -203,8 +204,8 @@ namespace NzbDrone.Core.CustomFormats
MovieInfo = movieInfo,
Movie = movie,
Size = movieFile.Size,
IndexerFlags = movieFile.IndexerFlags,
Languages = movieFile.Languages,
IndexerFlags = movieFile.IndexerFlags,
Filename = Path.GetFileName(movieFile.RelativePath)
};
@@ -15,7 +15,7 @@ namespace NzbDrone.Core.CustomFormats
{
if (!Enum.IsDefined(typeof(IndexerFlags), qualityValue))
{
context.AddFailure(string.Format("Invalid indexer flag condition value: {0}", qualityValue));
context.AddFailure($"Invalid indexer flag condition value: {qualityValue}");
}
});
}
@@ -23,17 +23,17 @@ namespace NzbDrone.Core.CustomFormats
public class IndexerFlagSpecification : CustomFormatSpecificationBase
{
private static readonly IndexerFlagSpecificationValidator Validator = new IndexerFlagSpecificationValidator();
private static readonly IndexerFlagSpecificationValidator Validator = new ();
public override int Order => 4;
public override string ImplementationName => "Indexer Flag";
[FieldDefinition(1, Label = "Flag", Type = FieldType.Select, SelectOptions = typeof(IndexerFlags))]
[FieldDefinition(1, Label = "CustomFormatsSpecificationFlag", Type = FieldType.Select, SelectOptions = typeof(IndexerFlags))]
public int Value { get; set; }
protected override bool IsSatisfiedByWithoutNegate(CustomFormatInput input)
{
return input.IndexerFlags.HasFlag((IndexerFlags)Value) == true;
return input.IndexerFlags.HasFlag((IndexerFlags)Value);
}
public override NzbDroneValidationResult Validate()