mirror of https://github.com/lidarr/Lidarr
New: Import will skip any video file under 40MB
This commit is contained in:
parent
ba0217274b
commit
cbdbc9a01b
|
@ -393,6 +393,26 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
Mocker.GetMock<DiskProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_null_if_file_size_is_under_40MB()
|
||||
{
|
||||
var series = Builder<Series>
|
||||
.CreateNew()
|
||||
.Build();
|
||||
|
||||
const string path = @"C:\Test\TV\30.rock.s01e01.pilot.avi";
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(m => m.Exists(path))
|
||||
.Returns(false);
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(d => d.GetFileSize(path))
|
||||
.Returns(20.Megabytes());
|
||||
|
||||
Mocker.Resolve<DiskScanProvider>().ImportFile(series, path).Should().BeNull();
|
||||
}
|
||||
|
||||
private static void VerifyFileImport(EpisodeFile result, AutoMoqer Mocker, Episode fakeEpisode, int size)
|
||||
{
|
||||
Mocker.VerifyAllMocks();
|
||||
|
|
|
@ -110,8 +110,8 @@ namespace NzbDrone.Core.Providers
|
|||
|
||||
long size = _diskProvider.GetSize(filePath);
|
||||
|
||||
//If Size is less than 40MB and contains sample. Check for Size to ensure its not an episode with sample in the title
|
||||
if (size < Constants.IgnoreFileSize && filePath.ToLower().Contains("sample"))
|
||||
//Skip any file under 40MB - New samples don't even have sample in the name...
|
||||
if (size < Constants.IgnoreFileSize)
|
||||
{
|
||||
Logger.Trace("[{0}] appears to be a sample. skipping.", filePath);
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue