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:
Mark McDowall 2020-10-02 15:01:42 -07:00
parent 5fb8ac9685
commit 4dbeb17075
3 changed files with 14 additions and 20 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using FluentValidation.Results;
using NzbDrone.Core.Tv;
@ -27,13 +28,7 @@ namespace NzbDrone.Core.Notifications.Webhook
{
EventType = "Grab",
Series = new WebhookSeries(message.Series),
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
}),
Episodes = remoteEpisode.Episodes.ConvertAll(x => new WebhookEpisode(x)),
Release = new WebhookRelease(quality, remoteEpisode),
DownloadClient = message.DownloadClient,
DownloadId = message.DownloadId
@ -50,20 +45,23 @@ namespace NzbDrone.Core.Notifications.Webhook
{
EventType = "Download",
Series = new WebhookSeries(message.Series),
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
}),
Episodes = episodeFile.Episodes.Value.ConvertAll(x => new WebhookEpisode(x)),
EpisodeFile = new WebhookEpisodeFile(episodeFile),
IsUpgrade = message.OldFiles.Any(),
DownloadClient = message.DownloadClient,
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);
}

View File

@ -23,10 +23,5 @@ namespace NzbDrone.Core.Notifications.Webhook
public string Title { get; set; }
public string AirDate { 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; }
}
}

View File

@ -9,5 +9,6 @@ namespace NzbDrone.Core.Notifications.Webhook
public bool IsUpgrade { get; set; }
public string DownloadClient { get; set; }
public string DownloadId { get; set; }
public List<WebhookEpisodeFile> DeletedFiles { get; set; }
}
}