Added more logging when free disk space check fails on import

This commit is contained in:
Mark McDowall 2013-08-19 08:19:39 -07:00
parent 551e6e2e5b
commit bd4bd47e4e
1 changed files with 18 additions and 9 deletions

View File

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