mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-27 01:57:21 +00:00
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
3 changed files with 18 additions and 18 deletions
|
@ -27,13 +27,13 @@ public class ImportFileFixture : CoreTest
|
||||||
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 @@ public void import_new_file_should_succeed()
|
||||||
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 @@ public void import_new_file_with_better_same_quality_should_succeed(QualityTypes
|
||||||
).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 @@ public void import_new_file_episode_has_same_or_better_quality_should_skip(strin
|
||||||
.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 @@ public void import_unparsable_file_should_skip()
|
||||||
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 @@ public void import_existing_file_should_skip()
|
||||||
.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 @@ public void import_file_with_no_episode_in_db_should_skip()
|
||||||
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 @@ public void import_new_file_episode_has_better_quality_than_existing(string file
|
||||||
.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 @@ public void import_new_multi_part_file_episode_has_equal_or_better_quality_than_
|
||||||
.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 @@ public void skip_import_new_multi_part_file_episode_existing_has_better_quality(
|
||||||
|
|
||||||
//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 @@ public void import_new_multi_part_file_episode_replace_two_files()
|
||||||
.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 @@ public void import_new_episode_no_existing_episode_file()
|
||||||
.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 @@ public void should_set_parseResult_SceneSource_if_not_in_series_Path()
|
||||||
|
|
||||||
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 @@ public void should_not_set_parseResult_SceneSource_if_in_series_Path()
|
||||||
|
|
||||||
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 @@ public static long IgnoreFileSize
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return 40.Megabytes();
|
return 70.Megabytes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ public virtual EpisodeFile ImportFile(Series series, string filePath)
|
||||||
|
|
||||||
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 a new issue