Additional Fields in Webhooks

pull/7771/head
Qstick 2 years ago
parent 4f5ad899bb
commit bae374c0c8

@ -1,9 +1,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications.Webhook namespace NzbDrone.Core.Notifications.Webhook
{ {
public class WebhookAddedPayload : WebhookPayload public class WebhookAddedPayload : WebhookPayload
{ {
public WebhookMovie Movie { get; set; } public WebhookMovie Movie { get; set; }
public AddMovieMethod AddMethod { get; set; }
} }
} }

@ -66,13 +66,14 @@ namespace NzbDrone.Core.Notifications.Webhook
return payload; return payload;
} }
protected WebhookRenamePayload BuildOnMovieAdded(Movie movie) protected WebhookAddedPayload BuildOnMovieAdded(Movie movie)
{ {
return new WebhookRenamePayload return new WebhookAddedPayload
{ {
EventType = WebhookEventType.MovieAdded, EventType = WebhookEventType.MovieAdded,
InstanceName = _configFileProvider.InstanceName, InstanceName = _configFileProvider.InstanceName,
Movie = new WebhookMovie(movie) Movie = new WebhookMovie(movie),
AddMethod = movie.AddOptions.AddMethod
}; };
} }
@ -90,13 +91,20 @@ namespace NzbDrone.Core.Notifications.Webhook
protected WebhookMovieDeletePayload BuildOnMovieDelete(MovieDeleteMessage deleteMessage) protected WebhookMovieDeletePayload BuildOnMovieDelete(MovieDeleteMessage deleteMessage)
{ {
return new WebhookMovieDeletePayload var payload = new WebhookMovieDeletePayload
{ {
EventType = WebhookEventType.MovieDelete, EventType = WebhookEventType.MovieDelete,
InstanceName = _configFileProvider.InstanceName, InstanceName = _configFileProvider.InstanceName,
Movie = new WebhookMovie(deleteMessage.Movie), Movie = new WebhookMovie(deleteMessage.Movie),
DeletedFiles = deleteMessage.DeletedFiles DeletedFiles = deleteMessage.DeletedFiles
}; };
if (deleteMessage.DeletedFiles && deleteMessage.Movie.MovieFile != null)
{
payload.MovieFolderSize = deleteMessage.Movie.MovieFile.Size;
}
return payload;
} }
protected WebhookRenamePayload BuildOnRenamePayload(Movie movie, List<RenamedMovieFile> renamedFiles) protected WebhookRenamePayload BuildOnRenamePayload(Movie movie, List<RenamedMovieFile> renamedFiles)

@ -4,5 +4,6 @@ namespace NzbDrone.Core.Notifications.Webhook
{ {
public WebhookMovie Movie { get; set; } public WebhookMovie Movie { get; set; }
public bool DeletedFiles { get; set; } public bool DeletedFiles { get; set; }
public long MovieFolderSize { get; set; }
} }
} }

@ -21,6 +21,7 @@ namespace NzbDrone.Core.Notifications.Webhook
Size = remoteMovie.Release.Size; Size = remoteMovie.Release.Size;
CustomFormats = remoteMovie.CustomFormats?.Select(x => x.Name).ToList(); CustomFormats = remoteMovie.CustomFormats?.Select(x => x.Name).ToList();
CustomFormatScore = remoteMovie.CustomFormatScore; CustomFormatScore = remoteMovie.CustomFormatScore;
IndexerFlags = remoteMovie.Release.IndexerFlags;
} }
public string Quality { get; set; } public string Quality { get; set; }
@ -31,5 +32,6 @@ namespace NzbDrone.Core.Notifications.Webhook
public long Size { get; set; } public long Size { get; set; }
public int CustomFormatScore { get; set; } public int CustomFormatScore { get; set; }
public List<string> CustomFormats { get; set; } public List<string> CustomFormats { get; set; }
public IndexerFlags IndexerFlags { get; set; }
} }
} }

Loading…
Cancel
Save