Fixed: Regression in Quality fallback by extension.

This commit is contained in:
Taloth Saldono 2017-05-13 00:05:23 +02:00
parent 2a86f8c241
commit 2dbf095fd5
2 changed files with 18 additions and 8 deletions

View File

@ -1,6 +1,8 @@
using System.Linq;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.ParserTests
@ -47,7 +49,7 @@ namespace NzbDrone.Core.Test.ParserTests
public void should_remove_accents_from_title()
{
const string title = "Carniv\u00E0le";
title.CleanSeriesTitle().Should().Be("carnivale");
}
@ -62,5 +64,13 @@ namespace NzbDrone.Core.Test.ParserTests
{
Parser.Parser.ParseTitle(postTitle).SeriesTitle.Should().Be(title);
}
[TestCase("Revolution.S01E02.Chained.Heat.mkv")]
[TestCase("Dexter - S01E01 - Title.avi")]
public void should_parse_quality_from_extension(string title)
{
Parser.Parser.ParseTitle(title).Quality.Quality.Should().NotBe(Quality.Unknown);
Parser.Parser.ParseTitle(title).Quality.QualitySource.Should().Be(QualitySource.Extension);
}
}
}

View File

@ -316,9 +316,9 @@ namespace NzbDrone.Core.Parser
Logger.Debug("Reversed name detected. Converted to '{0}'", title);
}
title = RemoveFileExtension(title);
var releaseTitle = RemoveFileExtension(title);
var simpleTitle = SimpleTitleRegex.Replace(title, string.Empty);
var simpleTitle = SimpleTitleRegex.Replace(releaseTitle, string.Empty);
// TODO: Quick fix stripping [url] - prefixes.
simpleTitle = WebsitePrefixRegex.Replace(simpleTitle, string.Empty);
@ -365,13 +365,13 @@ namespace NzbDrone.Core.Parser
result.Special = true;
}
result.Language = LanguageParser.ParseLanguage(title);
result.Language = LanguageParser.ParseLanguage(releaseTitle);
Logger.Debug("Language parsed: {0}", result.Language);
result.Quality = QualityParser.ParseQuality(title);
Logger.Debug("Quality parsed: {0}", result.Quality);
result.ReleaseGroup = ParseReleaseGroup(title);
result.ReleaseGroup = ParseReleaseGroup(releaseTitle);
var subGroup = GetSubGroup(match);
if (!subGroup.IsNullOrWhiteSpace())
@ -522,7 +522,7 @@ namespace NzbDrone.Core.Parser
return seriesTitleInfo;
}
private static ParsedEpisodeInfo ParseMatchCollection(MatchCollection matchCollection, string title)
private static ParsedEpisodeInfo ParseMatchCollection(MatchCollection matchCollection, string releaseTitle)
{
var seriesName = matchCollection[0].Groups["title"].Value.Replace('.', ' ').Replace('_', ' ');
seriesName = RequestInfoRegex.Replace(seriesName, "").Trim(' ');
@ -551,7 +551,7 @@ namespace NzbDrone.Core.Parser
result = new ParsedEpisodeInfo
{
ReleaseTitle = title,
ReleaseTitle = releaseTitle,
SeasonNumber = seasons.First(),
EpisodeNumbers = new int[0],
AbsoluteEpisodeNumbers = new int[0]
@ -645,7 +645,7 @@ namespace NzbDrone.Core.Parser
result = new ParsedEpisodeInfo
{
ReleaseTitle = title,
ReleaseTitle = releaseTitle,
AirDate = airDate.ToString(Episode.AIR_DATE_FORMAT),
};
}