mirror of
https://github.com/lidarr/Lidarr
synced 2025-01-02 21:15:05 +00:00
Fixed: Manual importing to nested artist folders
This commit is contained in:
parent
3381ffc311
commit
4588bc4a7e
1 changed files with 13 additions and 3 deletions
|
@ -4,6 +4,7 @@
|
|||
using NLog;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport;
|
||||
|
@ -11,6 +12,7 @@
|
|||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Organizer;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles
|
||||
{
|
||||
|
@ -31,6 +33,7 @@ public class TrackFileMovingService : IMoveTrackFiles
|
|||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IRootFolderWatchingService _rootFolderWatchingService;
|
||||
private readonly IMediaFileAttributeService _mediaFileAttributeService;
|
||||
private readonly IRootFolderService _rootFolderService;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly Logger _logger;
|
||||
|
@ -43,6 +46,7 @@ public TrackFileMovingService(ITrackService trackService,
|
|||
IDiskProvider diskProvider,
|
||||
IRootFolderWatchingService rootFolderWatchingService,
|
||||
IMediaFileAttributeService mediaFileAttributeService,
|
||||
IRootFolderService rootFolderService,
|
||||
IEventAggregator eventAggregator,
|
||||
IConfigService configService,
|
||||
Logger logger)
|
||||
|
@ -55,6 +59,7 @@ public TrackFileMovingService(ITrackService trackService,
|
|||
_diskProvider = diskProvider;
|
||||
_rootFolderWatchingService = rootFolderWatchingService;
|
||||
_mediaFileAttributeService = mediaFileAttributeService;
|
||||
_rootFolderService = rootFolderService;
|
||||
_eventAggregator = eventAggregator;
|
||||
_configService = configService;
|
||||
_logger = logger;
|
||||
|
@ -148,11 +153,16 @@ private void EnsureTrackFolder(TrackFile trackFile, Artist artist, Album album,
|
|||
{
|
||||
var trackFolder = Path.GetDirectoryName(filePath);
|
||||
var artistFolder = artist.Path;
|
||||
var rootFolder = new OsPath(artistFolder).Directory.FullPath;
|
||||
var rootFolder = _rootFolderService.GetBestRootFolder(artistFolder);
|
||||
|
||||
if (!_diskProvider.FolderExists(rootFolder))
|
||||
if (rootFolder == null || rootFolder.Path.IsNullOrWhiteSpace())
|
||||
{
|
||||
throw new RootFolderNotFoundException(string.Format("Root folder '{0}' was not found.", rootFolder));
|
||||
throw new RootFolderNotFoundException($"Root folder was not found, '{artistFolder}' is not a subdirectory of a defined root folder.");
|
||||
}
|
||||
|
||||
if (!_diskProvider.FolderExists(rootFolder.Path))
|
||||
{
|
||||
throw new RootFolderNotFoundException($"Root folder '{rootFolder.Path}' was not found.");
|
||||
}
|
||||
|
||||
var changed = false;
|
||||
|
|
Loading…
Reference in a new issue