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:
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.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.MediaFiles.Commands;
|
using NzbDrone.Core.MediaFiles.Commands;
|
||||||
using NzbDrone.Core.MediaFiles.EpisodeImport;
|
using NzbDrone.Core.MediaFiles.EpisodeImport;
|
||||||
|
using NzbDrone.Core.MediaFiles.EpisodeImport.Specifications;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
@ -64,7 +65,8 @@ public void ProcessDownloadedEpisodesFolder()
|
|||||||
{
|
{
|
||||||
ProcessSubFolder(new DirectoryInfo(subfolder));
|
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);
|
_diskProvider.DeleteFolder(subfolder, true);
|
||||||
}
|
}
|
||||||
|
@ -12,17 +12,24 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|||||||
{
|
{
|
||||||
public class NotSampleSpecification : IImportDecisionEngineSpecification
|
public class NotSampleSpecification : IImportDecisionEngineSpecification
|
||||||
{
|
{
|
||||||
private readonly IDiskProvider _diskProvider;
|
|
||||||
private readonly IVideoFileInfoReader _videoFileInfoReader;
|
private readonly IVideoFileInfoReader _videoFileInfoReader;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public NotSampleSpecification(IDiskProvider diskProvider, IVideoFileInfoReader videoFileInfoReader, Logger logger)
|
public NotSampleSpecification(IVideoFileInfoReader videoFileInfoReader,
|
||||||
|
Logger logger)
|
||||||
{
|
{
|
||||||
_diskProvider = diskProvider;
|
|
||||||
_videoFileInfoReader = videoFileInfoReader;
|
_videoFileInfoReader = videoFileInfoReader;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static long SampleSizeLimit
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return 70.Megabytes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string RejectionReason { get { return "Sample"; } }
|
public string RejectionReason { get { return "Sample"; } }
|
||||||
|
|
||||||
public bool IsSatisfiedBy(LocalEpisode localEpisode)
|
public bool IsSatisfiedBy(LocalEpisode localEpisode)
|
||||||
@ -41,7 +48,7 @@ public bool IsSatisfiedBy(LocalEpisode localEpisode)
|
|||||||
|
|
||||||
var runTime = _videoFileInfoReader.GetRunTime(localEpisode.Path);
|
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);
|
_logger.Trace("[{0}] appears to be a sample.", localEpisode.Path);
|
||||||
return false;
|
return false;
|
||||||
|
@ -184,7 +184,6 @@
|
|||||||
<Compile Include="Configuration\ConfigFileProvider.cs" />
|
<Compile Include="Configuration\ConfigFileProvider.cs" />
|
||||||
<Compile Include="Configuration\ConfigRepository.cs" />
|
<Compile Include="Configuration\ConfigRepository.cs" />
|
||||||
<Compile Include="Configuration\IConfigService.cs" />
|
<Compile Include="Configuration\IConfigService.cs" />
|
||||||
<Compile Include="Constants.cs" />
|
|
||||||
<Compile Include="DataAugmentation\DailySeries\DailySeriesDataProxy.cs" />
|
<Compile Include="DataAugmentation\DailySeries\DailySeriesDataProxy.cs" />
|
||||||
<Compile Include="DataAugmentation\DailySeries\DailySeriesService.cs" />
|
<Compile Include="DataAugmentation\DailySeries\DailySeriesService.cs" />
|
||||||
<Compile Include="DataAugmentation\Scene\SceneMapping.cs" />
|
<Compile Include="DataAugmentation\Scene\SceneMapping.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user