From 5d9d2e684ebf8636c171ec684caad3c1de7fd81d Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 29 Mar 2017 13:14:10 -0700 Subject: [PATCH] New: Paths for deleted files when upgrading an existing file --- .../Notifications/CustomScript/CustomScript.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs index cb40c2c54..9ca13be5b 100644 --- a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs +++ b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs @@ -64,6 +64,7 @@ namespace NzbDrone.Core.Notifications.CustomScript var environmentVariables = new StringDictionary(); environmentVariables.Add("Sonarr_EventType", "Download"); + environmentVariables.Add("Sonarr_IsUpgrade", message.OldFiles.Any().ToString()); environmentVariables.Add("Sonarr_Series_Id", series.Id.ToString()); environmentVariables.Add("Sonarr_Series_Title", series.Title); environmentVariables.Add("Sonarr_Series_Path", series.Path); @@ -85,6 +86,12 @@ namespace NzbDrone.Core.Notifications.CustomScript environmentVariables.Add("Sonarr_EpisodeFile_SourcePath", sourcePath); environmentVariables.Add("Sonarr_EpisodeFile_SourceFolder", Path.GetDirectoryName(sourcePath)); + if (message.OldFiles.Any()) + { + environmentVariables.Add("Sonarr_DeletedRelativePaths", string.Join("|", message.OldFiles.Select(e => e.RelativePath))); + environmentVariables.Add("Sonarr_DeletedPaths", string.Join("|", message.OldFiles.Select(e => Path.Combine(series.Path, e.RelativePath)))); + } + ExecuteScript(environmentVariables); }