1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2025-01-03 05:25:10 +00:00

Improve messaging for renamed track files progress info

This commit is contained in:
Bogdan 2024-07-27 00:31:53 +03:00
parent 70e524409c
commit d2bd9b4849

View file

@ -108,7 +108,7 @@ private IEnumerable<RenameTrackFilePreview> GetPreviews(Artist artist, List<Trac
} }
} }
private void RenameFiles(List<TrackFile> trackFiles, Artist artist) private List<RenamedTrackFile> RenameFiles(List<TrackFile> trackFiles, Artist artist)
{ {
var renamed = new List<RenamedTrackFile>(); var renamed = new List<RenamedTrackFile>();
@ -149,11 +149,13 @@ private void RenameFiles(List<TrackFile> trackFiles, Artist artist)
if (renamed.Any()) if (renamed.Any())
{ {
_eventAggregator.PublishEvent(new ArtistRenamedEvent(artist, renamed)); _logger.Debug("Removing empty subfolders from: {0}", artist.Path);
_logger.Debug("Removing Empty Subfolders from: {0}", artist.Path);
_diskProvider.RemoveEmptySubfolders(artist.Path); _diskProvider.RemoveEmptySubfolders(artist.Path);
_eventAggregator.PublishEvent(new ArtistRenamedEvent(artist, renamed));
} }
return renamed;
} }
public void Execute(RenameFilesCommand message) public void Execute(RenameFilesCommand message)
@ -162,8 +164,8 @@ public void Execute(RenameFilesCommand message)
var trackFiles = _mediaFileService.Get(message.Files); var trackFiles = _mediaFileService.Get(message.Files);
_logger.ProgressInfo("Renaming {0} files for {1}", trackFiles.Count, artist.Name); _logger.ProgressInfo("Renaming {0} files for {1}", trackFiles.Count, artist.Name);
RenameFiles(trackFiles, artist); var renamedFiles = RenameFiles(trackFiles, artist);
_logger.ProgressInfo("Selected track files renamed for {0}", artist.Name); _logger.ProgressInfo("{0} selected track files renamed for {1}", renamedFiles.Count, artist.Name);
_eventAggregator.PublishEvent(new RenameCompletedEvent()); _eventAggregator.PublishEvent(new RenameCompletedEvent());
} }
@ -177,8 +179,8 @@ public void Execute(RenameArtistCommand message)
{ {
var trackFiles = _mediaFileService.GetFilesByArtist(artist.Id); var trackFiles = _mediaFileService.GetFilesByArtist(artist.Id);
_logger.ProgressInfo("Renaming all files in artist: {0}", artist.Name); _logger.ProgressInfo("Renaming all files in artist: {0}", artist.Name);
RenameFiles(trackFiles, artist); var renamedFiles = RenameFiles(trackFiles, artist);
_logger.ProgressInfo("All track files renamed for {0}", artist.Name); _logger.ProgressInfo("{0} track files renamed for {1}", renamedFiles.Count, artist.Name);
} }
_eventAggregator.PublishEvent(new RenameCompletedEvent()); _eventAggregator.PublishEvent(new RenameCompletedEvent());