mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
Fixed: Failure to match S12E00 special due to episode file vs folder being parsed differently.
This commit is contained in:
parent
095234babc
commit
9107d1678c
@ -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 @@ public void should_be_rejected_if_file_and_folder_do_not_have_episodes_from_the_
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,11 @@ public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem down
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user