mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 04:59:35 -07:00
Fixed: Prevent false notification for moving artist when editing
This commit is contained in:
parent
bdf5ad2e2b
commit
0133f4331b
5 changed files with 23 additions and 27 deletions
|
@ -167,17 +167,19 @@ namespace Lidarr.Api.V1.Artist
|
||||||
{
|
{
|
||||||
var artist = _artistService.GetArtist(artistResource.Id);
|
var artist = _artistService.GetArtist(artistResource.Id);
|
||||||
|
|
||||||
var sourcePath = artist.Path;
|
if (moveFiles)
|
||||||
var destinationPath = artistResource.Path;
|
|
||||||
|
|
||||||
_commandQueueManager.Push(new MoveArtistCommand
|
|
||||||
{
|
{
|
||||||
ArtistId = artist.Id,
|
var sourcePath = artist.Path;
|
||||||
SourcePath = sourcePath,
|
var destinationPath = artistResource.Path;
|
||||||
DestinationPath = destinationPath,
|
|
||||||
MoveFiles = moveFiles,
|
_commandQueueManager.Push(new MoveArtistCommand
|
||||||
Trigger = CommandTrigger.Manual
|
{
|
||||||
});
|
ArtistId = artist.Id,
|
||||||
|
SourcePath = sourcePath,
|
||||||
|
DestinationPath = destinationPath,
|
||||||
|
Trigger = CommandTrigger.Manual
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var model = artistResource.ToModel(artist);
|
var model = artistResource.ToModel(artist);
|
||||||
|
|
||||||
|
|
|
@ -79,13 +79,12 @@ namespace Lidarr.Api.V1.Artist
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (artistToMove.Any())
|
if (resource.MoveFiles && artistToMove.Any())
|
||||||
{
|
{
|
||||||
_commandQueueManager.Push(new BulkMoveArtistCommand
|
_commandQueueManager.Push(new BulkMoveArtistCommand
|
||||||
{
|
{
|
||||||
DestinationRootFolder = resource.RootFolderPath,
|
DestinationRootFolder = resource.RootFolderPath,
|
||||||
Artist = artistToMove,
|
Artist = artistToMove
|
||||||
MoveFiles = resource.MoveFiles
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ namespace NzbDrone.Core.Music.Commands
|
||||||
{
|
{
|
||||||
public List<BulkMoveArtist> Artist { get; set; }
|
public List<BulkMoveArtist> Artist { get; set; }
|
||||||
public string DestinationRootFolder { get; set; }
|
public string DestinationRootFolder { get; set; }
|
||||||
public bool MoveFiles { get; set; }
|
|
||||||
|
|
||||||
public override bool SendUpdatesToClient => true;
|
public override bool SendUpdatesToClient => true;
|
||||||
public override bool RequiresDiskAccess => true;
|
public override bool RequiresDiskAccess => true;
|
||||||
|
|
|
@ -7,7 +7,6 @@ namespace NzbDrone.Core.Music.Commands
|
||||||
public int ArtistId { get; set; }
|
public int ArtistId { get; set; }
|
||||||
public string SourcePath { get; set; }
|
public string SourcePath { get; set; }
|
||||||
public string DestinationPath { get; set; }
|
public string DestinationPath { get; set; }
|
||||||
public bool MoveFiles { get; set; }
|
|
||||||
|
|
||||||
public override bool SendUpdatesToClient => true;
|
public override bool SendUpdatesToClient => true;
|
||||||
public override bool RequiresDiskAccess => true;
|
public override bool RequiresDiskAccess => true;
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace NzbDrone.Core.Music
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveSingleArtist(Artist artist, string sourcePath, string destinationPath, bool moveFiles, int? index = null, int? total = null)
|
private void MoveSingleArtist(Artist artist, string sourcePath, string destinationPath, int? index = null, int? total = null)
|
||||||
{
|
{
|
||||||
if (!_diskProvider.FolderExists(sourcePath))
|
if (!_diskProvider.FolderExists(sourcePath))
|
||||||
{
|
{
|
||||||
|
@ -57,17 +57,14 @@ namespace NzbDrone.Core.Music
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (moveFiles)
|
_rootFolderWatchingService.ReportFileSystemChangeBeginning(sourcePath, destinationPath);
|
||||||
{
|
|
||||||
_rootFolderWatchingService.ReportFileSystemChangeBeginning(sourcePath, destinationPath);
|
|
||||||
|
|
||||||
// Ensure the parent of the artist folder exists, this will often just be the root folder, but
|
// Ensure the parent of the artist folder exists, this will often just be the root folder, but
|
||||||
// in cases where people are using subfolders for first letter (etc) it may not yet exist.
|
// in cases where people are using subfolders for first letter (etc) it may not yet exist.
|
||||||
_diskProvider.CreateFolder(new DirectoryInfo(destinationPath).Parent.FullName);
|
_diskProvider.CreateFolder(new DirectoryInfo(destinationPath).Parent.FullName);
|
||||||
_diskTransferService.TransferFolder(sourcePath, destinationPath, TransferMode.Move);
|
_diskTransferService.TransferFolder(sourcePath, destinationPath, TransferMode.Move);
|
||||||
|
|
||||||
_logger.ProgressInfo("{0} moved successfully to {1}", artist.Name, destinationPath);
|
_logger.ProgressInfo("{0} moved successfully to {1}", artist.Name, destinationPath);
|
||||||
}
|
|
||||||
|
|
||||||
_eventAggregator.PublishEvent(new ArtistMovedEvent(artist, sourcePath, destinationPath));
|
_eventAggregator.PublishEvent(new ArtistMovedEvent(artist, sourcePath, destinationPath));
|
||||||
}
|
}
|
||||||
|
@ -91,7 +88,7 @@ namespace NzbDrone.Core.Music
|
||||||
{
|
{
|
||||||
var artist = _artistService.GetArtist(message.ArtistId);
|
var artist = _artistService.GetArtist(message.ArtistId);
|
||||||
|
|
||||||
MoveSingleArtist(artist, message.SourcePath, message.DestinationPath, message.MoveFiles);
|
MoveSingleArtist(artist, message.SourcePath, message.DestinationPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Execute(BulkMoveArtistCommand message)
|
public void Execute(BulkMoveArtistCommand message)
|
||||||
|
@ -107,7 +104,7 @@ namespace NzbDrone.Core.Music
|
||||||
var artist = _artistService.GetArtist(s.ArtistId);
|
var artist = _artistService.GetArtist(s.ArtistId);
|
||||||
var destinationPath = Path.Combine(destinationRootFolder, _filenameBuilder.GetArtistFolder(artist));
|
var destinationPath = Path.Combine(destinationRootFolder, _filenameBuilder.GetArtistFolder(artist));
|
||||||
|
|
||||||
MoveSingleArtist(artist, s.SourcePath, destinationPath, message.MoveFiles, index, artistToMove.Count);
|
MoveSingleArtist(artist, s.SourcePath, destinationPath, index, artistToMove.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.ProgressInfo("Finished moving {0} artist to '{1}'", artistToMove.Count, destinationRootFolder);
|
_logger.ProgressInfo("Finished moving {0} artist to '{1}'", artistToMove.Count, destinationRootFolder);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue