1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 18:42:42 +01:00

Merge branch 'kay.one' of github.com:NzbDrone/NzbDrone into markus

This commit is contained in:
Mark McDowall 2011-10-24 22:27:28 -07:00
commit a81bab053a
6 changed files with 27 additions and 11 deletions

View File

@ -116,7 +116,7 @@ public void IsAcceptableSize_false_single_episode_not_first_or_last_30_minute()
var mocker = new AutoMoqer(MockBehavior.Strict);
parseResultSingle.Series = series30minutes;
parseResultSingle.Size = 10000.Megabytes();
parseResultSingle.Size = 1.Gigabytes();
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
@ -137,7 +137,7 @@ public void IsAcceptableSize_false_single_episode_not_first_or_last_60_minute()
var mocker = new AutoMoqer(MockBehavior.Strict);
parseResultSingle.Series = series60minutes;
parseResultSingle.Size = 10000.Megabytes();
parseResultSingle.Size = 1.Gigabytes();
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
@ -200,7 +200,7 @@ public void IsAcceptableSize_false_multi_episode_not_first_or_last_30_minute()
var mocker = new AutoMoqer(MockBehavior.Strict);
parseResultMulti.Series = series30minutes;
parseResultMulti.Size = 10000.Megabytes();
parseResultMulti.Size = 1.Gigabytes();
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
@ -221,7 +221,7 @@ public void IsAcceptableSize_false_multi_episode_not_first_or_last_60_minute()
var mocker = new AutoMoqer(MockBehavior.Strict);
parseResultMulti.Series = series60minutes;
parseResultMulti.Size = 10000.Megabytes();
parseResultMulti.Size = 10.Gigabytes();
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
@ -284,7 +284,7 @@ public void IsAcceptableSize_false_single_episode_first_30_minute()
var mocker = new AutoMoqer(MockBehavior.Strict);
parseResultSingle.Series = series30minutes;
parseResultSingle.Size = 10000.Megabytes();
parseResultSingle.Size = 1.Gigabytes();
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);
@ -305,7 +305,7 @@ public void IsAcceptableSize_false_single_episode_first_60_minute()
var mocker = new AutoMoqer(MockBehavior.Strict);
parseResultSingle.Series = series60minutes;
parseResultSingle.Size = 10000.Megabytes();
parseResultSingle.Size = 10.Gigabytes();
mocker.GetMock<QualityTypeProvider>().Setup(s => s.Get(1)).Returns(qualityType);

View File

@ -104,7 +104,7 @@ public void when_no_files_are_imported_folder_should_be_tagged_with_parse_error(
mocker.GetMock<SeriesProvider>().Setup(s => s.FindSeries("office")).Returns(fakeSeries);
mocker.GetMock<DiskScanProvider>().Setup(s => s.Scan(fakeSeries, droppedFolder.FullName)).Returns(new List<EpisodeFile>());
mocker.GetMock<DiskProvider>().Setup(s => s.MoveDirectory(droppedFolder.FullName, taggedFolder));
mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectorySize(droppedFolder.FullName)).Returns(100.Megabytes());
mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectorySize(droppedFolder.FullName)).Returns(Constants.IgnoreFileSize + 10.Megabytes());
mocker.Resolve<PostDownloadProvider>().ProcessDownload(droppedFolder);
@ -136,7 +136,7 @@ public void when_no_file_are_imported_and_folder_size_isnt_small_enought_folder_
//Act
mocker.GetMock<SeriesProvider>().Setup(s => s.FindSeries("office")).Returns(fakeSeries);
mocker.GetMock<DiskProvider>().Setup(s => s.MoveDirectory(droppedFolder.FullName, taggedFolder));
mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectorySize(droppedFolder.FullName)).Returns(100.Megabytes());
mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectorySize(droppedFolder.FullName)).Returns(Constants.IgnoreFileSize + 10.Megabytes());
mocker.GetMock<DiskScanProvider>().Setup(s => s.Scan(fakeSeries, droppedFolder.FullName)).Returns(fakeEpisodeFiles);
mocker.GetMock<DiskScanProvider>().Setup(s => s.MoveEpisodeFile(It.IsAny<EpisodeFile>(), true)).Returns(true);
@ -210,7 +210,7 @@ public void when_files_are_imported_and_folder_is_small_enought_dir_should_be_de
mocker.GetMock<SeriesProvider>().Setup(s => s.FindSeries("office")).Returns(fakeSeries);
mocker.GetMock<DiskScanProvider>().Setup(s => s.Scan(fakeSeries, droppedFolder.FullName)).Returns(fakeEpisodeFiles);
mocker.GetMock<DiskScanProvider>().Setup(s => s.MoveEpisodeFile(It.IsAny<EpisodeFile>(), true)).Returns(true);
mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectorySize(droppedFolder.FullName)).Returns(1.Megabytes());
mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectorySize(droppedFolder.FullName)).Returns(Constants.IgnoreFileSize - 1.Megabytes());
mocker.GetMock<DiskProvider>().Setup(s => s.DeleteFolder(droppedFolder.FullName, true));
//Act

View File

@ -0,0 +1,15 @@
using System.Linq;
namespace NzbDrone.Core
{
public static class Constants
{
public static long IgnoreFileSize
{
get
{
return 40.Megabytes();
}
}
}
}

View File

@ -174,6 +174,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Constants.cs" />
<Compile Include="Datastore\Connection.cs" />
<Compile Include="Datastore\MigrationLogger.cs" />
<Compile Include="Datastore\MigrationsHelper.cs" />

View File

@ -104,7 +104,7 @@ public virtual EpisodeFile ImportFile(Series series, string filePath)
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 < 40.Megabytes() && filePath.ToLower().Contains("sample"))
if (size < Constants.IgnoreFileSize && filePath.ToLower().Contains("sample"))
{
Logger.Trace("[{0}] appears to be a sample. skipping.", filePath);
return null;

View File

@ -68,7 +68,7 @@ public virtual void ProcessDownload(DirectoryInfo subfolderInfo)
importedFiles.ForEach(file => _diskScanProvider.MoveEpisodeFile(file, true));
//Delete the folder only if folder is small enough
if (_diskProvider.GetDirectorySize(subfolderInfo.FullName) < 10.Megabytes())
if (_diskProvider.GetDirectorySize(subfolderInfo.FullName) < Constants.IgnoreFileSize)
{
_diskProvider.DeleteFolder(subfolderInfo.FullName, true);
}