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

New: Except language option for Language Custom Formats

(cherry picked from commit 1584311914eed697fdd0f143951f4adfe3403351)

Closes #10388
This commit is contained in:
Mark McDowall
2024-09-02 13:26:35 -07:00
committed by Bogdan
parent a3faa9ed5f
commit 593b943cb0
4 changed files with 56 additions and 1 deletions
@@ -30,6 +30,9 @@ namespace NzbDrone.Core.CustomFormats
[FieldDefinition(1, Label = "Language", Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter))]
public int Value { get; set; }
[FieldDefinition(1, Label = "CustomFormatsSpecificationExceptLanguage", HelpText = "CustomFormatsSpecificationExceptLanguageHelpText", Type = FieldType.Checkbox)]
public bool ExceptLanguage { get; set; }
public override bool IsSatisfiedBy(CustomFormatInput input)
{
if (Negate)
@@ -46,7 +49,12 @@ namespace NzbDrone.Core.CustomFormats
? input.Movie.MovieMetadata.Value.OriginalLanguage
: (Language)Value;
return input?.Languages?.Contains(comparedLanguage) ?? false;
if (ExceptLanguage)
{
return input.Languages?.Any(l => l != comparedLanguage) ?? false;
}
return input.Languages?.Contains(comparedLanguage) ?? false;
}
private bool IsSatisfiedByWithNegate(CustomFormatInput input)
@@ -55,6 +63,11 @@ namespace NzbDrone.Core.CustomFormats
? input.Movie.MovieMetadata.Value.OriginalLanguage
: (Language)Value;
if (ExceptLanguage)
{
return !input.Languages?.Any(l => l != comparedLanguage) ?? false;
}
return !input.Languages?.Contains(comparedLanguage) ?? false;
}