mirror of
https://github.com/Lidarr/Lidarr
synced 2026-05-04 18:40:46 +02:00
Fixed: Don't create empty artist folder if delete empty folders is enabled
Fixes Sonarr/Sonarr#3838 (cherry picked from commit 4f15cd55be5f7332ebde608d8b438384865e9dc1)
This commit is contained in:
parent
1eb6b8061b
commit
f627a3cb88
1 changed files with 29 additions and 1 deletions
|
|
@ -142,6 +142,35 @@ public void Scan(List<string> folders = null, FilterFilesType filter = FilterFil
|
|||
mediaFileList.AddRange(files);
|
||||
}
|
||||
|
||||
var artists = _artistService.GetArtists(artistIds);
|
||||
|
||||
// Check for missing artist folders if specific artists are being scanned
|
||||
if (artistIds != null && artistIds.Any())
|
||||
{
|
||||
foreach (var artist in artists)
|
||||
{
|
||||
if (!_diskProvider.FolderExists(artist.Path))
|
||||
{
|
||||
if (_configService.CreateEmptyArtistFolders)
|
||||
{
|
||||
if (_configService.DeleteEmptyFolders)
|
||||
{
|
||||
_logger.Debug("Not creating missing artist folder: {0} because delete empty folders is enabled", artist.Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Debug("Creating missing artist folder: {0}", artist.Path);
|
||||
_diskProvider.CreateFolder(artist.Path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Debug("Artist folder doesn't exist: {0}", artist.Path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
musicFilesStopwatch.Stop();
|
||||
_logger.Trace("Finished getting track files for:\n{0} [{1}]", folders.ConcatToString("\n"), musicFilesStopwatch.Elapsed);
|
||||
|
||||
|
|
@ -211,7 +240,6 @@ public void Scan(List<string> folders = null, FilterFilesType filter = FilterFil
|
|||
|
||||
_logger.Debug($"Updated info for {updatedFiles.Count} known files");
|
||||
|
||||
var artists = _artistService.GetArtists(artistIds);
|
||||
foreach (var artist in artists)
|
||||
{
|
||||
CompletedScanning(artist);
|
||||
|
|
|
|||
Loading…
Reference in a new issue