|
|
@ -9,13 +9,11 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public class FreeSpaceSpecification : IImportDecisionEngineSpecification
|
|
|
|
public class FreeSpaceSpecification : IImportDecisionEngineSpecification
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly IBuildFileNames _buildFileNames;
|
|
|
|
|
|
|
|
private readonly IDiskProvider _diskProvider;
|
|
|
|
private readonly IDiskProvider _diskProvider;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
|
|
|
|
|
|
public FreeSpaceSpecification(IBuildFileNames buildFileNames, IDiskProvider diskProvider, Logger logger)
|
|
|
|
public FreeSpaceSpecification(IDiskProvider diskProvider, Logger logger)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_buildFileNames = buildFileNames;
|
|
|
|
|
|
|
|
_diskProvider = diskProvider;
|
|
|
|
_diskProvider = diskProvider;
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -24,13 +22,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsSatisfiedBy(LocalEpisode localEpisode)
|
|
|
|
public bool IsSatisfiedBy(LocalEpisode localEpisode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//TODO: fix issues with this, seems to be completely broken...
|
|
|
|
var freeSpace = _diskProvider.GetAvilableSpace(localEpisode.Series.Path);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var newFileName = Path.GetFileNameWithoutExtension(localEpisode.Path);
|
|
|
|
|
|
|
|
var destinationFilename = _buildFileNames.BuildFilePath(localEpisode.Series, localEpisode.SeasonNumber, newFileName, Path.GetExtension(localEpisode.Path));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var freeSpace = _diskProvider.GetAvilableSpace(destinationFilename);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (freeSpace < localEpisode.Size + 100.Megabytes())
|
|
|
|
if (freeSpace < localEpisode.Size + 100.Megabytes())
|
|
|
|
{
|
|
|
|
{
|
|
|
|