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

Fixed: Parsing of releases with episode titles that contain languages

Closes #861
This commit is contained in:
Mark McDowall
2022-12-08 18:59:36 -08:00
committed by GitHub
parent 16e2d130e6
commit 6216a71f8c
35 changed files with 436 additions and 197 deletions
@@ -2,7 +2,6 @@ using System.Linq;
using FluentValidation;
using NzbDrone.Core.Annotations;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.CustomFormats
@@ -32,13 +31,13 @@ namespace NzbDrone.Core.CustomFormats
[FieldDefinition(1, Label = "Language", Type = FieldType.Select, SelectOptions = typeof(LanguageFieldConverter))]
public int Value { get; set; }
protected override bool IsSatisfiedByWithoutNegate(ParsedEpisodeInfo episodeInfo)
protected override bool IsSatisfiedByWithoutNegate(CustomFormatInput input)
{
var comparedLanguage = episodeInfo != null && Value == Language.Original.Id && episodeInfo.ExtraInfo.ContainsKey("OriginalLanguage")
? (Language)episodeInfo.ExtraInfo["OriginalLanguage"]
var comparedLanguage = input.EpisodeInfo != null && Value == Language.Original.Id && input.Series.OriginalLanguage != Language.Unknown
? input.Series.OriginalLanguage
: (Language)Value;
return episodeInfo?.Languages?.Contains(comparedLanguage) ?? false;
return input.Languages?.Contains(comparedLanguage) ?? false;
}
public override NzbDroneValidationResult Validate()