Fixed: Failure to match S12E00 special due to episode file vs folder being parsed differently.

This commit is contained in:
Taloth Saldono 2019-01-21 21:11:55 +01:00
parent 095234babc
commit 9107d1678c
2 changed files with 37 additions and 0 deletions

View File

@ -1,7 +1,9 @@
using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.MediaFiles.EpisodeImport.Specifications;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
@ -131,5 +133,35 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse();
}
[Test]
public void should_be_accepted_if_both_file_and_folder_info_map_to_same_special()
{
var title = "Some.Special.S12E00.WEB-DL.1080p-GoodNightTV";
var actualInfo = Parser.Parser.ParseTitle("Some.Special.S0E100.WEB-DL.1080p-GoodNightTV.mkv");
var folderInfo = Parser.Parser.ParseTitle(title);
var fileInfo = Parser.Parser.ParseTitle(title + ".mkv");
var localEpisode = new LocalEpisode
{
FileEpisodeInfo = fileInfo,
FolderEpisodeInfo = folderInfo,
Series = new Tv.Series
{
Id = 1,
Title = "Some Special"
}
};
Mocker.GetMock<IParsingService>()
.Setup(v => v.ParseSpecialEpisodeTitle(fileInfo, It.IsAny<string>(), 0, 0, null))
.Returns(actualInfo);
Mocker.GetMock<IParsingService>()
.Setup(v => v.ParseSpecialEpisodeTitle(folderInfo, It.IsAny<string>(), 0, 0, null))
.Returns(actualInfo);
Subject.IsSatisfiedBy(localEpisode, null).Accepted.Should().BeTrue();
}
}
}

View File

@ -27,6 +27,11 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
var fileInfo = localEpisode.FileEpisodeInfo;
var folderInfo = localEpisode.FolderEpisodeInfo;
if (fileInfo != null && fileInfo.IsPossibleSceneSeasonSpecial)
{
fileInfo = _parsingService.ParseSpecialEpisodeTitle(fileInfo, fileInfo.ReleaseTitle, localEpisode.Series.TvdbId, 0);
}
if (folderInfo != null && folderInfo.IsPossibleSceneSeasonSpecial)
{
folderInfo = _parsingService.ParseSpecialEpisodeTitle(folderInfo, folderInfo.ReleaseTitle, localEpisode.Series.TvdbId, 0);