From e2272dcca3963aa8b8b2af22236721178b20720d Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Fri, 5 Aug 2016 22:18:33 +0200 Subject: [PATCH] Reject m2ts (bluray) raw releases from BTN as well. --- ...tionFixture.cs => RawDiskSpecificationFixture.cs} | 9 ++++++++- src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj | 2 +- .../{DvdSpecification.cs => RawDiskSpecification.cs} | 12 ++++++++++-- src/NzbDrone.Core/NzbDrone.Core.csproj | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) rename src/NzbDrone.Core.Test/DecisionEngineTests/{DvdSpecificationFixture.cs => RawDiskSpecificationFixture.cs} (87%) rename src/NzbDrone.Core/DecisionEngine/Specifications/{DvdSpecification.cs => RawDiskSpecification.cs} (69%) diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/DvdSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/RawDiskSpecificationFixture.cs similarity index 87% rename from src/NzbDrone.Core.Test/DecisionEngineTests/DvdSpecificationFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/RawDiskSpecificationFixture.cs index 209917502..2d205cc7a 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/DvdSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/RawDiskSpecificationFixture.cs @@ -18,7 +18,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - public class DvdSpecificationFixture : CoreTest + public class RawDiskSpecificationFixture : CoreTest { private RemoteEpisode _remoteEpisode; @@ -63,6 +63,13 @@ public void should_return_false_if_iso() Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeFalse(); } + [Test] + public void should_return_false_if_m2ts() + { + WithContainer("M2TS"); + Subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeFalse(); + } + [Test] public void should_compare_case_insensitive() { diff --git a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index 8edd74b9d..26ae602a3 100644 --- a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -156,7 +156,7 @@ - + diff --git a/src/NzbDrone.Core/DecisionEngine/Specifications/DvdSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/RawDiskSpecification.cs similarity index 69% rename from src/NzbDrone.Core/DecisionEngine/Specifications/DvdSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/RawDiskSpecification.cs index d265b2813..e4a1995c7 100644 --- a/src/NzbDrone.Core/DecisionEngine/Specifications/DvdSpecification.cs +++ b/src/NzbDrone.Core/DecisionEngine/Specifications/RawDiskSpecification.cs @@ -6,13 +6,15 @@ namespace NzbDrone.Core.DecisionEngine.Specifications { - public class DvdSpecification : IDecisionEngineSpecification + public class RawDiskSpecification : IDecisionEngineSpecification { private static readonly string[] _dvdContainerTypes = new[] { "vob", "iso" }; + private static readonly string[] _blurayContainerTypes = new[] { "m2ts" }; + private readonly Logger _logger; - public DvdSpecification(Logger logger) + public RawDiskSpecification(Logger logger) { _logger = logger; } @@ -32,6 +34,12 @@ public virtual Decision IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase return Decision.Reject("Raw DVD release"); } + if (_blurayContainerTypes.Contains(subject.Release.Container.ToLower())) + { + _logger.Debug("Release contains raw Bluray, rejecting."); + return Decision.Reject("Raw Bluray release"); + } + return Decision.Accept(); } } diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 1245b562b..4a2f3f438 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -331,7 +331,7 @@ - +