Webhook clearnup/improvements
New: Remove episode file properties from episodes in Webhook payload New: Add more information to Webhook payload
This commit is contained in:
parent
5fb8ac9685
commit
4dbeb17075
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentValidation.Results;
|
using FluentValidation.Results;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
@ -27,13 +28,7 @@ namespace NzbDrone.Core.Notifications.Webhook
|
||||||
{
|
{
|
||||||
EventType = "Grab",
|
EventType = "Grab",
|
||||||
Series = new WebhookSeries(message.Series),
|
Series = new WebhookSeries(message.Series),
|
||||||
Episodes = remoteEpisode.Episodes.ConvertAll(x => new WebhookEpisode(x)
|
Episodes = remoteEpisode.Episodes.ConvertAll(x => new WebhookEpisode(x)),
|
||||||
{
|
|
||||||
// TODO: Stop passing these parameters inside an episode v3
|
|
||||||
Quality = quality.Quality.Name,
|
|
||||||
QualityVersion = quality.Revision.Version,
|
|
||||||
ReleaseGroup = remoteEpisode.ParsedEpisodeInfo.ReleaseGroup
|
|
||||||
}),
|
|
||||||
Release = new WebhookRelease(quality, remoteEpisode),
|
Release = new WebhookRelease(quality, remoteEpisode),
|
||||||
DownloadClient = message.DownloadClient,
|
DownloadClient = message.DownloadClient,
|
||||||
DownloadId = message.DownloadId
|
DownloadId = message.DownloadId
|
||||||
|
@ -50,20 +45,23 @@ namespace NzbDrone.Core.Notifications.Webhook
|
||||||
{
|
{
|
||||||
EventType = "Download",
|
EventType = "Download",
|
||||||
Series = new WebhookSeries(message.Series),
|
Series = new WebhookSeries(message.Series),
|
||||||
Episodes = episodeFile.Episodes.Value.ConvertAll(x => new WebhookEpisode(x)
|
Episodes = episodeFile.Episodes.Value.ConvertAll(x => new WebhookEpisode(x)),
|
||||||
{
|
|
||||||
// TODO: Stop passing these parameters inside an episode v3
|
|
||||||
Quality = episodeFile.Quality.Quality.Name,
|
|
||||||
QualityVersion = episodeFile.Quality.Revision.Version,
|
|
||||||
ReleaseGroup = episodeFile.ReleaseGroup,
|
|
||||||
SceneName = episodeFile.SceneName
|
|
||||||
}),
|
|
||||||
EpisodeFile = new WebhookEpisodeFile(episodeFile),
|
EpisodeFile = new WebhookEpisodeFile(episodeFile),
|
||||||
IsUpgrade = message.OldFiles.Any(),
|
IsUpgrade = message.OldFiles.Any(),
|
||||||
DownloadClient = message.DownloadClient,
|
DownloadClient = message.DownloadClient,
|
||||||
DownloadId = message.DownloadId
|
DownloadId = message.DownloadId
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (message.OldFiles.Any())
|
||||||
|
{
|
||||||
|
payload.DeletedFiles = message.OldFiles.ConvertAll(x => new WebhookEpisodeFile(x)
|
||||||
|
{
|
||||||
|
Path = Path.Combine(message.Series.Path,
|
||||||
|
x.RelativePath)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
_proxy.SendWebhook(payload, Settings);
|
_proxy.SendWebhook(payload, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,5 @@ namespace NzbDrone.Core.Notifications.Webhook
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string AirDate { get; set; }
|
public string AirDate { get; set; }
|
||||||
public DateTime? AirDateUtc { get; set; }
|
public DateTime? AirDateUtc { get; set; }
|
||||||
|
|
||||||
public string Quality { get; set; }
|
|
||||||
public int QualityVersion { get; set; }
|
|
||||||
public string ReleaseGroup { get; set; }
|
|
||||||
public string SceneName { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,5 +9,6 @@ namespace NzbDrone.Core.Notifications.Webhook
|
||||||
public bool IsUpgrade { get; set; }
|
public bool IsUpgrade { get; set; }
|
||||||
public string DownloadClient { get; set; }
|
public string DownloadClient { get; set; }
|
||||||
public string DownloadId { get; set; }
|
public string DownloadId { get; set; }
|
||||||
|
public List<WebhookEpisodeFile> DeletedFiles { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue