mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-03-05 15:15:59 +02:00
New: Prevent automatic import if file quality differs from grabbed release quality
This commit is contained in:
parent
0bbb82c67f
commit
9d93fc1092
@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
@ -14,6 +14,7 @@ using NzbDrone.Core.Test.Framework;
|
|||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.MediaFiles
|
namespace NzbDrone.Core.Test.MediaFiles
|
||||||
{
|
{
|
||||||
@ -77,7 +78,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|||||||
Subject.ProcessRootFolder(new DirectoryInfo(_droneFactory));
|
Subject.ProcessRootFolder(new DirectoryInfo(_droneFactory));
|
||||||
|
|
||||||
Mocker.GetMock<IMakeImportDecision>()
|
Mocker.GetMock<IMakeImportDecision>()
|
||||||
.Verify(c => c.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), It.IsAny<ParsedEpisodeInfo>(), It.IsAny<bool>()),
|
.Verify(c => c.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), It.IsAny<DownloadClientItem>(), It.IsAny<ParsedEpisodeInfo>(), It.IsAny<bool>()),
|
||||||
Times.Never());
|
Times.Never());
|
||||||
|
|
||||||
VerifyNoImport();
|
VerifyNoImport();
|
||||||
@ -128,7 +129,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|||||||
imported.Add(new ImportDecision(localEpisode));
|
imported.Add(new ImportDecision(localEpisode));
|
||||||
|
|
||||||
Mocker.GetMock<IMakeImportDecision>()
|
Mocker.GetMock<IMakeImportDecision>()
|
||||||
.Setup(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), null, true))
|
.Setup(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), It.IsAny<DownloadClientItem>(), null, true))
|
||||||
.Returns(imported);
|
.Returns(imported);
|
||||||
|
|
||||||
Mocker.GetMock<IImportApprovedEpisodes>()
|
Mocker.GetMock<IImportApprovedEpisodes>()
|
||||||
@ -154,7 +155,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|||||||
imported.Add(new ImportDecision(localEpisode));
|
imported.Add(new ImportDecision(localEpisode));
|
||||||
|
|
||||||
Mocker.GetMock<IMakeImportDecision>()
|
Mocker.GetMock<IMakeImportDecision>()
|
||||||
.Setup(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), null, true))
|
.Setup(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), It.IsAny<DownloadClientItem>(), null, true))
|
||||||
.Returns(imported);
|
.Returns(imported);
|
||||||
|
|
||||||
Mocker.GetMock<IImportApprovedEpisodes>()
|
Mocker.GetMock<IImportApprovedEpisodes>()
|
||||||
@ -226,7 +227,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|||||||
imported.Add(new ImportDecision(localEpisode));
|
imported.Add(new ImportDecision(localEpisode));
|
||||||
|
|
||||||
Mocker.GetMock<IMakeImportDecision>()
|
Mocker.GetMock<IMakeImportDecision>()
|
||||||
.Setup(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), null, true))
|
.Setup(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), It.IsAny<DownloadClientItem>(), null, true))
|
||||||
.Returns(imported);
|
.Returns(imported);
|
||||||
|
|
||||||
Mocker.GetMock<IImportApprovedEpisodes>()
|
Mocker.GetMock<IImportApprovedEpisodes>()
|
||||||
@ -280,7 +281,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|||||||
Subject.ProcessPath(fileName);
|
Subject.ProcessPath(fileName);
|
||||||
|
|
||||||
Mocker.GetMock<IMakeImportDecision>()
|
Mocker.GetMock<IMakeImportDecision>()
|
||||||
.Verify(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), It.Is<ParsedEpisodeInfo>(v => v.AbsoluteEpisodeNumbers.First() == 9), true), Times.Once());
|
.Verify(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), It.IsAny<DownloadClientItem>(), It.Is<ParsedEpisodeInfo>(v => v.AbsoluteEpisodeNumbers.First() == 9), true), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -304,7 +305,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|||||||
var result = Subject.ProcessPath(fileName);
|
var result = Subject.ProcessPath(fileName);
|
||||||
|
|
||||||
Mocker.GetMock<IMakeImportDecision>()
|
Mocker.GetMock<IMakeImportDecision>()
|
||||||
.Verify(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), null, true), Times.Once());
|
.Verify(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), It.IsAny<DownloadClientItem>(), null, true), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -337,7 +338,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|||||||
imported.Add(new ImportDecision(localEpisode));
|
imported.Add(new ImportDecision(localEpisode));
|
||||||
|
|
||||||
Mocker.GetMock<IMakeImportDecision>()
|
Mocker.GetMock<IMakeImportDecision>()
|
||||||
.Setup(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), null, true))
|
.Setup(s => s.GetImportDecisions(It.IsAny<List<string>>(), It.IsAny<Series>(), It.IsAny<DownloadClientItem>(), null, true))
|
||||||
.Returns(imported);
|
.Returns(imported);
|
||||||
|
|
||||||
Mocker.GetMock<IImportApprovedEpisodes>()
|
Mocker.GetMock<IImportApprovedEpisodes>()
|
||||||
|
@ -14,6 +14,7 @@ using NzbDrone.Core.Test.Framework;
|
|||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
||||||
{
|
{
|
||||||
@ -44,13 +45,13 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|||||||
_fail2 = new Mock<IImportDecisionEngineSpecification>();
|
_fail2 = new Mock<IImportDecisionEngineSpecification>();
|
||||||
_fail3 = new Mock<IImportDecisionEngineSpecification>();
|
_fail3 = new Mock<IImportDecisionEngineSpecification>();
|
||||||
|
|
||||||
_pass1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(Decision.Accept());
|
_pass1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||||
_pass2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(Decision.Accept());
|
_pass2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||||
_pass3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(Decision.Accept());
|
_pass3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||||
|
|
||||||
_fail1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(Decision.Reject("_fail1"));
|
_fail1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail1"));
|
||||||
_fail2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(Decision.Reject("_fail2"));
|
_fail2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail2"));
|
||||||
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>())).Returns(Decision.Reject("_fail3"));
|
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail3"));
|
||||||
|
|
||||||
_series = Builder<Series>.CreateNew()
|
_series = Builder<Series>.CreateNew()
|
||||||
.With(e => e.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() })
|
.With(e => e.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities() })
|
||||||
@ -92,14 +93,14 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|||||||
{
|
{
|
||||||
GivenSpecifications(_pass1, _pass2, _pass3, _fail1, _fail2, _fail3);
|
GivenSpecifications(_pass1, _pass2, _pass3, _fail1, _fail2, _fail3);
|
||||||
|
|
||||||
Subject.GetImportDecisions(_videoFiles, new Series(), null, false);
|
Subject.GetImportDecisions(_videoFiles, new Series(), new DownloadClientItem(), null, false);
|
||||||
|
|
||||||
_fail1.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
_fail1.Verify(c => c.IsSatisfiedBy(_localEpisode, null), Times.Once());
|
||||||
_fail2.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
_fail2.Verify(c => c.IsSatisfiedBy(_localEpisode, null), Times.Once());
|
||||||
_fail3.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
_fail3.Verify(c => c.IsSatisfiedBy(_localEpisode, null), Times.Once());
|
||||||
_pass1.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
_pass1.Verify(c => c.IsSatisfiedBy(_localEpisode, null), Times.Once());
|
||||||
_pass2.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
_pass2.Verify(c => c.IsSatisfiedBy(_localEpisode, null), Times.Once());
|
||||||
_pass3.Verify(c => c.IsSatisfiedBy(_localEpisode), Times.Once());
|
_pass3.Verify(c => c.IsSatisfiedBy(_localEpisode, null), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -184,7 +185,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|||||||
GivenSpecifications(_pass1, _pass2, _pass3);
|
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||||
var expectedQuality = QualityParser.ParseQuality(_videoFiles.Single());
|
var expectedQuality = QualityParser.ParseQuality(_videoFiles.Single());
|
||||||
|
|
||||||
var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo{Quality = new QualityModel(Quality.SDTV)}, true);
|
var result = Subject.GetImportDecisions(_videoFiles, _series, null, new ParsedEpisodeInfo{Quality = new QualityModel(Quality.SDTV)}, true);
|
||||||
|
|
||||||
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
|
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
|
||||||
}
|
}
|
||||||
@ -201,7 +202,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|||||||
|
|
||||||
var expectedQuality = new QualityModel(Quality.SDTV);
|
var expectedQuality = new QualityModel(Quality.SDTV);
|
||||||
|
|
||||||
var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo { Quality = expectedQuality }, true);
|
var result = Subject.GetImportDecisions(_videoFiles, _series, null, new ParsedEpisodeInfo { Quality = expectedQuality }, true);
|
||||||
|
|
||||||
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
|
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
|
||||||
}
|
}
|
||||||
@ -217,7 +218,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|||||||
|
|
||||||
var expectedQuality = new QualityModel(Quality.Bluray720p);
|
var expectedQuality = new QualityModel(Quality.Bluray720p);
|
||||||
|
|
||||||
var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo { Quality = expectedQuality }, true);
|
var result = Subject.GetImportDecisions(_videoFiles, _series, null, new ParsedEpisodeInfo { Quality = expectedQuality }, true);
|
||||||
|
|
||||||
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
|
result.Single().LocalEpisode.Quality.Should().Be(expectedQuality);
|
||||||
}
|
}
|
||||||
@ -264,7 +265,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|||||||
|
|
||||||
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01");
|
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01");
|
||||||
|
|
||||||
Subject.GetImportDecisions(_videoFiles, _series, folderInfo, true);
|
Subject.GetImportDecisions(_videoFiles, _series, null, folderInfo, true);
|
||||||
|
|
||||||
Mocker.GetMock<IParsingService>()
|
Mocker.GetMock<IParsingService>()
|
||||||
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), null, true), Times.Exactly(3));
|
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), null, true), Times.Exactly(3));
|
||||||
@ -287,7 +288,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|||||||
|
|
||||||
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01");
|
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01");
|
||||||
|
|
||||||
Subject.GetImportDecisions(_videoFiles, _series, folderInfo, true);
|
Subject.GetImportDecisions(_videoFiles, _series, null, folderInfo, true);
|
||||||
|
|
||||||
Mocker.GetMock<IParsingService>()
|
Mocker.GetMock<IParsingService>()
|
||||||
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), null, true), Times.Exactly(2));
|
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), null, true), Times.Exactly(2));
|
||||||
@ -309,7 +310,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|||||||
|
|
||||||
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01");
|
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01");
|
||||||
|
|
||||||
Subject.GetImportDecisions(_videoFiles, _series, folderInfo, true);
|
Subject.GetImportDecisions(_videoFiles, _series, null, folderInfo, true);
|
||||||
|
|
||||||
Mocker.GetMock<IParsingService>()
|
Mocker.GetMock<IParsingService>()
|
||||||
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), It.IsAny<ParsedEpisodeInfo>(), true), Times.Exactly(1));
|
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), It.IsAny<ParsedEpisodeInfo>(), true), Times.Exactly(1));
|
||||||
@ -336,7 +337,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|||||||
|
|
||||||
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01");
|
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01");
|
||||||
|
|
||||||
Subject.GetImportDecisions(_videoFiles, _series, folderInfo, true);
|
Subject.GetImportDecisions(_videoFiles, _series, null, folderInfo, true);
|
||||||
|
|
||||||
Mocker.GetMock<IParsingService>()
|
Mocker.GetMock<IParsingService>()
|
||||||
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), It.IsAny<ParsedEpisodeInfo>(), true), Times.Exactly(2));
|
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), It.IsAny<ParsedEpisodeInfo>(), true), Times.Exactly(2));
|
||||||
@ -358,7 +359,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|||||||
|
|
||||||
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01.720p.HDTV-LOL");
|
var folderInfo = Parser.Parser.ParseTitle("Series.Title.S01E01.720p.HDTV-LOL");
|
||||||
|
|
||||||
Subject.GetImportDecisions(_videoFiles, _series, folderInfo, true);
|
Subject.GetImportDecisions(_videoFiles, _series, null, folderInfo, true);
|
||||||
|
|
||||||
Mocker.GetMock<IParsingService>()
|
Mocker.GetMock<IParsingService>()
|
||||||
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), null, true), Times.Exactly(1));
|
.Verify(c => c.GetLocalEpisode(It.IsAny<string>(), It.IsAny<Series>(), null, true), Times.Exactly(1));
|
||||||
@ -380,7 +381,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
|
|||||||
|
|
||||||
var folderQuality = new QualityModel(Quality.Unknown);
|
var folderQuality = new QualityModel(Quality.Unknown);
|
||||||
|
|
||||||
var result = Subject.GetImportDecisions(_videoFiles, _series, new ParsedEpisodeInfo { Quality = folderQuality}, true);
|
var result = Subject.GetImportDecisions(_videoFiles, _series, null, new ParsedEpisodeInfo { Quality = folderQuality}, true);
|
||||||
|
|
||||||
result.Single().LocalEpisode.Quality.Should().Be(_quality);
|
result.Single().LocalEpisode.Quality.Should().Be(_quality);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
GivenFileSize(100.Megabytes());
|
GivenFileSize(100.Megabytes());
|
||||||
GivenFreeSpace(80.Megabytes());
|
GivenFreeSpace(80.Megabytes());
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse();
|
||||||
ExceptionVerification.ExpectedWarns(1);
|
ExceptionVerification.ExpectedWarns(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
GivenFileSize(100.Megabytes());
|
GivenFileSize(100.Megabytes());
|
||||||
GivenFreeSpace(150.Megabytes());
|
GivenFreeSpace(150.Megabytes());
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse();
|
||||||
ExceptionVerification.ExpectedWarns(1);
|
ExceptionVerification.ExpectedWarns(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
GivenFileSize(100.Megabytes());
|
GivenFileSize(100.Megabytes());
|
||||||
GivenFreeSpace(1.Gigabytes());
|
GivenFreeSpace(1.Gigabytes());
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -92,7 +92,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
GivenFileSize(100.Megabytes());
|
GivenFileSize(100.Megabytes());
|
||||||
GivenFreeSpace(1.Gigabytes());
|
GivenFreeSpace(1.Gigabytes());
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
.Verify(v => v.GetAvailableSpace(_rootFolder), Times.Once());
|
.Verify(v => v.GetAvailableSpace(_rootFolder), Times.Once());
|
||||||
@ -104,7 +104,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
GivenFileSize(100.Megabytes());
|
GivenFileSize(100.Megabytes());
|
||||||
GivenFreeSpace(null);
|
GivenFreeSpace(null);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -116,7 +116,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
.Setup(s => s.GetAvailableSpace(It.IsAny<string>()))
|
.Setup(s => s.GetAvailableSpace(It.IsAny<string>()))
|
||||||
.Throws(new TestException());
|
.Throws(new TestException());
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
ExceptionVerification.ExpectedErrors(1);
|
ExceptionVerification.ExpectedErrors(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
{
|
{
|
||||||
_localEpisode.ExistingFile = true;
|
_localEpisode.ExistingFile = true;
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
.Verify(s => s.GetAvailableSpace(It.IsAny<string>()), Times.Never());
|
.Verify(s => s.GetAvailableSpace(It.IsAny<string>()), Times.Never());
|
||||||
@ -140,7 +140,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
.Setup(s => s.GetAvailableSpace(It.IsAny<string>()))
|
.Setup(s => s.GetAvailableSpace(It.IsAny<string>()))
|
||||||
.Returns(freeSpace);
|
.Returns(freeSpace);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -150,7 +150,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
.Setup(s => s.SkipFreeSpaceCheckWhenImporting)
|
.Setup(s => s.SkipFreeSpaceCheckWhenImporting)
|
||||||
.Returns(true);
|
.Returns(true);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,13 +34,13 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
{
|
{
|
||||||
_localEpisode.ParsedEpisodeInfo.FullSeason = true;
|
_localEpisode.ParsedEpisodeInfo.FullSeason = true;
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_return_true_when_file_does_not_contain_the_full_season()
|
public void should_return_true_when_file_does_not_contain_the_full_season()
|
||||||
{
|
{
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,102 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using FizzWare.NBuilder;
|
||||||
|
using FluentAssertions;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
|
using NzbDrone.Core.History;
|
||||||
|
using NzbDrone.Core.MediaFiles.EpisodeImport.Specifications;
|
||||||
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
using NzbDrone.Core.Qualities;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class GrabbedReleaseQualityFixture : CoreTest<GrabbedReleaseQualitySpecification>
|
||||||
|
{
|
||||||
|
private LocalEpisode _localEpisode;
|
||||||
|
private DownloadClientItem _downloadClientItem;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
_localEpisode = Builder<LocalEpisode>.CreateNew()
|
||||||
|
.With(l => l.Path = @"C:\Test\Unsorted\Series.Title.S01E01.720p.HDTV-Sonarr\S01E05.mkv".AsOsAgnostic())
|
||||||
|
.With(l => l.Quality = new QualityModel(Quality.Bluray720p))
|
||||||
|
.With(l => l.ParsedEpisodeInfo =
|
||||||
|
Builder<ParsedEpisodeInfo>.CreateNew()
|
||||||
|
.With(p => p.EpisodeNumbers = new[] {5})
|
||||||
|
.With(p => p.FullSeason = false)
|
||||||
|
.Build())
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
_downloadClientItem = Builder<DownloadClientItem>.CreateNew()
|
||||||
|
.Build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GivenHistory(List<History.History> history)
|
||||||
|
{
|
||||||
|
Mocker.GetMock<IHistoryService>()
|
||||||
|
.Setup(s => s.FindByDownloadId(It.IsAny<string>()))
|
||||||
|
.Returns(history);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_be_accepted_when_downloadClientItem_is_ull()
|
||||||
|
{
|
||||||
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_be_accepted_if_no_history_for_downloadId()
|
||||||
|
{
|
||||||
|
GivenHistory(new List<History.History>());
|
||||||
|
|
||||||
|
Subject.IsSatisfiedBy(_localEpisode, _downloadClientItem).Accepted.Should().BeTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_be_accepted_if_no_grabbed_history_for_downloadId()
|
||||||
|
{
|
||||||
|
var history = Builder<History.History>.CreateListOfSize(1)
|
||||||
|
.All()
|
||||||
|
.With(h => h.EventType = HistoryEventType.Unknown)
|
||||||
|
.BuildList();
|
||||||
|
|
||||||
|
GivenHistory(history);
|
||||||
|
|
||||||
|
Subject.IsSatisfiedBy(_localEpisode, _downloadClientItem).Accepted.Should().BeTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_be_accepted_if_grabbed_history_quality_matches()
|
||||||
|
{
|
||||||
|
var history = Builder<History.History>.CreateListOfSize(1)
|
||||||
|
.All()
|
||||||
|
.With(h => h.EventType = HistoryEventType.Grabbed)
|
||||||
|
.With(h => h.Quality = _localEpisode.Quality)
|
||||||
|
.BuildList();
|
||||||
|
|
||||||
|
GivenHistory(history);
|
||||||
|
|
||||||
|
Subject.IsSatisfiedBy(_localEpisode, _downloadClientItem).Accepted.Should().BeTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_be_rejected_if_grabbed_history_quality_does_not_match()
|
||||||
|
{
|
||||||
|
var history = Builder<History.History>.CreateListOfSize(1)
|
||||||
|
.All()
|
||||||
|
.With(h => h.EventType = HistoryEventType.Grabbed)
|
||||||
|
.With(h => h.Quality = new QualityModel(Quality.HDTV720p))
|
||||||
|
.BuildList();
|
||||||
|
|
||||||
|
GivenHistory(history);
|
||||||
|
|
||||||
|
Subject.IsSatisfiedBy(_localEpisode, _downloadClientItem).Accepted.Should().BeFalse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
{
|
{
|
||||||
_localEpisode.ExistingFile = true;
|
_localEpisode.ExistingFile = true;
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
{
|
{
|
||||||
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title\S01E01.mkv".AsOsAgnostic();
|
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title\S01E01.mkv".AsOsAgnostic();
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -47,7 +47,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
{
|
{
|
||||||
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01\S01E01.mkv".AsOsAgnostic();
|
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01\S01E01.mkv".AsOsAgnostic();
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
{
|
{
|
||||||
_localEpisode.ParsedEpisodeInfo.EpisodeNumbers = new[] { 1 };
|
_localEpisode.ParsedEpisodeInfo.EpisodeNumbers = new[] { 1 };
|
||||||
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01E01.720p.HDTV-Sonarr\S01E01.mkv".AsOsAgnostic();
|
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01E01.720p.HDTV-Sonarr\S01E01.mkv".AsOsAgnostic();
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -63,14 +63,14 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
{
|
{
|
||||||
_localEpisode.ParsedEpisodeInfo.EpisodeNumbers = new[] { 1 };
|
_localEpisode.ParsedEpisodeInfo.EpisodeNumbers = new[] { 1 };
|
||||||
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01E01E02.720p.HDTV-Sonarr\S01E01.mkv".AsOsAgnostic();
|
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01E01E02.720p.HDTV-Sonarr\S01E01.mkv".AsOsAgnostic();
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_be_rejected_if_file_and_folder_do_not_have_same_episode()
|
public void should_be_rejected_if_file_and_folder_do_not_have_same_episode()
|
||||||
{
|
{
|
||||||
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01E01.720p.HDTV-Sonarr\S01E05.mkv".AsOsAgnostic();
|
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01E01.720p.HDTV-Sonarr\S01E05.mkv".AsOsAgnostic();
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
{
|
{
|
||||||
_localEpisode.ParsedEpisodeInfo.EpisodeNumbers = new[] { 5, 6 };
|
_localEpisode.ParsedEpisodeInfo.EpisodeNumbers = new[] { 5, 6 };
|
||||||
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01E01E02.720p.HDTV-Sonarr\S01E05E06.mkv".AsOsAgnostic();
|
_localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01E01E02.720p.HDTV-Sonarr\S01E05E06.mkv".AsOsAgnostic();
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
public void should_return_true_for_existing_file()
|
public void should_return_true_for_existing_file()
|
||||||
{
|
{
|
||||||
_localEpisode.ExistingFile = true;
|
_localEpisode.ExistingFile = true;
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_true_if_not_in_working_folder()
|
public void should_return_true_if_not_in_working_folder()
|
||||||
{
|
{
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -59,7 +59,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
GivenInWorkingFolder();
|
GivenInWorkingFolder();
|
||||||
GivenLastWriteTimeUtc(DateTime.UtcNow.AddHours(-1));
|
GivenLastWriteTimeUtc(DateTime.UtcNow.AddHours(-1));
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -68,7 +68,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
GivenInWorkingFolder();
|
GivenInWorkingFolder();
|
||||||
GivenLastWriteTimeUtc(DateTime.UtcNow);
|
GivenLastWriteTimeUtc(DateTime.UtcNow);
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -79,7 +79,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
GivenInWorkingFolder();
|
GivenInWorkingFolder();
|
||||||
GivenLastWriteTimeUtc(DateTime.UtcNow.AddDays(-5));
|
GivenLastWriteTimeUtc(DateTime.UtcNow.AddDays(-5));
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
.Build()
|
.Build()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -58,7 +58,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
.Build()
|
.Build()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -75,7 +75,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
.Build()
|
.Build()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -92,7 +92,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
.Build()
|
.Build()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeTrue();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -109,7 +109,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
.Build()
|
.Build()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -126,7 +126,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
.Build()
|
.Build()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -150,7 +150,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
|||||||
.Build()
|
.Build()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
Subject.IsSatisfiedBy(_localEpisode).Accepted.Should().BeFalse();
|
Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -283,6 +283,7 @@
|
|||||||
<Compile Include="MediaFiles\EpisodeImport\SampleServiceFixture.cs" />
|
<Compile Include="MediaFiles\EpisodeImport\SampleServiceFixture.cs" />
|
||||||
<Compile Include="MediaFiles\EpisodeImport\Specifications\FreeSpaceSpecificationFixture.cs" />
|
<Compile Include="MediaFiles\EpisodeImport\Specifications\FreeSpaceSpecificationFixture.cs" />
|
||||||
<Compile Include="MediaFiles\EpisodeImport\Specifications\FullSeasonSpecificationFixture.cs" />
|
<Compile Include="MediaFiles\EpisodeImport\Specifications\FullSeasonSpecificationFixture.cs" />
|
||||||
|
<Compile Include="MediaFiles\EpisodeImport\Specifications\GrabbedReleaseQualityFixture.cs" />
|
||||||
<Compile Include="MediaFiles\EpisodeImport\Specifications\MatchesFolderSpecificationFixture.cs" />
|
<Compile Include="MediaFiles\EpisodeImport\Specifications\MatchesFolderSpecificationFixture.cs" />
|
||||||
<Compile Include="MediaFiles\EpisodeImport\Specifications\NotSampleSpecificationFixture.cs" />
|
<Compile Include="MediaFiles\EpisodeImport\Specifications\NotSampleSpecificationFixture.cs" />
|
||||||
<Compile Include="MediaFiles\EpisodeImport\Specifications\NotUnpackingSpecificationFixture.cs" />
|
<Compile Include="MediaFiles\EpisodeImport\Specifications\NotUnpackingSpecificationFixture.cs" />
|
||||||
|
@ -182,7 +182,7 @@ namespace NzbDrone.Core.MediaFiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var decisions = _importDecisionMaker.GetImportDecisions(videoFiles.ToList(), series, folderInfo, true);
|
var decisions = _importDecisionMaker.GetImportDecisions(videoFiles.ToList(), series, downloadClientItem, folderInfo, true);
|
||||||
var importResults = _importApprovedEpisodes.Import(decisions, true, downloadClientItem, importMode);
|
var importResults = _importApprovedEpisodes.Import(decisions, true, downloadClientItem, importMode);
|
||||||
|
|
||||||
if ((downloadClientItem == null || downloadClientItem.CanMoveFiles) &&
|
if ((downloadClientItem == null || downloadClientItem.CanMoveFiles) &&
|
||||||
@ -236,7 +236,7 @@ namespace NzbDrone.Core.MediaFiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var decisions = _importDecisionMaker.GetImportDecisions(new List<string>() { fileInfo.FullName }, series, null, true);
|
var decisions = _importDecisionMaker.GetImportDecisions(new List<string>() { fileInfo.FullName }, series, downloadClientItem, null, true);
|
||||||
|
|
||||||
return _importApprovedEpisodes.Import(decisions, true, downloadClientItem, importMode);
|
return _importApprovedEpisodes.Import(decisions, true, downloadClientItem, importMode);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||||
{
|
{
|
||||||
public interface IImportDecisionEngineSpecification
|
public interface IImportDecisionEngineSpecification
|
||||||
{
|
{
|
||||||
Decision IsSatisfiedBy(LocalEpisode localEpisode);
|
Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem downloadClientItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using NLog;
|
|||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
@ -18,7 +19,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
|||||||
public interface IMakeImportDecision
|
public interface IMakeImportDecision
|
||||||
{
|
{
|
||||||
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series);
|
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series);
|
||||||
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series, ParsedEpisodeInfo folderInfo, bool sceneSource);
|
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series, DownloadClientItem downloadClientItem, ParsedEpisodeInfo folderInfo, bool sceneSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ImportDecisionMaker : IMakeImportDecision
|
public class ImportDecisionMaker : IMakeImportDecision
|
||||||
@ -50,10 +51,10 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
|||||||
|
|
||||||
public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series)
|
public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series)
|
||||||
{
|
{
|
||||||
return GetImportDecisions(videoFiles, series, null, false);
|
return GetImportDecisions(videoFiles, series, null, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series, ParsedEpisodeInfo folderInfo, bool sceneSource)
|
public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series, DownloadClientItem downloadClientItem, ParsedEpisodeInfo folderInfo, bool sceneSource)
|
||||||
{
|
{
|
||||||
var newFiles = _mediaFileService.FilterExistingFiles(videoFiles.ToList(), series);
|
var newFiles = _mediaFileService.FilterExistingFiles(videoFiles.ToList(), series);
|
||||||
|
|
||||||
@ -64,13 +65,13 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
|||||||
|
|
||||||
foreach (var file in newFiles)
|
foreach (var file in newFiles)
|
||||||
{
|
{
|
||||||
decisions.AddIfNotNull(GetDecision(file, series, folderInfo, sceneSource, shouldUseFolderName));
|
decisions.AddIfNotNull(GetDecision(file, series, downloadClientItem, folderInfo, sceneSource, shouldUseFolderName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return decisions;
|
return decisions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImportDecision GetDecision(string file, Series series, ParsedEpisodeInfo folderInfo, bool sceneSource, bool shouldUseFolderName)
|
private ImportDecision GetDecision(string file, Series series, DownloadClientItem downloadClientItem, ParsedEpisodeInfo folderInfo, bool sceneSource, bool shouldUseFolderName)
|
||||||
{
|
{
|
||||||
ImportDecision decision = null;
|
ImportDecision decision = null;
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
decision = GetDecision(localEpisode);
|
decision = GetDecision(localEpisode, downloadClientItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,19 +121,19 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
|||||||
return decision;
|
return decision;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImportDecision GetDecision(LocalEpisode localEpisode)
|
private ImportDecision GetDecision(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
|
||||||
{
|
{
|
||||||
var reasons = _specifications.Select(c => EvaluateSpec(c, localEpisode))
|
var reasons = _specifications.Select(c => EvaluateSpec(c, localEpisode, downloadClientItem))
|
||||||
.Where(c => c != null);
|
.Where(c => c != null);
|
||||||
|
|
||||||
return new ImportDecision(localEpisode, reasons.ToArray());
|
return new ImportDecision(localEpisode, reasons.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Rejection EvaluateSpec(IImportDecisionEngineSpecification spec, LocalEpisode localEpisode)
|
private Rejection EvaluateSpec(IImportDecisionEngineSpecification spec, LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = spec.IsSatisfiedBy(localEpisode);
|
var result = spec.IsSatisfiedBy(localEpisode, downloadClientItem);
|
||||||
|
|
||||||
if (!result.Accepted)
|
if (!result.Accepted)
|
||||||
{
|
{
|
||||||
|
@ -94,13 +94,19 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
|
|||||||
|
|
||||||
private List<ManualImportItem> ProcessFolder(string folder, string downloadId)
|
private List<ManualImportItem> ProcessFolder(string folder, string downloadId)
|
||||||
{
|
{
|
||||||
|
DownloadClientItem downloadClientItem = null;
|
||||||
var directoryInfo = new DirectoryInfo(folder);
|
var directoryInfo = new DirectoryInfo(folder);
|
||||||
var series = _parsingService.GetSeries(directoryInfo.Name);
|
var series = _parsingService.GetSeries(directoryInfo.Name);
|
||||||
|
|
||||||
if (series == null && downloadId.IsNotNullOrWhiteSpace())
|
if (downloadId.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
var trackedDownload = _trackedDownloadService.Find(downloadId);
|
var trackedDownload = _trackedDownloadService.Find(downloadId);
|
||||||
series = trackedDownload.RemoteEpisode.Series;
|
downloadClientItem = trackedDownload.DownloadItem;
|
||||||
|
|
||||||
|
if (series == null)
|
||||||
|
{
|
||||||
|
series = trackedDownload.RemoteEpisode.Series;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (series == null)
|
if (series == null)
|
||||||
@ -112,7 +118,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
|
|||||||
|
|
||||||
var folderInfo = Parser.Parser.ParseTitle(directoryInfo.Name);
|
var folderInfo = Parser.Parser.ParseTitle(directoryInfo.Name);
|
||||||
var seriesFiles = _diskScanService.GetVideoFiles(folder).ToList();
|
var seriesFiles = _diskScanService.GetVideoFiles(folder).ToList();
|
||||||
var decisions = _importDecisionMaker.GetImportDecisions(seriesFiles, series, folderInfo, SceneSource(series, folder));
|
var decisions = _importDecisionMaker.GetImportDecisions(seriesFiles, series, downloadClientItem, folderInfo, SceneSource(series, folder));
|
||||||
|
|
||||||
return decisions.Select(decision => MapItem(decision, folder, downloadId)).ToList();
|
return decisions.Select(decision => MapItem(decision, folder, downloadId)).ToList();
|
||||||
}
|
}
|
||||||
@ -124,8 +130,8 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
|
|||||||
folder = new FileInfo(file).Directory.FullName;
|
folder = new FileInfo(file).Directory.FullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DownloadClientItem downloadClientItem = null;
|
||||||
var relativeFile = folder.GetRelativePath(file);
|
var relativeFile = folder.GetRelativePath(file);
|
||||||
|
|
||||||
var series = _parsingService.GetSeries(relativeFile.Split('\\', '/')[0]);
|
var series = _parsingService.GetSeries(relativeFile.Split('\\', '/')[0]);
|
||||||
|
|
||||||
if (series == null)
|
if (series == null)
|
||||||
@ -133,10 +139,15 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
|
|||||||
series = _parsingService.GetSeries(relativeFile);
|
series = _parsingService.GetSeries(relativeFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (series == null && downloadId.IsNotNullOrWhiteSpace())
|
if (downloadId.IsNotNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
var trackedDownload = _trackedDownloadService.Find(downloadId);
|
var trackedDownload = _trackedDownloadService.Find(downloadId);
|
||||||
series = trackedDownload.RemoteEpisode.Series;
|
downloadClientItem = trackedDownload.DownloadItem;
|
||||||
|
|
||||||
|
if (series == null)
|
||||||
|
{
|
||||||
|
series = trackedDownload.RemoteEpisode.Series;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (series == null)
|
if (series == null)
|
||||||
@ -150,7 +161,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
|
|||||||
}
|
}
|
||||||
|
|
||||||
var importDecisions = _importDecisionMaker.GetImportDecisions(new List<string> {file},
|
var importDecisions = _importDecisionMaker.GetImportDecisions(new List<string> {file},
|
||||||
series, null, SceneSource(series, folder));
|
series, downloadClientItem, null, SceneSource(series, folder));
|
||||||
|
|
||||||
return importDecisions.Any() ? MapItem(importDecisions.First(), folder, downloadId) : null;
|
return importDecisions.Any() ? MapItem(importDecisions.First(), folder, downloadId) : null;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ using NLog;
|
|||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
||||||
@ -21,7 +22,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Decision IsSatisfiedBy(LocalEpisode localEpisode)
|
public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
|
||||||
{
|
{
|
||||||
if (_configService.SkipFreeSpaceCheckWhenImporting)
|
if (_configService.SkipFreeSpaceCheckWhenImporting)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
||||||
@ -13,7 +14,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Decision IsSatisfiedBy(LocalEpisode localEpisode)
|
public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
|
||||||
{
|
{
|
||||||
if (localEpisode.ParsedEpisodeInfo.FullSeason)
|
if (localEpisode.ParsedEpisodeInfo.FullSeason)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,51 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using NLog;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
|
using NzbDrone.Core.DecisionEngine;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
|
using NzbDrone.Core.History;
|
||||||
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
||||||
|
{
|
||||||
|
public class GrabbedReleaseQualitySpecification : IImportDecisionEngineSpecification
|
||||||
|
{
|
||||||
|
private readonly IHistoryService _historyService;
|
||||||
|
private readonly Logger _logger;
|
||||||
|
|
||||||
|
public GrabbedReleaseQualitySpecification(IHistoryService historyService, Logger logger)
|
||||||
|
{
|
||||||
|
_historyService = historyService;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
|
||||||
|
{
|
||||||
|
if (downloadClientItem == null)
|
||||||
|
{
|
||||||
|
_logger.Debug("No download client item provided, skipping.");
|
||||||
|
return Decision.Accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
var grabbedHistory = _historyService.FindByDownloadId(downloadClientItem.DownloadId)
|
||||||
|
.Where(h => h.EventType == HistoryEventType.Grabbed)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (grabbedHistory.Empty())
|
||||||
|
{
|
||||||
|
_logger.Debug("No grabbed history for this download client item");
|
||||||
|
return Decision.Accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in grabbedHistory)
|
||||||
|
{
|
||||||
|
if (item.Quality != localEpisode.Quality)
|
||||||
|
{
|
||||||
|
_logger.Debug("Quality for grabbed release ({0}) does not match the quality of the file ({1})", item.Quality, localEpisode.Quality);
|
||||||
|
return Decision.Reject("File quality does not match quality of the grabbed release");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Decision.Accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
||||||
@ -14,7 +15,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
public Decision IsSatisfiedBy(LocalEpisode localEpisode)
|
public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
|
||||||
{
|
{
|
||||||
if (localEpisode.ExistingFile)
|
if (localEpisode.ExistingFile)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
||||||
@ -16,7 +17,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Decision IsSatisfiedBy(LocalEpisode localEpisode)
|
public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
|
||||||
{
|
{
|
||||||
if (localEpisode.ExistingFile)
|
if (localEpisode.ExistingFile)
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using NzbDrone.Common.Disk;
|
|||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
||||||
@ -22,7 +23,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Decision IsSatisfiedBy(LocalEpisode localEpisode)
|
public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
|
||||||
{
|
{
|
||||||
if (localEpisode.ExistingFile)
|
if (localEpisode.ExistingFile)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
||||||
@ -17,7 +18,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|||||||
|
|
||||||
public RejectionType Type => RejectionType.Permanent;
|
public RejectionType Type => RejectionType.Permanent;
|
||||||
|
|
||||||
public Decision IsSatisfiedBy(LocalEpisode localEpisode)
|
public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
|
||||||
{
|
{
|
||||||
if (_sameEpisodesSpecification.IsSatisfiedBy(localEpisode.Episodes))
|
if (_sameEpisodesSpecification.IsSatisfiedBy(localEpisode.Episodes))
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
||||||
{
|
{
|
||||||
@ -13,7 +14,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Decision IsSatisfiedBy(LocalEpisode localEpisode)
|
public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
|
||||||
{
|
{
|
||||||
if (localEpisode.ExistingFile)
|
if (localEpisode.ExistingFile)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Decision IsSatisfiedBy(LocalEpisode localEpisode)
|
public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
|
||||||
{
|
{
|
||||||
var qualityComparer = new QualityModelComparer(localEpisode.Series.Profile);
|
var qualityComparer = new QualityModelComparer(localEpisode.Series.Profile);
|
||||||
if (localEpisode.Episodes.Any(e => e.EpisodeFileId != 0 && qualityComparer.Compare(e.EpisodeFile.Value.Quality, localEpisode.Quality) > 0))
|
if (localEpisode.Episodes.Any(e => e.EpisodeFileId != 0 && qualityComparer.Compare(e.EpisodeFile.Value.Quality, localEpisode.Quality) > 0))
|
||||||
|
@ -754,6 +754,7 @@
|
|||||||
<Compile Include="MediaFiles\EpisodeImport\DetectSample.cs" />
|
<Compile Include="MediaFiles\EpisodeImport\DetectSample.cs" />
|
||||||
<Compile Include="MediaFiles\EpisodeImport\Manual\ManuallyImportedFile.cs" />
|
<Compile Include="MediaFiles\EpisodeImport\Manual\ManuallyImportedFile.cs" />
|
||||||
<Compile Include="MediaFiles\EpisodeImport\Specifications\FreeSpaceSpecification.cs" />
|
<Compile Include="MediaFiles\EpisodeImport\Specifications\FreeSpaceSpecification.cs" />
|
||||||
|
<Compile Include="MediaFiles\EpisodeImport\Specifications\GrabbedReleaseQualitySpecification.cs" />
|
||||||
<Compile Include="MediaFiles\EpisodeImport\Specifications\MatchesFolderSpecification.cs" />
|
<Compile Include="MediaFiles\EpisodeImport\Specifications\MatchesFolderSpecification.cs" />
|
||||||
<Compile Include="MediaFiles\EpisodeImport\Specifications\FullSeasonSpecification.cs" />
|
<Compile Include="MediaFiles\EpisodeImport\Specifications\FullSeasonSpecification.cs" />
|
||||||
<Compile Include="MediaFiles\EpisodeImport\Specifications\NotSampleSpecification.cs" />
|
<Compile Include="MediaFiles\EpisodeImport\Specifications\NotSampleSpecification.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user