This should fix the bug where a folder was tried to be retagged with the same error.

This commit is contained in:
kay.one 2011-10-24 21:34:48 -07:00
commit 3dd7b3d768
4 changed files with 88 additions and 10 deletions

View file

@ -76,7 +76,7 @@ namespace NzbDrone.Core.Providers
{
if (importedFiles.Count == 0)
{
Logger.Warn("Unable to Import new download [{0}], no importable files were found..",
Logger.Warn("Unable to Import new download [{0}], no importable files were found.",
subfolderInfo.Name);
TagFolder(subfolderInfo, PostDownloadStatusType.ParseError);
}
@ -89,12 +89,17 @@ namespace NzbDrone.Core.Providers
}
}
public void TagFolder(DirectoryInfo directory, PostDownloadStatusType status)
private void TagFolder(DirectoryInfo directory, PostDownloadStatusType status)
{
_diskProvider.MoveDirectory(directory.FullName, GetFolderNameWithStatus(directory, status));
var target = GetTaggedFolderName(directory, status);
if (!String.Equals(Parser.NormalizePath(target), Parser.NormalizePath(directory.FullName), StringComparison.InvariantCultureIgnoreCase))
{
_diskProvider.MoveDirectory(directory.FullName, target);
}
}
public static string GetFolderNameWithStatus(DirectoryInfo directoryInfo, PostDownloadStatusType status)
public static string GetTaggedFolderName(DirectoryInfo directoryInfo, PostDownloadStatusType status)
{
if (status == PostDownloadStatusType.NoError)
throw new InvalidOperationException("Can't tag a folder with a None-error status. " + status);