1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Moved SampleSizeLimit to Spec

This commit is contained in:
Mark McDowall 2013-07-15 23:43:45 -07:00
parent de6304e628
commit 0fbb45c175
4 changed files with 14 additions and 19 deletions

View File

@ -1,13 +0,0 @@
namespace NzbDrone.Core
{
public static class Constants
{
public static long IgnoreFileSize
{
get
{
return 70.Megabytes();
}
}
}
}

View File

@ -7,6 +7,7 @@
using NzbDrone.Core.Configuration;
using NzbDrone.Core.MediaFiles.Commands;
using NzbDrone.Core.MediaFiles.EpisodeImport;
using NzbDrone.Core.MediaFiles.EpisodeImport.Specifications;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Tv;
@ -64,7 +65,8 @@ public void ProcessDownloadedEpisodesFolder()
{
ProcessSubFolder(new DirectoryInfo(subfolder));
if (_diskProvider.GetFolderSize(subfolder) < 50.Megabytes())
//Todo: We should make sure the file(s) are actually imported
if (_diskProvider.GetFolderSize(subfolder) < NotSampleSpecification.SampleSizeLimit)
{
_diskProvider.DeleteFolder(subfolder, true);
}

View File

@ -12,17 +12,24 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
{
public class NotSampleSpecification : IImportDecisionEngineSpecification
{
private readonly IDiskProvider _diskProvider;
private readonly IVideoFileInfoReader _videoFileInfoReader;
private readonly Logger _logger;
public NotSampleSpecification(IDiskProvider diskProvider, IVideoFileInfoReader videoFileInfoReader, Logger logger)
public NotSampleSpecification(IVideoFileInfoReader videoFileInfoReader,
Logger logger)
{
_diskProvider = diskProvider;
_videoFileInfoReader = videoFileInfoReader;
_logger = logger;
}
public static long SampleSizeLimit
{
get
{
return 70.Megabytes();
}
}
public string RejectionReason { get { return "Sample"; } }
public bool IsSatisfiedBy(LocalEpisode localEpisode)
@ -41,7 +48,7 @@ public bool IsSatisfiedBy(LocalEpisode localEpisode)
var runTime = _videoFileInfoReader.GetRunTime(localEpisode.Path);
if (localEpisode.Size < Constants.IgnoreFileSize && runTime.TotalMinutes < 3)
if (localEpisode.Size < SampleSizeLimit && runTime.TotalMinutes < 3)
{
_logger.Trace("[{0}] appears to be a sample.", localEpisode.Path);
return false;

View File

@ -184,7 +184,6 @@
<Compile Include="Configuration\ConfigFileProvider.cs" />
<Compile Include="Configuration\ConfigRepository.cs" />
<Compile Include="Configuration\IConfigService.cs" />
<Compile Include="Constants.cs" />
<Compile Include="DataAugmentation\DailySeries\DailySeriesDataProxy.cs" />
<Compile Include="DataAugmentation\DailySeries\DailySeriesService.cs" />
<Compile Include="DataAugmentation\Scene\SceneMapping.cs" />