diff --git a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs index b5e893076..17446c9ac 100644 --- a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs +++ b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs @@ -24,7 +24,7 @@ namespace NzbDrone.Core.Notifications.CustomScript public override void OnDownload(DownloadMessage message) { - _customScriptService.OnDownload(message.Series, message.EpisodeFile, Settings); + _customScriptService.OnDownload(message.Series, message.EpisodeFile, message.SourcePath, Settings); } public override void OnRename(Series series) diff --git a/src/NzbDrone.Core/Notifications/CustomScript/CustomScriptService.cs b/src/NzbDrone.Core/Notifications/CustomScript/CustomScriptService.cs index 1532895e4..f33d892ff 100644 --- a/src/NzbDrone.Core/Notifications/CustomScript/CustomScriptService.cs +++ b/src/NzbDrone.Core/Notifications/CustomScript/CustomScriptService.cs @@ -14,7 +14,7 @@ namespace NzbDrone.Core.Notifications.CustomScript { public interface ICustomScriptService { - void OnDownload(Series series, EpisodeFile episodeFile, CustomScriptSettings settings); + void OnDownload(Series series, EpisodeFile episodeFile, string sourcePath, CustomScriptSettings settings); void OnRename(Series series, CustomScriptSettings settings); ValidationFailure Test(CustomScriptSettings settings); } @@ -32,7 +32,7 @@ namespace NzbDrone.Core.Notifications.CustomScript _logger = logger; } - public void OnDownload(Series series, EpisodeFile episodeFile, CustomScriptSettings settings) + public void OnDownload(Series series, EpisodeFile episodeFile, string sourcePath, CustomScriptSettings settings) { var environmentVariables = new StringDictionary(); @@ -52,6 +52,8 @@ namespace NzbDrone.Core.Notifications.CustomScript environmentVariables.Add("Sonarr_EpisodeFile_QualityVersion", episodeFile.Quality.Revision.Version.ToString()); environmentVariables.Add("Sonarr_EpisodeFile_ReleaseGroup", episodeFile.ReleaseGroup ?? String.Empty); environmentVariables.Add("Sonarr_EpisodeFile_SceneName", episodeFile.SceneName ?? String.Empty); + environmentVariables.Add("Sonarr_EpisodeFile_SourcePath", sourcePath); + environmentVariables.Add("Sonarr_EpisodeFile_SourceFolder", Path.GetDirectoryName(sourcePath)); ExecuteScript(environmentVariables, settings); } diff --git a/src/NzbDrone.Core/Notifications/DownloadMessage.cs b/src/NzbDrone.Core/Notifications/DownloadMessage.cs index 5e5ba6768..a16ecea80 100644 --- a/src/NzbDrone.Core/Notifications/DownloadMessage.cs +++ b/src/NzbDrone.Core/Notifications/DownloadMessage.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using NzbDrone.Core.MediaFiles; using NzbDrone.Core.Tv; @@ -7,10 +6,11 @@ namespace NzbDrone.Core.Notifications { public class DownloadMessage { - public String Message { get; set; } + public string Message { get; set; } public Series Series { get; set; } public EpisodeFile EpisodeFile { get; set; } public List OldFiles { get; set; } + public string SourcePath { get; set; } public override string ToString() { diff --git a/src/NzbDrone.Core/Notifications/NotificationService.cs b/src/NzbDrone.Core/Notifications/NotificationService.cs index e7e44504f..d3affaf4c 100644 --- a/src/NzbDrone.Core/Notifications/NotificationService.cs +++ b/src/NzbDrone.Core/Notifications/NotificationService.cs @@ -119,6 +119,7 @@ namespace NzbDrone.Core.Notifications downloadMessage.Series = message.Episode.Series; downloadMessage.EpisodeFile = message.EpisodeFile; downloadMessage.OldFiles = message.OldFiles; + downloadMessage.SourcePath = message.Episode.Path; foreach (var notification in _notificationFactory.OnDownloadEnabled()) {