Add release Id to custom script (#574)

pull/587/head
ta264 6 years ago committed by Qstick
parent c749405a45
commit 7a38f2853c

@ -9,16 +9,18 @@ namespace NzbDrone.Core.MediaFiles.Events
{
public Artist Artist { get; private set; }
public Album Album { get; private set; }
public AlbumRelease AlbumRelease { get; private set; }
public List<TrackFile> ImportedTracks { get; private set; }
public List<TrackFile> OldFiles { get; private set; }
public bool NewDownload { get; private set; }
public string DownloadClient { get; private set; }
public string DownloadId { get; private set; }
public AlbumImportedEvent(Artist artist, Album album, List<TrackFile> importedTracks, List<TrackFile> oldFiles, bool newDownload, DownloadClientItem downloadClientItem)
public AlbumImportedEvent(Artist artist, Album album, AlbumRelease release, List<TrackFile> importedTracks, List<TrackFile> oldFiles, bool newDownload, DownloadClientItem downloadClientItem)
{
Artist = artist;
Album = album;
AlbumRelease = release;
ImportedTracks = importedTracks;
OldFiles = oldFiles;
NewDownload = newDownload;

@ -187,6 +187,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport
foreach (var albumImport in albumImports)
{
var release = albumImport.First().ImportDecision.LocalTrack.Release;
var album = albumImport.First().ImportDecision.LocalTrack.Album;
var artist = albumImport.First().ImportDecision.LocalTrack.Artist;
@ -195,6 +196,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport
_eventAggregator.PublishEvent(new AlbumImportedEvent(
artist,
album,
release,
allImportedTrackFiles.Where(s => s.AlbumId == album.Id).ToList(),
allOldTrackFiles.Where(s => s.AlbumId == album.Id).ToList(), newDownload,
downloadClientItem));

@ -9,6 +9,7 @@ namespace NzbDrone.Core.Notifications
public string Message { get; set; }
public Artist Artist { get; set; }
public Album Album { get; set; }
public AlbumRelease Release { get; set; }
public List<TrackFile> TrackFiles { get; set; }
public List<TrackFile> OldFiles { get; set; }
public string DownloadClient { get; set; }

@ -59,6 +59,7 @@ namespace NzbDrone.Core.Notifications.CustomScript
{
var artist = message.Artist;
var album = message.Album;
var release = message.Release;
var trackFile = message.TrackFile;
var sourcePath = message.SourcePath;
var environmentVariables = new StringDictionary();
@ -73,6 +74,7 @@ namespace NzbDrone.Core.Notifications.CustomScript
environmentVariables.Add("Lidarr_Album_Id", album.Id.ToString());
environmentVariables.Add("Lidarr_Album_Title", album.Title);
environmentVariables.Add("Lidarr_Album_MBId", album.ForeignAlbumId);
environmentVariables.Add("Lidarr_AlbumRelease_MBId", release.ForeignReleaseId);
environmentVariables.Add("Lidarr_Album_ReleaseDate", album.ReleaseDate.ToString());
environmentVariables.Add("Lidarr_TrackFile_Id", trackFile.Id.ToString());
environmentVariables.Add("Lidarr_TrackFile_TrackCount", trackFile.Tracks.Value.Count.ToString());
@ -102,6 +104,7 @@ namespace NzbDrone.Core.Notifications.CustomScript
{
var artist = message.Artist;
var album = message.Album;
var release = message.Release;
var environmentVariables = new StringDictionary();
environmentVariables.Add("Lidarr_EventType", "AlbumDownload");
@ -113,6 +116,7 @@ namespace NzbDrone.Core.Notifications.CustomScript
environmentVariables.Add("Lidarr_Album_Id", album.Id.ToString());
environmentVariables.Add("Lidarr_Album_Title", album.Title);
environmentVariables.Add("Lidarr_Album_MBId", album.ForeignAlbumId);
environmentVariables.Add("Lidarr_AlbumRelease_MBId", release.ForeignReleaseId);
environmentVariables.Add("Lidarr_Album_ReleaseDate", album.ReleaseDate.ToString());
environmentVariables.Add("Lidarr_Download_Client", message.DownloadClient ?? string.Empty);
environmentVariables.Add("Lidarr_Download_Id", message.DownloadId ?? string.Empty);

@ -132,6 +132,7 @@ namespace NzbDrone.Core.Notifications
Message = GetTrackMessage(message.TrackInfo.Artist, message.TrackInfo.Tracks, message.TrackInfo.Quality),
Artist = message.TrackInfo.Artist,
Album = message.TrackInfo.Album,
Release = message.TrackInfo.Release,
TrackFile = message.ImportedTrack,
OldFiles = message.OldFiles,
SourcePath = message.TrackInfo.Path,
@ -172,6 +173,7 @@ namespace NzbDrone.Core.Notifications
Message = GetAlbumDownloadMessage(message.Artist, message.Album, message.ImportedTracks),
Artist = message.Artist,
Album = message.Album,
Release = message.AlbumRelease,
DownloadClient = message.DownloadClient,
DownloadId = message.DownloadId,
TrackFiles = message.ImportedTracks,

@ -9,6 +9,7 @@ namespace NzbDrone.Core.Notifications
public string Message { get; set; }
public Artist Artist { get; set; }
public Album Album { get; set; }
public AlbumRelease Release { get; set; }
public TrackFile TrackFile { get; set; }
public List<TrackFile> OldFiles { get; set; }
public string SourcePath { get; set; }

Loading…
Cancel
Save