Sample file cutoff now 70MB
#ND-121 fixed Fixed: Any file under 70MB will be treated as a sample file
This commit is contained in:
parent
c4282dc41f
commit
2235b83809
|
@ -27,13 +27,13 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
new object[] { QualityTypes.HDTV, false }
|
new object[] { QualityTypes.HDTV, false }
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly long SIZE = 50.Megabytes();
|
private readonly long SIZE = 80.Megabytes();
|
||||||
|
|
||||||
public void With50MBFile()
|
public void With80MBFile()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<DiskProvider>()
|
Mocker.GetMock<DiskProvider>()
|
||||||
.Setup(d => d.GetSize(It.IsAny<String>()))
|
.Setup(d => d.GetSize(It.IsAny<String>()))
|
||||||
.Returns(50.Megabytes());
|
.Returns(80.Megabytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
var fakeEpisode = Builder<Episode>.CreateNew().Build();
|
var fakeEpisode = Builder<Episode>.CreateNew().Build();
|
||||||
|
|
||||||
//Mocks
|
//Mocks
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<MediaFileProvider>()
|
Mocker.GetMock<MediaFileProvider>()
|
||||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||||
|
@ -76,7 +76,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
).Build();
|
).Build();
|
||||||
|
|
||||||
|
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<EpisodeProvider>()
|
Mocker.GetMock<EpisodeProvider>()
|
||||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
||||||
|
@ -102,7 +102,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
//Mocks
|
//Mocks
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<MediaFileProvider>()
|
Mocker.GetMock<MediaFileProvider>()
|
||||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||||
|
@ -128,7 +128,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
Mocker.GetMock<MediaFileProvider>()
|
Mocker.GetMock<MediaFileProvider>()
|
||||||
.Setup(p => p.Exists(It.IsAny<String>())).Returns(false);
|
.Setup(p => p.Exists(It.IsAny<String>())).Returns(false);
|
||||||
|
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||||
|
@ -150,7 +150,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||||
.Returns(true);
|
.Returns(true);
|
||||||
|
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||||
|
@ -172,7 +172,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
Mocker.GetMock<DiskProvider>(MockBehavior.Strict)
|
Mocker.GetMock<DiskProvider>(MockBehavior.Strict)
|
||||||
.Setup(e => e.IsChildOfPath(fileName, fakeSeries.Path)).Returns(false);
|
.Setup(e => e.IsChildOfPath(fileName, fakeSeries.Path)).Returns(false);
|
||||||
|
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<MediaFileProvider>()
|
Mocker.GetMock<MediaFileProvider>()
|
||||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||||
|
@ -203,7 +203,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
//Mocks
|
//Mocks
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<MediaFileProvider>()
|
Mocker.GetMock<MediaFileProvider>()
|
||||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||||
|
@ -235,7 +235,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
.Build())
|
.Build())
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<MediaFileProvider>()
|
Mocker.GetMock<MediaFileProvider>()
|
||||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||||
|
@ -268,7 +268,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
|
|
||||||
//Mocks
|
//Mocks
|
||||||
|
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<MediaFileProvider>()
|
Mocker.GetMock<MediaFileProvider>()
|
||||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||||
|
@ -306,7 +306,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
//Mocks
|
//Mocks
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<MediaFileProvider>()
|
Mocker.GetMock<MediaFileProvider>()
|
||||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||||
|
@ -337,7 +337,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
//Mocks
|
//Mocks
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<MediaFileProvider>()
|
Mocker.GetMock<MediaFileProvider>()
|
||||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||||
|
@ -406,7 +406,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
|
|
||||||
const string path = @"C:\Test\Unsorted TV\30 Rock\30.rock.s01e01.pilot.mkv";
|
const string path = @"C:\Test\Unsorted TV\30 Rock\30.rock.s01e01.pilot.mkv";
|
||||||
|
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
|
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
|
||||||
.Returns(new List<Episode>());
|
.Returns(new List<Episode>());
|
||||||
|
@ -429,7 +429,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||||
|
|
||||||
const string path = @"C:\Test\TV\30 Rock\30.rock.s01e01.pilot.mkv";
|
const string path = @"C:\Test\TV\30 Rock\30.rock.s01e01.pilot.mkv";
|
||||||
|
|
||||||
With50MBFile();
|
With80MBFile();
|
||||||
|
|
||||||
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
|
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
|
||||||
.Returns(new List<Episode>());
|
.Returns(new List<Episode>());
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace NzbDrone.Core
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return 40.Megabytes();
|
return 70.Megabytes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ namespace NzbDrone.Core.Providers
|
||||||
|
|
||||||
long size = _diskProvider.GetSize(filePath);
|
long size = _diskProvider.GetSize(filePath);
|
||||||
|
|
||||||
//Skip any file under 40MB - New samples don't even have sample in the name...
|
//Skip any file under 70MB - New samples don't even have sample in the name...
|
||||||
if (size < Constants.IgnoreFileSize)
|
if (size < Constants.IgnoreFileSize)
|
||||||
{
|
{
|
||||||
Logger.Trace("[{0}] appears to be a sample. skipping.", filePath);
|
Logger.Trace("[{0}] appears to be a sample. skipping.", filePath);
|
||||||
|
|
Loading…
Reference in New Issue