From 68321c98d079deb96c23f117587acd45c8db1910 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 17 Jul 2011 16:15:37 -0700 Subject: [PATCH] increased delete folder limit size to 10MB --- NzbDrone.Core/Fluent.cs | 7 ++++++- NzbDrone.Core/Providers/DiskScanProvider.cs | 2 +- NzbDrone.Core/Providers/Jobs/PostDownloadScanJob.cs | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/NzbDrone.Core/Fluent.cs b/NzbDrone.Core/Fluent.cs index 4f8c3fc2b..f72eef471 100644 --- a/NzbDrone.Core/Fluent.cs +++ b/NzbDrone.Core/Fluent.cs @@ -20,9 +20,14 @@ namespace NzbDrone.Core } - public static double Megabytes(this int megabytes) + public static Int64 Megabytes(this int megabytes) { return megabytes * 1048576; } + + public static Int64 Gigabytes(this int gigabytes) + { + return gigabytes * 1073741824; + } } } diff --git a/NzbDrone.Core/Providers/DiskScanProvider.cs b/NzbDrone.Core/Providers/DiskScanProvider.cs index 9451dc5d2..7c04d7eb4 100644 --- a/NzbDrone.Core/Providers/DiskScanProvider.cs +++ b/NzbDrone.Core/Providers/DiskScanProvider.cs @@ -92,7 +92,7 @@ namespace NzbDrone.Core.Providers long size = _diskProvider.GetSize(filePath); //If Size is less than 40MB and contains sample. Check for Size to ensure its not an episode with sample in the title - if (size < 40000000 && filePath.ToLower().Contains("sample")) + if (size < 40.Megabytes() && filePath.ToLower().Contains("sample")) { Logger.Trace("[{0}] appears to be a sample. skipping.", filePath); return null; diff --git a/NzbDrone.Core/Providers/Jobs/PostDownloadScanJob.cs b/NzbDrone.Core/Providers/Jobs/PostDownloadScanJob.cs index 7483a783e..dbf84db30 100644 --- a/NzbDrone.Core/Providers/Jobs/PostDownloadScanJob.cs +++ b/NzbDrone.Core/Providers/Jobs/PostDownloadScanJob.cs @@ -86,9 +86,11 @@ namespace NzbDrone.Core.Providers.Jobs var importedFiles = _diskScanProvider.Scan(series, subfolder); importedFiles.ForEach(file => _diskScanProvider.MoveEpisodeFile(file)); - //Delete the folder only if all files were removed - if (_diskProvider.GetDirectorySize(subfolder) < 1.Megabytes()) + //Delete the folder only if folder is small enough + if (_diskProvider.GetDirectorySize(subfolder) < 10.Megabytes()) + { _diskProvider.DeleteFolder(subfolder, true); + } } catch (Exception e) {