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

pull/2233/head
adnanklink 7 years ago committed by Leonardo Galli
parent d0174c7b7b
commit cb857934c4

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -131,7 +131,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
if (newDownload)
{
_eventAggregator.PublishEvent(new MovieDownloadedEvent(localMovie, movieFile, oldFiles));
_eventAggregator.PublishEvent(new MovieDownloadedEvent(localMovie, movieFile, oldFiles, downloadClientItem));
}
}
catch (Exception e)

@ -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 @@ namespace NzbDrone.Core.MediaFiles.Events
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;
}
}
}
}
}

@ -72,6 +72,7 @@ namespace NzbDrone.Core.Notifications.CustomScript
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())
{

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Tv;
@ -14,6 +14,7 @@ namespace NzbDrone.Core.Notifications
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()
{

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

Loading…
Cancel
Save