dny238 4 weeks ago committed by GitHub
commit 06151442c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -88,6 +88,19 @@ namespace NzbDrone.Core.MediaFiles
{
authorIds = new List<int>();
}
else
{
folders = new List<string>();
foreach (var authorId in authorIds)
{
var author = _authorService.GetAuthor(authorId);
if (author != null)
{
folders.Add(author.Path);
}
}
}
var mediaFileList = new List<IFileInfo>();
@ -130,6 +143,25 @@ namespace NzbDrone.Core.MediaFiles
{
_logger.Debug("Specified scan folder ({0}) doesn't exist.", folder);
if (_configService.CreateEmptyAuthorFolders)
{
if (_configService.DeleteEmptyFolders)
{
_logger.Debug("Not creating missing author folder: {0} because delete empty author folders is enabled", folder);
}
else
{
_logger.Debug("Creating missing author folder: {0}", folder);
_diskProvider.CreateFolder(folder);
SetPermissions(folder);
}
}
else
{
_logger.Debug("Author folder doesn't exist: {0}", rootFolder.Path);
}
CleanMediaFiles(folder, new List<string>());
continue;
}
@ -298,6 +330,24 @@ namespace NzbDrone.Core.MediaFiles
.ToList();
}
private void SetPermissions(string path)
{
if (!_configService.SetPermissionsLinux)
{
return;
}
try
{
_diskProvider.SetPermissions(path, _configService.ChmodFolder, _configService.ChownGroup);
}
catch (Exception ex)
{
_logger.Warn(ex, "Unable to apply permissions to: " + path);
_logger.Debug(ex, ex.Message);
}
}
public List<IFileInfo> FilterFiles(string basePath, IEnumerable<IFileInfo> files)
{
return files.Where(file => !ExcludedSubFoldersRegex.IsMatch(basePath.GetRelativePath(file.FullName)))

Loading…
Cancel
Save