mirror of https://github.com/lidarr/Lidarr
parent
be4e748977
commit
ffc67899d1
|
@ -35,6 +35,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MediaFileService : IMediaFileService,
|
public class MediaFileService : IMediaFileService,
|
||||||
|
IHandle<ArtistMovedEvent>,
|
||||||
IHandleAsync<AlbumDeletedEvent>,
|
IHandleAsync<AlbumDeletedEvent>,
|
||||||
IHandleAsync<ModelEvent<RootFolder>>
|
IHandleAsync<ModelEvent<RootFolder>>
|
||||||
{
|
{
|
||||||
|
@ -200,6 +201,19 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
_mediaFileRepository.SetFields(trackFiles, t => t.MediaInfo);
|
_mediaFileRepository.SetFields(trackFiles, t => t.MediaInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Handle(ArtistMovedEvent message)
|
||||||
|
{
|
||||||
|
var files = _mediaFileRepository.GetFilesWithBasePath(message.SourcePath);
|
||||||
|
|
||||||
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
var newPath = message.DestinationPath + file.Path.Substring(message.SourcePath.Length);
|
||||||
|
file.Path = newPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
Update(files);
|
||||||
|
}
|
||||||
|
|
||||||
public void HandleAsync(AlbumDeletedEvent message)
|
public void HandleAsync(AlbumDeletedEvent message)
|
||||||
{
|
{
|
||||||
if (message.DeleteFiles)
|
if (message.DeleteFiles)
|
||||||
|
|
Loading…
Reference in New Issue