|
|
@ -1,4 +1,5 @@
|
|
|
|
using System.IO;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using NLog;
|
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Common;
|
|
|
|
using NzbDrone.Common;
|
|
|
@ -22,16 +23,24 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsSatisfiedBy(LocalEpisode localEpisode)
|
|
|
|
public bool IsSatisfiedBy(LocalEpisode localEpisode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var path = Directory.GetParent(localEpisode.Series.Path);
|
|
|
|
try
|
|
|
|
var freeSpace = _diskProvider.GetAvilableSpace(path.FullName);
|
|
|
|
{
|
|
|
|
|
|
|
|
var path = Directory.GetParent(localEpisode.Series.Path);
|
|
|
|
|
|
|
|
var freeSpace = _diskProvider.GetAvilableSpace(path.FullName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (freeSpace < localEpisode.Size + 100.Megabytes())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Warn("Not enough free space to import: {0}", localEpisode);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (freeSpace < localEpisode.Size + 100.Megabytes())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.Warn("Not enough free space to import: {0}", localEpisode);
|
|
|
|
_logger.ErrorException("Unable to check free disk space while importing: " + localEpisode.Path, ex);
|
|
|
|
return false;
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|