1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 23:42:33 +01:00

Fixed: Don't use invalid scene mappings. Fixes #1627

This commit is contained in:
Mark McDowall 2017-05-22 21:39:13 -07:00
parent b9df5634bf
commit 563b5ef017
No known key found for this signature in database
GPG Key ID: D4CEFA9A718052E0
2 changed files with 24 additions and 2 deletions

View File

@ -5,6 +5,7 @@ using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.DataAugmentation.Xem;
using NzbDrone.Core.DataAugmentation.Xem.Model;
using NzbDrone.Core.Test.Framework;
@ -98,7 +99,6 @@ namespace NzbDrone.Core.Test.DataAugmentation.SceneNumbering
});
}
[Test]
public void should_not_fetch_scenenumbering_if_not_listed()
{
@ -308,5 +308,19 @@ namespace NzbDrone.Core.Test.DataAugmentation.SceneNumbering
episode.SceneSeasonNumber.Should().NotHaveValue();
episode.SceneEpisodeNumber.Should().NotHaveValue();
}
[Test]
public void should_skip_mapping_when_scene_information_is_all_zero()
{
GivenTvdbMappings();
AddTvdbMapping(0, 0, 0, 8, 3, 1); // 3x01 -> 3x01
AddTvdbMapping(0, 0, 0, 9, 3, 2); // 3x02 -> 3x02
Subject.Handle(new SeriesUpdatedEvent(_series));
Mocker.GetMock<IEpisodeService>()
.Verify(v => v.UpdateEpisodes(It.Is<List<Episode>>(e => e.Any(c => c.SceneAbsoluteEpisodeNumber == 0 && c.SceneSeasonNumber == 0 && c.SceneEpisodeNumber == 0))), Times.Never());
}
}
}

View File

@ -61,7 +61,15 @@ namespace NzbDrone.Core.DataAugmentation.Xem
if (episode == null)
{
_logger.Debug("Information hasn't been added to TheTVDB yet, skipping.");
_logger.Debug("Information hasn't been added to TheTVDB yet, skipping");
continue;
}
if (mapping.Scene.Absolute == 0 &&
mapping.Scene.Season == 0 &&
mapping.Scene.Episode == 0)
{
_logger.Debug("Mapping for {0} S{1:00}E{2:00} is invalid, skipping", series, mapping.Tvdb.Season, mapping.Tvdb.Episode);
continue;
}