mirror of https://github.com/Sonarr/Sonarr
Moved SampleSizeLimit to Spec
This commit is contained in:
parent
de6304e628
commit
0fbb45c175
|
@ -1,13 +0,0 @@
|
|||
namespace NzbDrone.Core
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
public static long IgnoreFileSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return 70.Megabytes();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ using NzbDrone.Common.Messaging;
|
|||
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 @@ namespace NzbDrone.Core.MediaFiles
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|||
|
||||
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;
|
||||
|
|
|
@ -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" />
|
||||
|
|
Loading…
Reference in New Issue