mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-27 22:56:45 -04:00
New: Write metadata to tags, with UI for previewing changes (#633)
This commit is contained in:
@@ -38,6 +38,7 @@ namespace NzbDrone.Core.History
|
||||
IHandle<DownloadCompletedEvent>,
|
||||
IHandle<TrackFileDeletedEvent>,
|
||||
IHandle<TrackFileRenamedEvent>,
|
||||
IHandle<TrackFileRetaggedEvent>,
|
||||
IHandle<ArtistDeletedEvent>
|
||||
{
|
||||
private readonly IHistoryRepository _historyRepository;
|
||||
@@ -345,6 +346,35 @@ namespace NzbDrone.Core.History
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(TrackFileRetaggedEvent message)
|
||||
{
|
||||
var path = Path.Combine(message.Artist.Path, message.TrackFile.RelativePath);
|
||||
var relativePath = message.TrackFile.RelativePath;
|
||||
|
||||
foreach (var track in message.TrackFile.Tracks.Value)
|
||||
{
|
||||
var history = new History
|
||||
{
|
||||
EventType = HistoryEventType.TrackFileRetagged,
|
||||
Date = DateTime.UtcNow,
|
||||
Quality = message.TrackFile.Quality,
|
||||
SourceTitle = path,
|
||||
ArtistId = message.TrackFile.Artist.Value.Id,
|
||||
AlbumId = message.TrackFile.AlbumId,
|
||||
TrackId = track.Id,
|
||||
};
|
||||
|
||||
history.Data.Add("TagsScrubbed", message.Scrubbed.ToString());
|
||||
history.Data.Add("Diff", message.Diff.Select(x => new {
|
||||
Field = x.Key,
|
||||
OldValue = x.Value.Item1,
|
||||
NewValue = x.Value.Item2
|
||||
}).ToJson());
|
||||
|
||||
_historyRepository.Insert(history);
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(ArtistDeletedEvent message)
|
||||
{
|
||||
_historyRepository.DeleteForArtist(message.Artist.Id);
|
||||
|
||||
Reference in New Issue
Block a user