Fixed: Languages not showing up correctly.

Leonardo Galli 6 years ago
parent b7e35fada8
commit b865103871

@ -1,5 +1,6 @@
using NLog;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.DecisionEngine.Specifications
@ -19,12 +20,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{
var wantedLanguage = subject.Movie.Profile.Value.Language;
_logger.Debug("Checking if report meets language requirements. {0}", subject.ParsedMovieInfo.Languages);
_logger.Debug("Checking if report meets language requirements. {0}", subject.ParsedMovieInfo.Languages.ToExtendedString());
if (!subject.ParsedMovieInfo.Languages.Contains(wantedLanguage))
{
_logger.Debug("Report Language: {0} rejected because it is not wanted, wanted {1}", subject.ParsedMovieInfo.Languages, wantedLanguage);
return Decision.Reject("{0} is wanted, but found {1}", wantedLanguage, subject.ParsedMovieInfo.Languages);
_logger.Debug("Report Language: {0} rejected because it is not wanted, wanted {1}", subject.ParsedMovieInfo.Languages.ToExtendedString(), wantedLanguage);
return Decision.Reject("{0} is wanted, but found {1}", wantedLanguage, subject.ParsedMovieInfo.Languages.ToExtendedString());
}
return Decision.Accept();

@ -1,4 +1,7 @@
namespace NzbDrone.Core.Parser
using System.Collections.Generic;
using System.Linq;
namespace NzbDrone.Core.Parser
{
public enum Language
{
@ -27,4 +30,12 @@
Hungarian = 22,
Hebrew = 23
}
public static class LanguageExtensions
{
public static string ToExtendedString(this IEnumerable<Language> languages)
{
return string.Join(", ", languages.Select(l => l.ToString()));
}
}
}

@ -265,7 +265,7 @@ namespace NzbDrone.Core.Parser
var languageTitle = Regex.Replace(title.Replace(".", " "), foundTitle, "A Movie", RegexOptions.IgnoreCase);
result.Languages = LanguageParser.ParseLanguages(title);
Logger.Debug("Language parsed: {0}", result.Languages);
Logger.Debug("Language parsed: {0}", result.Languages.ToExtendedString());
result.Quality = QualityParser.ParseQuality(title);
Logger.Debug("Quality parsed: {0}", result.Quality);

@ -79,7 +79,7 @@ namespace NzbDrone.Core.Parser
private ParsedMovieInfo EnhanceMinimalInfo(ParsedMovieInfo minimalInfo, List<object> helpers)
{
minimalInfo.Languages = LanguageParser.ParseLanguages(minimalInfo.SimpleReleaseTitle);
_logger.Debug("Language(s) parsed: {0}", string.Join(", ", minimalInfo.Languages));
_logger.Debug("Language(s) parsed: {0}", string.Join(", ", minimalInfo.Languages.ToExtendedString()));
minimalInfo.Quality = QualityParser.ParseQuality(minimalInfo.SimpleReleaseTitle);

Loading…
Cancel
Save