Convert Notifiarr Payload to JSON, Standardize with Webhook
This commit is contained in:
parent
cc46ed56b4
commit
f59276881a
|
@ -1,22 +1,20 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using FluentValidation.Results;
|
using FluentValidation.Results;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.HealthCheck;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.MediaFiles.MediaInfo;
|
using NzbDrone.Core.Notifications.Webhook;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
using NzbDrone.Core.Validation;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Notifications.Notifiarr
|
namespace NzbDrone.Core.Notifications.Notifiarr
|
||||||
{
|
{
|
||||||
public class Notifiarr : NotificationBase<NotifiarrSettings>
|
public class Notifiarr : WebhookBase<NotifiarrSettings>
|
||||||
{
|
{
|
||||||
private readonly INotifiarrProxy _proxy;
|
private readonly INotifiarrProxy _proxy;
|
||||||
|
|
||||||
public Notifiarr(INotifiarrProxy proxy)
|
public Notifiarr(INotifiarrProxy proxy, IConfigFileProvider configFileProvider, IConfigService configService)
|
||||||
|
: base(configFileProvider, configService)
|
||||||
{
|
{
|
||||||
_proxy = proxy;
|
_proxy = proxy;
|
||||||
}
|
}
|
||||||
|
@ -26,202 +24,60 @@ namespace NzbDrone.Core.Notifications.Notifiarr
|
||||||
|
|
||||||
public override void OnGrab(GrabMessage message)
|
public override void OnGrab(GrabMessage message)
|
||||||
{
|
{
|
||||||
var series = message.Series;
|
_proxy.SendNotification(BuildOnGrabPayload(message), Settings);
|
||||||
var remoteEpisode = message.Episode;
|
|
||||||
var releaseGroup = remoteEpisode.ParsedEpisodeInfo.ReleaseGroup;
|
|
||||||
var variables = new StringDictionary();
|
|
||||||
|
|
||||||
variables.Add("Sonarr_EventType", "Grab");
|
|
||||||
variables.Add("Sonarr_Series_Id", series.Id.ToString());
|
|
||||||
variables.Add("Sonarr_Series_Title", series.Title);
|
|
||||||
variables.Add("Sonarr_Series_TvdbId", series.TvdbId.ToString());
|
|
||||||
variables.Add("Sonarr_Series_TvMazeId", series.TvMazeId.ToString());
|
|
||||||
variables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
|
||||||
variables.Add("Sonarr_Release_EpisodeCount", remoteEpisode.Episodes.Count.ToString());
|
|
||||||
variables.Add("Sonarr_Release_SeasonNumber", remoteEpisode.Episodes.First().SeasonNumber.ToString());
|
|
||||||
variables.Add("Sonarr_Release_EpisodeNumbers", string.Join(",", remoteEpisode.Episodes.Select(e => e.EpisodeNumber)));
|
|
||||||
variables.Add("Sonarr_Release_AbsoluteEpisodeNumbers", string.Join(",", remoteEpisode.Episodes.Select(e => e.AbsoluteEpisodeNumber)));
|
|
||||||
variables.Add("Sonarr_Release_EpisodeAirDates", string.Join(",", remoteEpisode.Episodes.Select(e => e.AirDate)));
|
|
||||||
variables.Add("Sonarr_Release_EpisodeAirDatesUtc", string.Join(",", remoteEpisode.Episodes.Select(e => e.AirDateUtc)));
|
|
||||||
variables.Add("Sonarr_Release_EpisodeTitles", string.Join("|", remoteEpisode.Episodes.Select(e => e.Title)));
|
|
||||||
variables.Add("Sonarr_Release_Title", remoteEpisode.Release.Title);
|
|
||||||
variables.Add("Sonarr_Release_Indexer", remoteEpisode.Release.Indexer ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_Release_Size", remoteEpisode.Release.Size.ToString());
|
|
||||||
variables.Add("Sonarr_Release_Quality", remoteEpisode.ParsedEpisodeInfo.Quality.Quality.Name);
|
|
||||||
variables.Add("Sonarr_Release_QualityVersion", remoteEpisode.ParsedEpisodeInfo.Quality.Revision.Version.ToString());
|
|
||||||
variables.Add("Sonarr_Release_ReleaseGroup", releaseGroup ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_Download_Client", message.DownloadClientName ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_Download_Client_Type", message.DownloadClientType ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_Download_Id", message.DownloadId ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_Release_CustomFormat", string.Join("|", remoteEpisode.CustomFormats));
|
|
||||||
variables.Add("Sonarr_Release_CustomFormatScore", remoteEpisode.CustomFormatScore.ToString());
|
|
||||||
|
|
||||||
_proxy.SendNotification(variables, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDownload(DownloadMessage message)
|
public override void OnDownload(DownloadMessage message)
|
||||||
{
|
{
|
||||||
var series = message.Series;
|
_proxy.SendNotification(BuildOnDownloadPayload(message), Settings);
|
||||||
var episodeFile = message.EpisodeFile;
|
|
||||||
var sourcePath = message.SourcePath;
|
|
||||||
var variables = new StringDictionary();
|
|
||||||
|
|
||||||
variables.Add("Sonarr_EventType", "Download");
|
|
||||||
variables.Add("Sonarr_IsUpgrade", message.OldFiles.Any().ToString());
|
|
||||||
variables.Add("Sonarr_Series_Id", series.Id.ToString());
|
|
||||||
variables.Add("Sonarr_Series_Title", series.Title);
|
|
||||||
variables.Add("Sonarr_Series_Path", series.Path);
|
|
||||||
variables.Add("Sonarr_Series_TvdbId", series.TvdbId.ToString());
|
|
||||||
variables.Add("Sonarr_Series_TvMazeId", series.TvMazeId.ToString());
|
|
||||||
variables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_Id", episodeFile.Id.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_EpisodeCount", episodeFile.Episodes.Value.Count.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_RelativePath", episodeFile.RelativePath);
|
|
||||||
variables.Add("Sonarr_EpisodeFile_Path", Path.Combine(series.Path, episodeFile.RelativePath));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_EpisodeIds", string.Join(",", episodeFile.Episodes.Value.Select(e => e.Id)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_SeasonNumber", episodeFile.SeasonNumber.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_EpisodeNumbers", string.Join(",", episodeFile.Episodes.Value.Select(e => e.EpisodeNumber)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_EpisodeAirDates", string.Join(",", episodeFile.Episodes.Value.Select(e => e.AirDate)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_EpisodeAirDatesUtc", string.Join(",", episodeFile.Episodes.Value.Select(e => e.AirDateUtc)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_EpisodeTitles", string.Join("|", episodeFile.Episodes.Value.Select(e => e.Title)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_Quality", episodeFile.Quality.Quality.Name);
|
|
||||||
variables.Add("Sonarr_EpisodeFile_QualityVersion", episodeFile.Quality.Revision.Version.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_ReleaseGroup", episodeFile.ReleaseGroup ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_EpisodeFile_SceneName", episodeFile.SceneName ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_EpisodeFile_SourcePath", sourcePath);
|
|
||||||
variables.Add("Sonarr_EpisodeFile_SourceFolder", Path.GetDirectoryName(sourcePath));
|
|
||||||
variables.Add("Sonarr_Download_Client", message.DownloadClientInfo?.Name ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_Download_Client_Type", message.DownloadClientInfo?.Type ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_Download_Id", message.DownloadId ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_EpisodeFile_MediaInfo_AudioChannels", MediaInfoFormatter.FormatAudioChannels(episodeFile.MediaInfo).ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_MediaInfo_AudioCodec", MediaInfoFormatter.FormatAudioCodec(episodeFile.MediaInfo, null));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_MediaInfo_AudioLanguages", episodeFile.MediaInfo.AudioLanguages.Distinct().ConcatToString(" / "));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_MediaInfo_Languages", episodeFile.MediaInfo.AudioLanguages.ConcatToString(" / "));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_MediaInfo_Height", episodeFile.MediaInfo.Height.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_MediaInfo_Width", episodeFile.MediaInfo.Width.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_MediaInfo_Subtitles", episodeFile.MediaInfo.Subtitles.ConcatToString(" / "));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_MediaInfo_VideoCodec", MediaInfoFormatter.FormatVideoCodec(episodeFile.MediaInfo, null));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_MediaInfo_VideoDynamicRangeType", MediaInfoFormatter.FormatVideoDynamicRangeType(episodeFile.MediaInfo));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_CustomFormat", string.Join("|", message.EpisodeInfo.CustomFormats));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_CustomFormatScore", message.EpisodeInfo.CustomFormatScore.ToString());
|
|
||||||
|
|
||||||
if (message.OldFiles.Any())
|
|
||||||
{
|
|
||||||
variables.Add("Sonarr_DeletedRelativePaths", string.Join("|", message.OldFiles.Select(e => e.RelativePath)));
|
|
||||||
variables.Add("Sonarr_DeletedPaths", string.Join("|", message.OldFiles.Select(e => Path.Combine(series.Path, e.RelativePath))));
|
|
||||||
variables.Add("Sonarr_DeletedDateAdded", string.Join("|", message.OldFiles.Select(e => e.DateAdded)));
|
|
||||||
}
|
|
||||||
|
|
||||||
_proxy.SendNotification(variables, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnRename(Series series, List<RenamedEpisodeFile> renamedFiles)
|
public override void OnRename(Series series, List<RenamedEpisodeFile> renamedFiles)
|
||||||
{
|
{
|
||||||
var variables = new StringDictionary();
|
_proxy.SendNotification(BuildOnRenamePayload(series, renamedFiles), Settings);
|
||||||
|
|
||||||
variables.Add("Sonarr_EventType", "Rename");
|
|
||||||
variables.Add("Sonarr_Series_Id", series.Id.ToString());
|
|
||||||
variables.Add("Sonarr_Series_Title", series.Title);
|
|
||||||
variables.Add("Sonarr_Series_Path", series.Path);
|
|
||||||
variables.Add("Sonarr_Series_TvdbId", series.TvdbId.ToString());
|
|
||||||
variables.Add("Sonarr_Series_TvMazeId", series.TvMazeId.ToString());
|
|
||||||
variables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_Ids", string.Join(",", renamedFiles.Select(e => e.EpisodeFile.Id)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_RelativePaths", string.Join("|", renamedFiles.Select(e => e.EpisodeFile.RelativePath)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_Paths", string.Join("|", renamedFiles.Select(e => e.EpisodeFile.Path)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_PreviousRelativePaths", string.Join("|", renamedFiles.Select(e => e.PreviousRelativePath)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_PreviousPaths", string.Join("|", renamedFiles.Select(e => e.PreviousPath)));
|
|
||||||
|
|
||||||
_proxy.SendNotification(variables, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEpisodeFileDelete(EpisodeDeleteMessage deleteMessage)
|
public override void OnEpisodeFileDelete(EpisodeDeleteMessage deleteMessage)
|
||||||
{
|
{
|
||||||
var series = deleteMessage.Series;
|
_proxy.SendNotification(BuildOnEpisodeFileDelete(deleteMessage), Settings);
|
||||||
var episodeFile = deleteMessage.EpisodeFile;
|
|
||||||
|
|
||||||
var variables = new StringDictionary();
|
|
||||||
|
|
||||||
variables.Add("Sonarr_EventType", "EpisodeFileDelete");
|
|
||||||
variables.Add("Sonarr_EpisodeFile_DeleteReason", deleteMessage.Reason.ToString());
|
|
||||||
variables.Add("Sonarr_Series_Id", series.Id.ToString());
|
|
||||||
variables.Add("Sonarr_Series_Title", series.Title);
|
|
||||||
variables.Add("Sonarr_Series_Path", series.Path);
|
|
||||||
variables.Add("Sonarr_Series_TvdbId", series.TvdbId.ToString());
|
|
||||||
variables.Add("Sonarr_Series_TvMazeId", series.TvMazeId.ToString());
|
|
||||||
variables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_Id", episodeFile.Id.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_EpisodeCount", episodeFile.Episodes.Value.Count.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_RelativePath", episodeFile.RelativePath);
|
|
||||||
variables.Add("Sonarr_EpisodeFile_Path", Path.Combine(series.Path, episodeFile.RelativePath));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_EpisodeIds", string.Join(",", episodeFile.Episodes.Value.Select(e => e.Id)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_SeasonNumber", episodeFile.SeasonNumber.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_EpisodeNumbers", string.Join(",", episodeFile.Episodes.Value.Select(e => e.EpisodeNumber)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_EpisodeAirDates", string.Join(",", episodeFile.Episodes.Value.Select(e => e.AirDate)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_EpisodeAirDatesUtc", string.Join(",", episodeFile.Episodes.Value.Select(e => e.AirDateUtc)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_EpisodeTitles", string.Join("|", episodeFile.Episodes.Value.Select(e => e.Title)));
|
|
||||||
variables.Add("Sonarr_EpisodeFile_Quality", episodeFile.Quality.Quality.Name);
|
|
||||||
variables.Add("Sonarr_EpisodeFile_QualityVersion", episodeFile.Quality.Revision.Version.ToString());
|
|
||||||
variables.Add("Sonarr_EpisodeFile_ReleaseGroup", episodeFile.ReleaseGroup ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_EpisodeFile_SceneName", episodeFile.SceneName ?? string.Empty);
|
|
||||||
|
|
||||||
_proxy.SendNotification(variables, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||||
{
|
{
|
||||||
var series = deleteMessage.Series;
|
_proxy.SendNotification(BuildOnSeriesDelete(deleteMessage), Settings);
|
||||||
var variables = new StringDictionary();
|
|
||||||
|
|
||||||
variables.Add("Sonarr_EventType", "SeriesDelete");
|
|
||||||
variables.Add("Sonarr_Series_Id", series.Id.ToString());
|
|
||||||
variables.Add("Sonarr_Series_Title", series.Title);
|
|
||||||
variables.Add("Sonarr_Series_Path", series.Path);
|
|
||||||
variables.Add("Sonarr_Series_TvdbId", series.TvdbId.ToString());
|
|
||||||
variables.Add("Sonarr_Series_TvMazeId", series.TvMazeId.ToString());
|
|
||||||
variables.Add("Sonarr_Series_ImdbId", series.ImdbId ?? string.Empty);
|
|
||||||
variables.Add("Sonarr_Series_Type", series.SeriesType.ToString());
|
|
||||||
variables.Add("Sonarr_Series_DeletedFiles", deleteMessage.DeletedFiles.ToString());
|
|
||||||
|
|
||||||
_proxy.SendNotification(variables, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
|
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
|
||||||
{
|
{
|
||||||
var variables = new StringDictionary();
|
_proxy.SendNotification(BuildHealthPayload(healthCheck), Settings);
|
||||||
|
|
||||||
variables.Add("Sonarr_EventType", "HealthIssue");
|
|
||||||
variables.Add("Sonarr_Health_Issue_Level", Enum.GetName(typeof(HealthCheckResult), healthCheck.Type));
|
|
||||||
variables.Add("Sonarr_Health_Issue_Message", healthCheck.Message);
|
|
||||||
variables.Add("Sonarr_Health_Issue_Type", healthCheck.Source.Name);
|
|
||||||
variables.Add("Sonarr_Health_Issue_Wiki", healthCheck.WikiUrl.ToString() ?? string.Empty);
|
|
||||||
|
|
||||||
_proxy.SendNotification(variables, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
|
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
|
||||||
{
|
{
|
||||||
var variables = new StringDictionary();
|
_proxy.SendNotification(BuildApplicationUpdatePayload(updateMessage), Settings);
|
||||||
|
|
||||||
variables.Add("Sonarr_EventType", "ApplicationUpdate");
|
|
||||||
variables.Add("Sonarr_Update_Message", updateMessage.Message);
|
|
||||||
variables.Add("Sonarr_Update_NewVersion", updateMessage.NewVersion.ToString());
|
|
||||||
variables.Add("Sonarr_Update_PreviousVersion", updateMessage.PreviousVersion.ToString());
|
|
||||||
|
|
||||||
_proxy.SendNotification(variables, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ValidationResult Test()
|
public override ValidationResult Test()
|
||||||
{
|
{
|
||||||
var failures = new List<ValidationFailure>();
|
var failures = new List<ValidationFailure>();
|
||||||
|
|
||||||
failures.AddIfNotNull(_proxy.Test(Settings));
|
failures.AddIfNotNull(SendWebhookTest());
|
||||||
|
|
||||||
return new ValidationResult(failures);
|
return new ValidationResult(failures);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ValidationFailure SendWebhookTest()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_proxy.SendNotification(BuildTestPayload(), Settings);
|
||||||
|
}
|
||||||
|
catch (NotifiarrException ex)
|
||||||
|
{
|
||||||
|
return new NzbDroneValidationFailure("APIKey", ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,81 +1,46 @@
|
||||||
using System;
|
using System.Net.Http;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using FluentValidation.Results;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Extensions;
|
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Common.Serializer;
|
||||||
|
using NzbDrone.Core.Notifications.Webhook;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Notifications.Notifiarr
|
namespace NzbDrone.Core.Notifications.Notifiarr
|
||||||
{
|
{
|
||||||
public interface INotifiarrProxy
|
public interface INotifiarrProxy
|
||||||
{
|
{
|
||||||
void SendNotification(StringDictionary message, NotifiarrSettings settings);
|
void SendNotification(WebhookPayload payload, NotifiarrSettings settings);
|
||||||
ValidationFailure Test(NotifiarrSettings settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NotifiarrProxy : INotifiarrProxy
|
public class NotifiarrProxy : INotifiarrProxy
|
||||||
{
|
{
|
||||||
private const string URL = "https://notifiarr.com";
|
private const string URL = "https://notifiarr.com";
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
private readonly IConfigFileProvider _configFileProvider;
|
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public NotifiarrProxy(IHttpClient httpClient, IConfigFileProvider configFileProvider, Logger logger)
|
public NotifiarrProxy(IHttpClient httpClient, Logger logger)
|
||||||
{
|
{
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
_configFileProvider = configFileProvider;
|
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendNotification(StringDictionary message, NotifiarrSettings settings)
|
public void SendNotification(WebhookPayload payload, NotifiarrSettings settings)
|
||||||
{
|
{
|
||||||
try
|
ProcessNotification(payload, settings);
|
||||||
{
|
|
||||||
ProcessNotification(message, settings);
|
|
||||||
}
|
|
||||||
catch (NotifiarrException ex)
|
|
||||||
{
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValidationFailure Test(NotifiarrSettings settings)
|
private void ProcessNotification(WebhookPayload payload, NotifiarrSettings settings)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var variables = new StringDictionary();
|
var request = new HttpRequestBuilder(URL + "/api/v1/notification/sonarr")
|
||||||
variables.Add("Sonarr_EventType", "Test");
|
.Accept(HttpAccept.Json)
|
||||||
|
.SetHeader("X-API-Key", settings.ApiKey)
|
||||||
|
.Build();
|
||||||
|
|
||||||
SendNotification(variables, settings);
|
request.Method = HttpMethod.Post;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (NotifiarrException ex)
|
|
||||||
{
|
|
||||||
return new ValidationFailure("ApiKey", ex.Message);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.Error(ex, ex.Message);
|
|
||||||
return new ValidationFailure(string.Empty, "$Unable to send test notification: {ex.Message}. Check the log surrounding this error for details");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ProcessNotification(StringDictionary message, NotifiarrSettings settings)
|
request.Headers.ContentType = "application/json";
|
||||||
{
|
request.SetContent(payload.ToJson());
|
||||||
try
|
|
||||||
{
|
|
||||||
var instanceName = _configFileProvider.InstanceName;
|
|
||||||
var requestBuilder = new HttpRequestBuilder(URL + "/api/v1/notification/sonarr").Post();
|
|
||||||
requestBuilder.AddFormParameter("instanceName", instanceName).Build();
|
|
||||||
requestBuilder.SetHeader("X-API-Key", settings.ApiKey);
|
|
||||||
|
|
||||||
foreach (string key in message.Keys)
|
|
||||||
{
|
|
||||||
requestBuilder.AddFormParameter(key, message[key]);
|
|
||||||
}
|
|
||||||
|
|
||||||
var request = requestBuilder.Build();
|
|
||||||
|
|
||||||
_httpClient.Post(request);
|
_httpClient.Post(request);
|
||||||
}
|
}
|
||||||
|
@ -85,22 +50,21 @@ namespace NzbDrone.Core.Notifications.Notifiarr
|
||||||
switch ((int)responseCode)
|
switch ((int)responseCode)
|
||||||
{
|
{
|
||||||
case 401:
|
case 401:
|
||||||
_logger.Error("Unauthorized", "HTTP 401 - API key is invalid");
|
_logger.Error("HTTP 401 - API key is invalid");
|
||||||
throw new NotifiarrException("API key is invalid");
|
throw new NotifiarrException("API key is invalid");
|
||||||
case 400:
|
case 400:
|
||||||
_logger.Error("Invalid Request", "HTTP 400 - Unable to send notification. Ensure Sonarr Integration is enabled & assigned a channel on Notifiarr");
|
_logger.Error("HTTP 400 - Unable to send notification. Ensure Sonarr Integration is enabled & assigned a channel on Notifiarr");
|
||||||
throw new NotifiarrException("Unable to send notification. Ensure Sonarr Integration is enabled & assigned a channel on Notifiarr");
|
throw new NotifiarrException("Unable to send notification. Ensure Sonarr Integration is enabled & assigned a channel on Notifiarr");
|
||||||
case 502:
|
case 502:
|
||||||
case 503:
|
case 503:
|
||||||
case 504:
|
case 504:
|
||||||
_logger.Error("Service Unavailable", "Unable to send notification. Service Unavailable");
|
_logger.Error("Unable to send notification. Service Unavailable");
|
||||||
throw new NotifiarrException("Unable to send notification. Service Unavailable", ex);
|
throw new NotifiarrException("Unable to send notification. Service Unavailable", ex);
|
||||||
case 520:
|
case 520:
|
||||||
case 521:
|
case 521:
|
||||||
case 522:
|
case 522:
|
||||||
case 523:
|
case 523:
|
||||||
case 524:
|
case 524:
|
||||||
_logger.Error(ex, "Cloudflare Related HTTP Error - Unable to send notification");
|
|
||||||
throw new NotifiarrException("Cloudflare Related HTTP Error - Unable to send notification", ex);
|
throw new NotifiarrException("Cloudflare Related HTTP Error - Unable to send notification", ex);
|
||||||
default:
|
default:
|
||||||
_logger.Error(ex, "Unknown HTTP Error - Unable to send notification");
|
_logger.Error(ex, "Unknown HTTP Error - Unable to send notification");
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using FluentValidation.Results;
|
using FluentValidation.Results;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
|
@ -10,18 +8,13 @@ using NzbDrone.Core.Validation;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Notifications.Webhook
|
namespace NzbDrone.Core.Notifications.Webhook
|
||||||
{
|
{
|
||||||
public class Webhook : NotificationBase<WebhookSettings>
|
public class Webhook : WebhookBase<WebhookSettings>
|
||||||
{
|
{
|
||||||
private readonly IConfigFileProvider _configFileProvider;
|
|
||||||
private readonly IConfigService _configService;
|
|
||||||
private readonly IWebhookProxy _proxy;
|
private readonly IWebhookProxy _proxy;
|
||||||
|
|
||||||
public Webhook(IConfigFileProvider configFileProvider,
|
public Webhook(IWebhookProxy proxy, IConfigFileProvider configFileProvider, IConfigService configService)
|
||||||
IConfigService configService,
|
: base(configFileProvider, configService)
|
||||||
IWebhookProxy proxy)
|
|
||||||
{
|
{
|
||||||
_configFileProvider = configFileProvider;
|
|
||||||
_configService = configService;
|
|
||||||
_proxy = proxy;
|
_proxy = proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,129 +22,37 @@ namespace NzbDrone.Core.Notifications.Webhook
|
||||||
|
|
||||||
public override void OnGrab(GrabMessage message)
|
public override void OnGrab(GrabMessage message)
|
||||||
{
|
{
|
||||||
var remoteEpisode = message.Episode;
|
_proxy.SendWebhook(BuildOnGrabPayload(message), Settings);
|
||||||
var quality = message.Quality;
|
|
||||||
|
|
||||||
var payload = new WebhookGrabPayload
|
|
||||||
{
|
|
||||||
EventType = WebhookEventType.Grab,
|
|
||||||
InstanceName = _configFileProvider.InstanceName,
|
|
||||||
ApplicationUrl = _configService.ApplicationUrl,
|
|
||||||
Series = new WebhookSeries(message.Series),
|
|
||||||
Episodes = remoteEpisode.Episodes.ConvertAll(x => new WebhookEpisode(x)),
|
|
||||||
Release = new WebhookRelease(quality, remoteEpisode),
|
|
||||||
DownloadClient = message.DownloadClientName,
|
|
||||||
DownloadClientType = message.DownloadClientType,
|
|
||||||
DownloadId = message.DownloadId,
|
|
||||||
CustomFormatInfo = new WebhookCustomFormatInfo(remoteEpisode.CustomFormats, remoteEpisode.CustomFormatScore)
|
|
||||||
};
|
|
||||||
|
|
||||||
_proxy.SendWebhook(payload, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDownload(DownloadMessage message)
|
public override void OnDownload(DownloadMessage message)
|
||||||
{
|
{
|
||||||
var episodeFile = message.EpisodeFile;
|
_proxy.SendWebhook(BuildOnDownloadPayload(message), Settings);
|
||||||
|
|
||||||
var payload = new WebhookImportPayload
|
|
||||||
{
|
|
||||||
EventType = WebhookEventType.Download,
|
|
||||||
InstanceName = _configFileProvider.InstanceName,
|
|
||||||
ApplicationUrl = _configService.ApplicationUrl,
|
|
||||||
Series = new WebhookSeries(message.Series),
|
|
||||||
Episodes = episodeFile.Episodes.Value.ConvertAll(x => new WebhookEpisode(x)),
|
|
||||||
EpisodeFile = new WebhookEpisodeFile(episodeFile),
|
|
||||||
IsUpgrade = message.OldFiles.Any(),
|
|
||||||
DownloadClient = message.DownloadClientInfo?.Name,
|
|
||||||
DownloadClientType = message.DownloadClientInfo?.Type,
|
|
||||||
DownloadId = message.DownloadId,
|
|
||||||
CustomFormatInfo = new WebhookCustomFormatInfo(message.EpisodeInfo.CustomFormats, message.EpisodeInfo.CustomFormatScore)
|
|
||||||
};
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnRename(Series series, List<RenamedEpisodeFile> renamedFiles)
|
public override void OnRename(Series series, List<RenamedEpisodeFile> renamedFiles)
|
||||||
{
|
{
|
||||||
var payload = new WebhookRenamePayload
|
_proxy.SendWebhook(BuildOnRenamePayload(series, renamedFiles), Settings);
|
||||||
{
|
|
||||||
EventType = WebhookEventType.Rename,
|
|
||||||
InstanceName = _configFileProvider.InstanceName,
|
|
||||||
ApplicationUrl = _configService.ApplicationUrl,
|
|
||||||
Series = new WebhookSeries(series),
|
|
||||||
RenamedEpisodeFiles = renamedFiles.ConvertAll(x => new WebhookRenamedEpisodeFile(x))
|
|
||||||
};
|
|
||||||
|
|
||||||
_proxy.SendWebhook(payload, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnEpisodeFileDelete(EpisodeDeleteMessage deleteMessage)
|
public override void OnEpisodeFileDelete(EpisodeDeleteMessage deleteMessage)
|
||||||
{
|
{
|
||||||
var payload = new WebhookEpisodeDeletePayload
|
_proxy.SendWebhook(BuildOnEpisodeFileDelete(deleteMessage), Settings);
|
||||||
{
|
|
||||||
EventType = WebhookEventType.EpisodeFileDelete,
|
|
||||||
InstanceName = _configFileProvider.InstanceName,
|
|
||||||
ApplicationUrl = _configService.ApplicationUrl,
|
|
||||||
Series = new WebhookSeries(deleteMessage.Series),
|
|
||||||
Episodes = deleteMessage.EpisodeFile.Episodes.Value.ConvertAll(x => new WebhookEpisode(x)),
|
|
||||||
EpisodeFile = deleteMessage.EpisodeFile,
|
|
||||||
DeleteReason = deleteMessage.Reason
|
|
||||||
};
|
|
||||||
|
|
||||||
_proxy.SendWebhook(payload, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
public override void OnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||||
{
|
{
|
||||||
var payload = new WebhookSeriesDeletePayload
|
_proxy.SendWebhook(BuildOnSeriesDelete(deleteMessage), Settings);
|
||||||
{
|
|
||||||
EventType = WebhookEventType.SeriesDelete,
|
|
||||||
InstanceName = _configFileProvider.InstanceName,
|
|
||||||
ApplicationUrl = _configService.ApplicationUrl,
|
|
||||||
Series = new WebhookSeries(deleteMessage.Series),
|
|
||||||
DeletedFiles = deleteMessage.DeletedFiles
|
|
||||||
};
|
|
||||||
|
|
||||||
_proxy.SendWebhook(payload, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
|
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
|
||||||
{
|
{
|
||||||
var payload = new WebhookHealthPayload
|
_proxy.SendWebhook(BuildHealthPayload(healthCheck), Settings);
|
||||||
{
|
|
||||||
EventType = WebhookEventType.Health,
|
|
||||||
InstanceName = _configFileProvider.InstanceName,
|
|
||||||
ApplicationUrl = _configService.ApplicationUrl,
|
|
||||||
Level = healthCheck.Type,
|
|
||||||
Message = healthCheck.Message,
|
|
||||||
Type = healthCheck.Source.Name,
|
|
||||||
WikiUrl = healthCheck.WikiUrl?.ToString()
|
|
||||||
};
|
|
||||||
|
|
||||||
_proxy.SendWebhook(payload, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
|
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
|
||||||
{
|
{
|
||||||
var payload = new WebhookApplicationUpdatePayload
|
_proxy.SendWebhook(BuildApplicationUpdatePayload(updateMessage), Settings);
|
||||||
{
|
|
||||||
EventType = WebhookEventType.ApplicationUpdate,
|
|
||||||
InstanceName = _configFileProvider.InstanceName,
|
|
||||||
ApplicationUrl = _configService.ApplicationUrl,
|
|
||||||
Message = updateMessage.Message,
|
|
||||||
PreviousVersion = updateMessage.PreviousVersion.ToString(),
|
|
||||||
NewVersion = updateMessage.NewVersion.ToString()
|
|
||||||
};
|
|
||||||
|
|
||||||
_proxy.SendWebhook(payload, Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Name => "Webhook";
|
public override string Name => "Webhook";
|
||||||
|
@ -169,31 +70,7 @@ namespace NzbDrone.Core.Notifications.Webhook
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var payload = new WebhookGrabPayload
|
_proxy.SendWebhook(BuildTestPayload(), Settings);
|
||||||
{
|
|
||||||
EventType = WebhookEventType.Test,
|
|
||||||
InstanceName = _configFileProvider.InstanceName,
|
|
||||||
ApplicationUrl = _configService.ApplicationUrl,
|
|
||||||
Series = new WebhookSeries()
|
|
||||||
{
|
|
||||||
Id = 1,
|
|
||||||
Title = "Test Title",
|
|
||||||
Path = "C:\\testpath",
|
|
||||||
TvdbId = 1234
|
|
||||||
},
|
|
||||||
Episodes = new List<WebhookEpisode>()
|
|
||||||
{
|
|
||||||
new WebhookEpisode()
|
|
||||||
{
|
|
||||||
Id = 123,
|
|
||||||
EpisodeNumber = 1,
|
|
||||||
SeasonNumber = 1,
|
|
||||||
Title = "Test title"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_proxy.SendWebhook(payload, Settings);
|
|
||||||
}
|
}
|
||||||
catch (WebhookException ex)
|
catch (WebhookException ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,163 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
|
using NzbDrone.Core.MediaFiles;
|
||||||
|
using NzbDrone.Core.ThingiProvider;
|
||||||
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Notifications.Webhook
|
||||||
|
{
|
||||||
|
public abstract class WebhookBase<TSettings> : NotificationBase<TSettings>
|
||||||
|
where TSettings : IProviderConfig, new()
|
||||||
|
{
|
||||||
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
|
private readonly IConfigService _configService;
|
||||||
|
|
||||||
|
protected WebhookBase(IConfigFileProvider configFileProvider, IConfigService configService)
|
||||||
|
{
|
||||||
|
_configFileProvider = configFileProvider;
|
||||||
|
_configService = configService;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebhookGrabPayload BuildOnGrabPayload(GrabMessage message)
|
||||||
|
{
|
||||||
|
var remoteEpisode = message.Episode;
|
||||||
|
var quality = message.Quality;
|
||||||
|
|
||||||
|
return new WebhookGrabPayload
|
||||||
|
{
|
||||||
|
EventType = WebhookEventType.Grab,
|
||||||
|
InstanceName = _configFileProvider.InstanceName,
|
||||||
|
ApplicationUrl = _configService.ApplicationUrl,
|
||||||
|
Series = new WebhookSeries(message.Series),
|
||||||
|
Episodes = remoteEpisode.Episodes.ConvertAll(x => new WebhookEpisode(x)),
|
||||||
|
Release = new WebhookRelease(quality, remoteEpisode),
|
||||||
|
DownloadClient = message.DownloadClientName,
|
||||||
|
DownloadClientType = message.DownloadClientType,
|
||||||
|
DownloadId = message.DownloadId,
|
||||||
|
CustomFormatInfo = new WebhookCustomFormatInfo(remoteEpisode.CustomFormats, remoteEpisode.CustomFormatScore)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebhookImportPayload BuildOnDownloadPayload(DownloadMessage message)
|
||||||
|
{
|
||||||
|
var episodeFile = message.EpisodeFile;
|
||||||
|
|
||||||
|
var payload = new WebhookImportPayload
|
||||||
|
{
|
||||||
|
EventType = WebhookEventType.Download,
|
||||||
|
InstanceName = _configFileProvider.InstanceName,
|
||||||
|
ApplicationUrl = _configService.ApplicationUrl,
|
||||||
|
Series = new WebhookSeries(message.Series),
|
||||||
|
Episodes = episodeFile.Episodes.Value.ConvertAll(x => new WebhookEpisode(x)),
|
||||||
|
EpisodeFile = new WebhookEpisodeFile(episodeFile),
|
||||||
|
IsUpgrade = message.OldFiles.Any(),
|
||||||
|
DownloadClient = message.DownloadClientInfo?.Name,
|
||||||
|
DownloadClientType = message.DownloadClientInfo?.Type,
|
||||||
|
DownloadId = message.DownloadId,
|
||||||
|
CustomFormatInfo = new WebhookCustomFormatInfo(message.EpisodeInfo.CustomFormats, message.EpisodeInfo.CustomFormatScore)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (message.OldFiles.Any())
|
||||||
|
{
|
||||||
|
payload.DeletedFiles = message.OldFiles.ConvertAll(x => new WebhookEpisodeFile(x)
|
||||||
|
{
|
||||||
|
Path = Path.Combine(message.Series.Path, x.RelativePath)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebhookEpisodeDeletePayload BuildOnEpisodeFileDelete(EpisodeDeleteMessage deleteMessage)
|
||||||
|
{
|
||||||
|
return new WebhookEpisodeDeletePayload
|
||||||
|
{
|
||||||
|
EventType = WebhookEventType.EpisodeFileDelete,
|
||||||
|
InstanceName = _configFileProvider.InstanceName,
|
||||||
|
ApplicationUrl = _configService.ApplicationUrl,
|
||||||
|
Series = new WebhookSeries(deleteMessage.Series),
|
||||||
|
Episodes = deleteMessage.EpisodeFile.Episodes.Value.ConvertAll(x => new WebhookEpisode(x)),
|
||||||
|
EpisodeFile = deleteMessage.EpisodeFile,
|
||||||
|
DeleteReason = deleteMessage.Reason
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebhookSeriesDeletePayload BuildOnSeriesDelete(SeriesDeleteMessage deleteMessage)
|
||||||
|
{
|
||||||
|
return new WebhookSeriesDeletePayload
|
||||||
|
{
|
||||||
|
EventType = WebhookEventType.SeriesDelete,
|
||||||
|
InstanceName = _configFileProvider.InstanceName,
|
||||||
|
ApplicationUrl = _configService.ApplicationUrl,
|
||||||
|
Series = new WebhookSeries(deleteMessage.Series),
|
||||||
|
DeletedFiles = deleteMessage.DeletedFiles
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebhookRenamePayload BuildOnRenamePayload(Series series, List<RenamedEpisodeFile> renamedFiles)
|
||||||
|
{
|
||||||
|
return new WebhookRenamePayload
|
||||||
|
{
|
||||||
|
EventType = WebhookEventType.Rename,
|
||||||
|
InstanceName = _configFileProvider.InstanceName,
|
||||||
|
ApplicationUrl = _configService.ApplicationUrl,
|
||||||
|
Series = new WebhookSeries(series),
|
||||||
|
RenamedEpisodeFiles = renamedFiles.ConvertAll(x => new WebhookRenamedEpisodeFile(x))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebhookHealthPayload BuildHealthPayload(HealthCheck.HealthCheck healthCheck)
|
||||||
|
{
|
||||||
|
return new WebhookHealthPayload
|
||||||
|
{
|
||||||
|
EventType = WebhookEventType.Health,
|
||||||
|
InstanceName = _configFileProvider.InstanceName,
|
||||||
|
Level = healthCheck.Type,
|
||||||
|
Message = healthCheck.Message,
|
||||||
|
Type = healthCheck.Source.Name,
|
||||||
|
WikiUrl = healthCheck.WikiUrl?.ToString()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebhookApplicationUpdatePayload BuildApplicationUpdatePayload(ApplicationUpdateMessage updateMessage)
|
||||||
|
{
|
||||||
|
return new WebhookApplicationUpdatePayload
|
||||||
|
{
|
||||||
|
EventType = WebhookEventType.ApplicationUpdate,
|
||||||
|
InstanceName = _configFileProvider.InstanceName,
|
||||||
|
Message = updateMessage.Message,
|
||||||
|
PreviousVersion = updateMessage.PreviousVersion.ToString(),
|
||||||
|
NewVersion = updateMessage.NewVersion.ToString()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebhookPayload BuildTestPayload()
|
||||||
|
{
|
||||||
|
return new WebhookGrabPayload
|
||||||
|
{
|
||||||
|
EventType = WebhookEventType.Test,
|
||||||
|
InstanceName = _configFileProvider.InstanceName,
|
||||||
|
ApplicationUrl = _configService.ApplicationUrl,
|
||||||
|
Series = new WebhookSeries()
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Title = "Test Title",
|
||||||
|
Path = "C:\\testpath",
|
||||||
|
TvdbId = 1234
|
||||||
|
},
|
||||||
|
Episodes = new List<WebhookEpisode>()
|
||||||
|
{
|
||||||
|
new WebhookEpisode()
|
||||||
|
{
|
||||||
|
Id = 123,
|
||||||
|
EpisodeNumber = 1,
|
||||||
|
SeasonNumber = 1,
|
||||||
|
Title = "Test title"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue