mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-26 09:37:12 +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 }
|
||||
};
|
||||
|
||||
private readonly long SIZE = 50.Megabytes();
|
||||
private readonly long SIZE = 80.Megabytes();
|
||||
|
||||
public void With50MBFile()
|
||||
public void With80MBFile()
|
||||
{
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Setup(d => d.GetSize(It.IsAny<String>()))
|
||||
.Returns(50.Megabytes());
|
||||
.Returns(80.Megabytes());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -45,7 +45,7 @@ public void import_new_file_should_succeed()
|
|||
var fakeEpisode = Builder<Episode>.CreateNew().Build();
|
||||
|
||||
//Mocks
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||
|
@ -76,7 +76,7 @@ public void import_new_file_with_better_same_quality_should_succeed(QualityTypes
|
|||
).Build();
|
||||
|
||||
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
Mocker.GetMock<EpisodeProvider>()
|
||||
.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();
|
||||
|
||||
//Mocks
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||
|
@ -128,7 +128,7 @@ public void import_unparsable_file_should_skip()
|
|||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(p => p.Exists(It.IsAny<String>())).Returns(false);
|
||||
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
//Act
|
||||
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>()))
|
||||
.Returns(true);
|
||||
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
//Act
|
||||
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)
|
||||
.Setup(e => e.IsChildOfPath(fileName, fakeSeries.Path)).Returns(false);
|
||||
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.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();
|
||||
|
||||
//Mocks
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.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();
|
||||
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.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
|
||||
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||
|
@ -306,7 +306,7 @@ public void import_new_multi_part_file_episode_replace_two_files()
|
|||
.Build();
|
||||
|
||||
//Mocks
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(p => p.Exists(It.IsAny<String>()))
|
||||
|
@ -337,7 +337,7 @@ public void import_new_episode_no_existing_episode_file()
|
|||
.Build();
|
||||
|
||||
//Mocks
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
Mocker.GetMock<MediaFileProvider>()
|
||||
.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";
|
||||
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
|
||||
.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";
|
||||
|
||||
With50MBFile();
|
||||
With80MBFile();
|
||||
|
||||
Mocker.GetMock<EpisodeProvider>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
|
||||
.Returns(new List<Episode>());
|
||||
|
|
|
@ -8,7 +8,7 @@ public static long IgnoreFileSize
|
|||
{
|
||||
get
|
||||
{
|
||||
return 40.Megabytes();
|
||||
return 70.Megabytes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ public virtual EpisodeFile ImportFile(Series series, string 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)
|
||||
{
|
||||
Logger.Trace("[{0}] appears to be a sample. skipping.", filePath);
|
||||
|
|
Loading…
Reference in a new issue