From edec201a6c970469035b92a1567e7547b8f1a99f Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 31 Jul 2024 17:34:31 -0700 Subject: [PATCH] Improve messaging for for Send Notifications setting in Emby / Jellyfin (cherry picked from commit 4c0b8961741a7dd0cf2aba81cdbcb74c1208a1ff) Closes #10251 --- src/NzbDrone.Core/Localization/Core/en.json | 4 ++-- .../MediaBrowser/MediaBrowserProxy.cs | 18 +++++++++++++++++- .../MediaBrowser/MediaBrowserSettings.cs | 1 + 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index e5429e0ba..a0779b80c 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -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", diff --git a/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowserProxy.cs b/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowserProxy.cs index 2991dbf8f..8af5104ec 100644 --- a/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowserProxy.cs +++ b/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowserProxy.cs @@ -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 @@ namespace NzbDrone.Core.Notifications.Emby var path = "/Notifications/Admin"; var request = BuildRequest(path, settings); request.Headers.ContentType = "application/json"; + request.LogHttpError = false; request.SetContent(new { @@ -32,7 +34,21 @@ namespace NzbDrone.Core.Notifications.Emby 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 GetPaths(MediaBrowserSettings settings, Movie movie) diff --git a/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowserSettings.cs b/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowserSettings.cs index 88a587468..d8928e154 100644 --- a/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowserSettings.cs +++ b/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowserSettings.cs @@ -25,6 +25,7 @@ namespace NzbDrone.Core.Notifications.Emby public MediaBrowserSettings() { Port = 8096; + UpdateLibrary = true; } [FieldDefinition(0, Label = "Host")]