1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 17:59:14 +00:00

Add IsUpgrade and related deleted file paths for CustomScript (#2205)

* Add IsUpgrade flag and deleted file paths for updates

* use OldMovieFiles instead of OldFiles
This commit is contained in:
fhscholl 2017-10-22 20:49:37 -04:00 committed by Devin Buhl
parent 4574ff5f6d
commit 8861c8d8a4

View file

@ -54,6 +54,7 @@ public override void OnDownload(DownloadMessage message)
var environmentVariables = new StringDictionary();
environmentVariables.Add("Radarr_EventType", "Download");
environmentVariables.Add("Radarr_IsUpgrade", message.OldMovieFiles.Any().ToString());
environmentVariables.Add("Radarr_Movie_Id", movie.Id.ToString());
environmentVariables.Add("Radarr_Movie_Title", movie.Title);
environmentVariables.Add("Radarr_Movie_Path", movie.Path);
@ -69,6 +70,11 @@ public override void OnDownload(DownloadMessage message)
environmentVariables.Add("Radarr_MovieFile_SourcePath", sourcePath);
environmentVariables.Add("Radarr_MovieFile_SourceFolder", Path.GetDirectoryName(sourcePath));
if (message.OldMovieFiles.Any())
{
environmentVariables.Add("Radarr_DeletedRelativePaths", string.Join("|", message.OldMovieFiles.Select(e => e.RelativePath)));
environmentVariables.Add("Radarr_DeletedPaths", string.Join("|", message.OldMovieFiles.Select(e => Path.Combine(movie.Path, e.RelativePath))));
}
ExecuteScript(environmentVariables);
}