|
|
|
@ -1,10 +1,12 @@
|
|
|
|
|
using System.IO;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Common.Disk;
|
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
|
using NzbDrone.Common.Instrumentation.Extensions;
|
|
|
|
|
using NzbDrone.Core.Messaging.Commands;
|
|
|
|
|
using NzbDrone.Core.Messaging.Events;
|
|
|
|
|
using NzbDrone.Core.Organizer;
|
|
|
|
|
using NzbDrone.Core.RootFolders;
|
|
|
|
|
using NzbDrone.Core.Tv.Commands;
|
|
|
|
|
using NzbDrone.Core.Tv.Events;
|
|
|
|
|
|
|
|
|
@ -16,6 +18,7 @@ namespace NzbDrone.Core.Tv
|
|
|
|
|
private readonly IBuildFileNames _filenameBuilder;
|
|
|
|
|
private readonly IDiskProvider _diskProvider;
|
|
|
|
|
private readonly IDiskTransferService _diskTransferService;
|
|
|
|
|
private readonly IRootFolderService _rootFolderService;
|
|
|
|
|
private readonly IEventAggregator _eventAggregator;
|
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
|
|
|
@ -23,6 +26,7 @@ namespace NzbDrone.Core.Tv
|
|
|
|
|
IBuildFileNames filenameBuilder,
|
|
|
|
|
IDiskProvider diskProvider,
|
|
|
|
|
IDiskTransferService diskTransferService,
|
|
|
|
|
IRootFolderService rootFolderService,
|
|
|
|
|
IEventAggregator eventAggregator,
|
|
|
|
|
Logger logger)
|
|
|
|
|
{
|
|
|
|
@ -30,6 +34,7 @@ namespace NzbDrone.Core.Tv
|
|
|
|
|
_filenameBuilder = filenameBuilder;
|
|
|
|
|
_diskProvider = diskProvider;
|
|
|
|
|
_diskTransferService = diskTransferService;
|
|
|
|
|
_rootFolderService = rootFolderService;
|
|
|
|
|
_eventAggregator = eventAggregator;
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
|
|
|
@ -53,7 +58,18 @@ namespace NzbDrone.Core.Tv
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_diskTransferService.TransferFolder(sourcePath, destinationPath, TransferMode.Move);
|
|
|
|
|
var sourceRootFolder = _rootFolderService.GetBestRootFolderPath(sourcePath);
|
|
|
|
|
var destinationRootFolder = _rootFolderService.GetBestRootFolderPath(destinationPath);
|
|
|
|
|
|
|
|
|
|
if (sourceRootFolder.PathEquals(destinationRootFolder) && !_diskProvider.FolderExists(destinationPath))
|
|
|
|
|
{
|
|
|
|
|
_diskProvider.MoveFolder(sourcePath, destinationPath);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_diskTransferService.TransferFolder(sourcePath, destinationPath, TransferMode.Move);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_logger.ProgressInfo("{0} moved successfully to {1}", series.Title, series.Path);
|
|
|
|
|
|
|
|
|
|
_eventAggregator.PublishEvent(new SeriesMovedEvent(series, sourcePath, destinationPath));
|
|
|
|
|