1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-10-05 15:47:20 +02:00

Added: Download_Id to On Download/On Upgrade (#2229)

This commit is contained in:
adnanklink 2017-10-29 13:19:30 -05:00 committed by Leonardo Galli
parent d0174c7b7b
commit cb857934c4
5 changed files with 16 additions and 7 deletions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -131,7 +131,7 @@ public List<ImportResult> Import(List<ImportDecision> decisions, bool newDownloa
if (newDownload)
{
_eventAggregator.PublishEvent(new MovieDownloadedEvent(localMovie, movieFile, oldFiles));
_eventAggregator.PublishEvent(new MovieDownloadedEvent(localMovie, movieFile, oldFiles, downloadClientItem));
}
}
catch (Exception e)

View File

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Collections.Generic;
using NzbDrone.Common.Messaging;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Download;
namespace NzbDrone.Core.MediaFiles.Events
{
@ -9,12 +10,17 @@ public class MovieDownloadedEvent : IEvent
public LocalMovie Movie { get; private set; }
public MovieFile MovieFile { get; private set; }
public List<MovieFile> OldFiles { get; private set; }
public string DownloadId { get; private set; }
public MovieDownloadedEvent(LocalMovie episode, MovieFile episodeFile, List<MovieFile> oldFiles)
public MovieDownloadedEvent(LocalMovie episode, MovieFile episodeFile, List<MovieFile> oldFiles, DownloadClientItem downloadClientItem)
{
Movie = episode;
MovieFile = episodeFile;
OldFiles = oldFiles;
if (downloadClientItem != null)
{
DownloadId = downloadClientItem.DownloadId;
}
}
}
}
}

View File

@ -72,6 +72,7 @@ public override void OnDownload(DownloadMessage message)
environmentVariables.Add("Radarr_MovieFile_SceneName", movieFile.SceneName ?? string.Empty);
environmentVariables.Add("Radarr_MovieFile_SourcePath", sourcePath);
environmentVariables.Add("Radarr_MovieFile_SourceFolder", Path.GetDirectoryName(sourcePath));
environmentVariables.Add("Radarr_Download_Id", message.DownloadId ?? string.Empty);
if (message.OldMovieFiles.Any())
{

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Tv;
@ -14,6 +14,7 @@ public class DownloadMessage
public MovieFile MovieFile { get; set; }
public List<MovieFile> OldMovieFiles { get; set; }
public string SourcePath { get; set; }
public string DownloadId { get; set; }
public override string ToString()
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using NLog;
@ -221,6 +221,7 @@ public void Handle(MovieDownloadedEvent message)
downloadMessage.OldFiles = null;
downloadMessage.OldMovieFiles = message.OldFiles;
downloadMessage.SourcePath = message.Movie.Path;
downloadMessage.DownloadId = message.DownloadId;
foreach (var notification in _notificationFactory.OnDownloadEnabled())
{