1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-19 17:32:38 +01:00

Improve messaging for for Send Notifications setting in Emby / Jellyfin

(cherry picked from commit 4c0b8961741a7dd0cf2aba81cdbcb74c1208a1ff)

Closes #10251
This commit is contained in:
Mark McDowall 2024-07-31 17:34:31 -07:00 committed by Bogdan
parent 1e783bfe07
commit edec201a6c
3 changed files with 20 additions and 3 deletions

View File

@ -1076,8 +1076,8 @@
"NotificationsEmailSettingsUseEncryption": "Use Encryption",
"NotificationsEmailSettingsUseEncryptionHelpText": "Whether to prefer using encryption if configured on the server, to always use encryption via SSL (Port 465 only) or StartTLS (any other port) or to never use encryption",
"NotificationsEmbySettingsSendNotifications": "Send Notifications",
"NotificationsEmbySettingsSendNotificationsHelpText": "Have MediaBrowser send notifications to configured providers",
"NotificationsEmbySettingsUpdateLibraryHelpText": "Update Library on Import, Rename, or Delete?",
"NotificationsEmbySettingsSendNotificationsHelpText": "Have Emby send notifications to configured providers. Not supported on Jellyfin.",
"NotificationsEmbySettingsUpdateLibraryHelpText": "Update Library on Import, Rename, or Delete",
"NotificationsGotifySettingIncludeMoviePoster": "Include Movie Poster",
"NotificationsGotifySettingIncludeMoviePosterHelpText": "Include movie poster in message",
"NotificationsGotifySettingsAppToken": "App Token",

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using NLog;
using NzbDrone.Common.Http;
using NzbDrone.Common.Serializer;
@ -24,6 +25,7 @@ public void Notify(MediaBrowserSettings settings, string title, string message)
var path = "/Notifications/Admin";
var request = BuildRequest(path, settings);
request.Headers.ContentType = "application/json";
request.LogHttpError = false;
request.SetContent(new
{
@ -32,7 +34,21 @@ public void Notify(MediaBrowserSettings settings, string title, string message)
ImageUrl = "https://raw.github.com/Radarr/Radarr/develop/Logo/64.png"
}.ToJson());
ProcessRequest(request, settings);
try
{
ProcessRequest(request, settings);
}
catch (HttpException e)
{
if (e.Response.StatusCode == HttpStatusCode.NotFound)
{
_logger.Warn("Unable to send notification to Emby. If you're using Jellyfin disable 'Send Notifications'");
}
else
{
throw;
}
}
}
public HashSet<string> GetPaths(MediaBrowserSettings settings, Movie movie)

View File

@ -25,6 +25,7 @@ public class MediaBrowserSettings : NotificationSettingsBase<MediaBrowserSetting
public MediaBrowserSettings()
{
Port = 8096;
UpdateLibrary = true;
}
[FieldDefinition(0, Label = "Host")]