mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 20:42:37 +01:00
Create missing series folders on disk scan (if enabled)
New: Option to create missing series folders during disk scans
This commit is contained in:
parent
fd70346ab0
commit
ea36c6ed47
@ -37,6 +37,7 @@ public interface IDiskProvider
|
|||||||
void FolderSetLastWriteTimeUtc(string path, DateTime dateTime);
|
void FolderSetLastWriteTimeUtc(string path, DateTime dateTime);
|
||||||
bool IsFileLocked(string path);
|
bool IsFileLocked(string path);
|
||||||
string GetPathRoot(string path);
|
string GetPathRoot(string path);
|
||||||
|
string GetParentFolder(string path);
|
||||||
void SetPermissions(string filename, WellKnownSidType accountSid, FileSystemRights rights, AccessControlType controlType);
|
void SetPermissions(string filename, WellKnownSidType accountSid, FileSystemRights rights, AccessControlType controlType);
|
||||||
bool IsParent(string parentPath, string childPath);
|
bool IsParent(string parentPath, string childPath);
|
||||||
void SetFolderWriteTime(string path, DateTime time);
|
void SetFolderWriteTime(string path, DateTime time);
|
||||||
@ -366,6 +367,20 @@ public string GetPathRoot(string path)
|
|||||||
return Path.GetPathRoot(path);
|
return Path.GetPathRoot(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetParentFolder(string path)
|
||||||
|
{
|
||||||
|
Ensure.That(() => path).IsValidPath();
|
||||||
|
|
||||||
|
var parent = Directory.GetParent(path);
|
||||||
|
|
||||||
|
if (parent == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent.FullName;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetPermissions(string filename, WellKnownSidType accountSid, FileSystemRights rights, AccessControlType controlType)
|
public void SetPermissions(string filename, WellKnownSidType accountSid, FileSystemRights rights, AccessControlType controlType)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -282,6 +282,14 @@ public Boolean EnableFailedDownloadHandling
|
|||||||
set { SetValue("EnableFailedDownloadHandling", value); }
|
set { SetValue("EnableFailedDownloadHandling", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean CreateEmptySeriesFolders
|
||||||
|
{
|
||||||
|
//TODO: only create if the parent folder exists (check first)
|
||||||
|
get { return GetValueBoolean("CreateEmptySeriesFolders", false); }
|
||||||
|
|
||||||
|
set { SetValue("CreateEmptySeriesFolders", value); }
|
||||||
|
}
|
||||||
|
|
||||||
public string DownloadClientWorkingFolders
|
public string DownloadClientWorkingFolders
|
||||||
{
|
{
|
||||||
get { return GetValue("DownloadClientWorkingFolders", "_UNPACK_|_FAILED_"); }
|
get { return GetValue("DownloadClientWorkingFolders", "_UNPACK_|_FAILED_"); }
|
||||||
|
@ -42,6 +42,7 @@ public interface IConfigService
|
|||||||
Boolean AutoRedownloadFailed { get; set; }
|
Boolean AutoRedownloadFailed { get; set; }
|
||||||
Boolean RemoveFailedDownloads { get; set; }
|
Boolean RemoveFailedDownloads { get; set; }
|
||||||
Boolean EnableFailedDownloadHandling { get; set; }
|
Boolean EnableFailedDownloadHandling { get; set; }
|
||||||
|
Boolean CreateEmptySeriesFolders { get; set; }
|
||||||
void SaveValues(Dictionary<string, object> configValues);
|
void SaveValues(Dictionary<string, object> configValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Instrumentation;
|
using NzbDrone.Core.Instrumentation;
|
||||||
using NzbDrone.Core.MediaFiles.Commands;
|
using NzbDrone.Core.MediaFiles.Commands;
|
||||||
using NzbDrone.Core.MediaFiles.EpisodeImport;
|
using NzbDrone.Core.MediaFiles.EpisodeImport;
|
||||||
@ -25,17 +26,21 @@ public class DiskScanService :
|
|||||||
private readonly IMakeImportDecision _importDecisionMaker;
|
private readonly IMakeImportDecision _importDecisionMaker;
|
||||||
private readonly IImportApprovedEpisodes _importApprovedEpisodes;
|
private readonly IImportApprovedEpisodes _importApprovedEpisodes;
|
||||||
private readonly ICommandExecutor _commandExecutor;
|
private readonly ICommandExecutor _commandExecutor;
|
||||||
|
private readonly IConfigService _configService;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public DiskScanService(IDiskProvider diskProvider,
|
public DiskScanService(IDiskProvider diskProvider,
|
||||||
IMakeImportDecision importDecisionMaker,
|
IMakeImportDecision importDecisionMaker,
|
||||||
IImportApprovedEpisodes importApprovedEpisodes,
|
IImportApprovedEpisodes importApprovedEpisodes,
|
||||||
ICommandExecutor commandExecutor, Logger logger)
|
ICommandExecutor commandExecutor,
|
||||||
|
IConfigService configService,
|
||||||
|
Logger logger)
|
||||||
{
|
{
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
_importDecisionMaker = importDecisionMaker;
|
_importDecisionMaker = importDecisionMaker;
|
||||||
_importApprovedEpisodes = importApprovedEpisodes;
|
_importApprovedEpisodes = importApprovedEpisodes;
|
||||||
_commandExecutor = commandExecutor;
|
_commandExecutor = commandExecutor;
|
||||||
|
_configService = configService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,6 +51,14 @@ private void Scan(Series series)
|
|||||||
|
|
||||||
if (!_diskProvider.FolderExists(series.Path))
|
if (!_diskProvider.FolderExists(series.Path))
|
||||||
{
|
{
|
||||||
|
if (_configService.CreateEmptySeriesFolders &&
|
||||||
|
_diskProvider.FolderExists(_diskProvider.GetParentFolder(series.Path)))
|
||||||
|
{
|
||||||
|
_logger.Debug("Creating missing series folder: {0}", series.Path);
|
||||||
|
_diskProvider.CreateFolder(series.Path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_logger.Debug("Series folder doesn't exist: {0}", series.Path);
|
_logger.Debug("Series folder doesn't exist: {0}", series.Path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
<div class="btn btn-primary slide-button"/>
|
<div class="btn btn-primary slide-button"/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<span class="help-inline-checkbox">
|
<span class="help-inline-checkbox">
|
||||||
<i class="icon-question-sign" title="Should NzbDrone download episodes for this series?"/>
|
<i class="icon-question-sign" title="Should NzbDrone download episodes for this series?"/>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,5 +1,26 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Season Folder</legend>
|
<legend>Folders</legend>
|
||||||
|
|
||||||
|
<div class="control-group advanced-setting">
|
||||||
|
<label class="control-label">Create empty series folders</label>
|
||||||
|
|
||||||
|
<div class="controls">
|
||||||
|
<label class="checkbox toggle well">
|
||||||
|
<input type="checkbox" name="createEmptySeriesFolders"/>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<span>Yes</span>
|
||||||
|
<span>No</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="btn btn-primary slide-button"/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<span class="help-inline-checkbox">
|
||||||
|
<i class="icon-question-sign" title="Create missing series folders during disk scan"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!--TODO: Remove this and move it to Add Series-->
|
<!--TODO: Remove this and move it to Add Series-->
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
Loading…
Reference in New Issue
Block a user