mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-24 16:51:58 +00:00
increased delete folder limit size to 10MB
This commit is contained in:
parent
931bb2ea12
commit
68321c98d0
3 changed files with 11 additions and 4 deletions
|
@ -20,9 +20,14 @@ public static string WithDefault(this string actual, object defaultValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static double Megabytes(this int megabytes)
|
public static Int64 Megabytes(this int megabytes)
|
||||||
{
|
{
|
||||||
return megabytes * 1048576;
|
return megabytes * 1048576;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Int64 Gigabytes(this int gigabytes)
|
||||||
|
{
|
||||||
|
return gigabytes * 1073741824;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ public virtual EpisodeFile ImportFile(Series series, string filePath)
|
||||||
long size = _diskProvider.GetSize(filePath);
|
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 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);
|
Logger.Trace("[{0}] appears to be a sample. skipping.", filePath);
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -86,9 +86,11 @@ public virtual void Start(ProgressNotification notification, int targetId)
|
||||||
var importedFiles = _diskScanProvider.Scan(series, subfolder);
|
var importedFiles = _diskScanProvider.Scan(series, subfolder);
|
||||||
importedFiles.ForEach(file => _diskScanProvider.MoveEpisodeFile(file));
|
importedFiles.ForEach(file => _diskScanProvider.MoveEpisodeFile(file));
|
||||||
|
|
||||||
//Delete the folder only if all files were removed
|
//Delete the folder only if folder is small enough
|
||||||
if (_diskProvider.GetDirectorySize(subfolder) < 1.Megabytes())
|
if (_diskProvider.GetDirectorySize(subfolder) < 10.Megabytes())
|
||||||
|
{
|
||||||
_diskProvider.DeleteFolder(subfolder, true);
|
_diskProvider.DeleteFolder(subfolder, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue