|
|
|
@ -12,54 +12,44 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|
|
|
|
{
|
|
|
|
|
public interface IWebhookService
|
|
|
|
|
{
|
|
|
|
|
void OnDownload(Series series, EpisodeFile episodeFile, WebhookSettings settings);
|
|
|
|
|
void OnRename(Series series, WebhookSettings settings);
|
|
|
|
|
void OnGrab(Series series, RemoteEpisode episode, QualityModel quality, WebhookSettings settings);
|
|
|
|
|
void OnDownload(Movie movie, MovieFile movieFile, WebhookSettings settings);
|
|
|
|
|
void OnRename(Movie movie, WebhookSettings settings);
|
|
|
|
|
void OnGrab(Movie movie, RemoteMovie remoteMovie, QualityModel quality, WebhookSettings settings);
|
|
|
|
|
ValidationFailure Test(WebhookSettings settings);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class WebhookService : IWebhookService
|
|
|
|
|
{
|
|
|
|
|
public void OnDownload(Series series, EpisodeFile episodeFile, WebhookSettings settings)
|
|
|
|
|
public void OnDownload(Movie movie, MovieFile movieFile, WebhookSettings settings)
|
|
|
|
|
{
|
|
|
|
|
var payload = new WebhookPayload
|
|
|
|
|
{
|
|
|
|
|
EventType = "Download",
|
|
|
|
|
Series = new WebhookSeries(series),
|
|
|
|
|
Episodes = episodeFile.Episodes.Value.ConvertAll(x => new WebhookEpisode(x) {
|
|
|
|
|
Quality = episodeFile.Quality.Quality.Name,
|
|
|
|
|
QualityVersion = episodeFile.Quality.Revision.Version,
|
|
|
|
|
ReleaseGroup = episodeFile.ReleaseGroup,
|
|
|
|
|
SceneName = episodeFile.SceneName
|
|
|
|
|
})
|
|
|
|
|
Movie = new WebhookMovie(movie, movieFile),
|
|
|
|
|
RemoteMovie = new WebhookRemoteMovie(movie)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NotifyWebhook(payload, settings);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnRename(Series series, WebhookSettings settings)
|
|
|
|
|
public void OnRename(Movie movie, WebhookSettings settings)
|
|
|
|
|
{
|
|
|
|
|
var payload = new WebhookPayload
|
|
|
|
|
{
|
|
|
|
|
EventType = "Rename",
|
|
|
|
|
Series = new WebhookSeries(series)
|
|
|
|
|
Movie = new WebhookMovie(movie)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
NotifyWebhook(payload, settings);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnGrab(Series series, RemoteEpisode episode, QualityModel quality, WebhookSettings settings)
|
|
|
|
|
public void OnGrab(Movie movie, RemoteMovie remoteMovie, QualityModel quality, WebhookSettings settings)
|
|
|
|
|
{
|
|
|
|
|
var payload = new WebhookPayload
|
|
|
|
|
{
|
|
|
|
|
EventType = "Grab",
|
|
|
|
|
Series = new WebhookSeries(series),
|
|
|
|
|
Episodes = episode.Episodes.ConvertAll(x => new WebhookEpisode(x)
|
|
|
|
|
{
|
|
|
|
|
Quality = quality.Quality.Name,
|
|
|
|
|
QualityVersion = quality.Revision.Version,
|
|
|
|
|
ReleaseGroup = episode.ParsedEpisodeInfo.ReleaseGroup
|
|
|
|
|
})
|
|
|
|
|
Movie = new WebhookMovie(movie),
|
|
|
|
|
RemoteMovie = new WebhookRemoteMovie(remoteMovie)
|
|
|
|
|
};
|
|
|
|
|
NotifyWebhook(payload, settings);
|
|
|
|
|
}
|
|
|
|
@ -87,23 +77,18 @@ namespace NzbDrone.Core.Notifications.Webhook
|
|
|
|
|
new WebhookPayload
|
|
|
|
|
{
|
|
|
|
|
EventType = "Test",
|
|
|
|
|
Series = new WebhookSeries()
|
|
|
|
|
Movie = new WebhookMovie()
|
|
|
|
|
{
|
|
|
|
|
Id = 1,
|
|
|
|
|
Title = "Test Title",
|
|
|
|
|
Path = "C:\\testpath",
|
|
|
|
|
TvdbId = 1234
|
|
|
|
|
FilePath = "C:\\testpath",
|
|
|
|
|
},
|
|
|
|
|
Episodes = new List<WebhookEpisode>() {
|
|
|
|
|
new WebhookEpisode()
|
|
|
|
|
{
|
|
|
|
|
Id = 123,
|
|
|
|
|
EpisodeNumber = 1,
|
|
|
|
|
SeasonNumber = 1,
|
|
|
|
|
Title = "Test title"
|
|
|
|
|
}
|
|
|
|
|
RemoteMovie = new WebhookRemoteMovie(){
|
|
|
|
|
ImdbId = "tt012345",
|
|
|
|
|
Title = "My Awesome Movie!"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
settings
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|