mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-25 07:12:40 +00:00
Fixed: Exception thrown when marking download as complete
(cherry picked from commit 9ebeee8b4fb04edfb709767b970f5e1d109bc4b9)
This commit is contained in:
parent
47d0acaa1a
commit
95f30b23c8
1 changed files with 8 additions and 6 deletions
|
@ -152,7 +152,7 @@ public void Handle(TrackImportedEvent message)
|
||||||
var history = new DownloadHistory
|
var history = new DownloadHistory
|
||||||
{
|
{
|
||||||
EventType = DownloadHistoryEventType.FileImported,
|
EventType = DownloadHistoryEventType.FileImported,
|
||||||
ArtistId = message.TrackInfo.Artist.Id,
|
ArtistId = message.ImportedTrack.Artist.Value.Id,
|
||||||
DownloadId = downloadId,
|
DownloadId = downloadId,
|
||||||
SourceTitle = message.TrackInfo.Path,
|
SourceTitle = message.TrackInfo.Path,
|
||||||
Date = DateTime.UtcNow,
|
Date = DateTime.UtcNow,
|
||||||
|
@ -190,19 +190,21 @@ public void Handle(AlbumImportIncompleteEvent message)
|
||||||
|
|
||||||
public void Handle(DownloadCompletedEvent message)
|
public void Handle(DownloadCompletedEvent message)
|
||||||
{
|
{
|
||||||
|
var downloadItem = message.TrackedDownload.DownloadItem;
|
||||||
|
|
||||||
var history = new DownloadHistory
|
var history = new DownloadHistory
|
||||||
{
|
{
|
||||||
EventType = DownloadHistoryEventType.DownloadImported,
|
EventType = DownloadHistoryEventType.DownloadImported,
|
||||||
ArtistId = message.TrackedDownload.RemoteAlbum.Artist.Id,
|
ArtistId = message.ArtistId,
|
||||||
DownloadId = message.TrackedDownload.DownloadItem.DownloadId,
|
DownloadId = downloadItem.DownloadId,
|
||||||
SourceTitle = message.TrackedDownload.DownloadItem.OutputPath.ToString(),
|
SourceTitle = downloadItem.Title,
|
||||||
Date = DateTime.UtcNow,
|
Date = DateTime.UtcNow,
|
||||||
Protocol = message.TrackedDownload.Protocol,
|
Protocol = message.TrackedDownload.Protocol,
|
||||||
DownloadClientId = message.TrackedDownload.DownloadClient
|
DownloadClientId = message.TrackedDownload.DownloadClient
|
||||||
};
|
};
|
||||||
|
|
||||||
history.Data.Add("DownloadClient", message.TrackedDownload.DownloadItem.DownloadClientInfo.Type);
|
history.Data.Add("DownloadClient", downloadItem.DownloadClientInfo.Type);
|
||||||
history.Data.Add("DownloadClientName", message.TrackedDownload.DownloadItem.DownloadClientInfo.Name);
|
history.Data.Add("DownloadClientName", downloadItem.DownloadClientInfo.Name);
|
||||||
|
|
||||||
_repository.Insert(history);
|
_repository.Insert(history);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue