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 @@ 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)

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 @@ 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;
}
}
}
}
}

View File

@ -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())
{

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 @@ 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()
{

View File

@ -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())
{