Fixed: Files in releases that span multiple TVDB seasons not automatically imported

Closes #5920
This commit is contained in:
Mark McDowall 2023-08-17 21:14:09 -07:00
parent cb27b05a6c
commit d5c6faaf45
2 changed files with 24 additions and 5 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using FizzWare.NBuilder;
using FluentAssertions;
@ -258,5 +259,28 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
}
[Test]
public void should_be_accepted_if_scene_season_number_matches_but_season_number_does_not()
{
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01\S01E01.mkv".AsOsAgnostic();
_localEpisode.FolderEpisodeInfo.EpisodeNumbers = Array.Empty<int>();
_localEpisode.FolderEpisodeInfo.FullSeason = true;
var episode = Builder<Episode>.CreateNew()
.With(e => e.Id = (1 * 10) + 5)
.With(e => e.SeasonNumber = 5)
.With(e => e.SceneSeasonNumber = 1)
.With(e => e.EpisodeNumber = 5)
.Build();
Mocker.GetMock<IParsingService>()
.Setup(s => s.GetEpisodes(_localEpisode.FileEpisodeInfo, It.IsAny<Series>(), true, null))
.Returns(new List<Episode> { episode });
GivenEpisodes(_localEpisode.FolderEpisodeInfo, new[] { 1, 2, 3, 4, 5 });
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
}
}
}

View File

@ -62,11 +62,6 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
return Decision.Accept();
}
if (folderEpisodes.First().SeasonNumber != fileEpisodes.FirstOrDefault()?.SeasonNumber)
{
return Decision.Reject("Season number {0} was unexpected considering the folder name {1}", fileInfo.SeasonNumber, folderInfo.ReleaseTitle);
}
var unexpected = fileEpisodes.Where(e => folderEpisodes.All(o => o.Id != e.Id)).ToList();
if (unexpected.Any())