diff --git a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs index dc0710f95..e3434d4d5 100755 --- a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs +++ b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs @@ -69,7 +69,7 @@ namespace NzbDrone.Core.Notifications.CustomScript environmentVariables.Add("Radarr_Movie_Year", movie.MovieMetadata.Value.Year.ToString()); environmentVariables.Add("Radarr_Movie_OriginalLanguage", IsoLanguages.Get(movie.MovieMetadata.Value.OriginalLanguage).ThreeLetterCode); environmentVariables.Add("Radarr_Movie_Genres", string.Join("|", movie.MovieMetadata.Value.Genres)); - environmentVariables.Add("Radarr_Movie_Tags", string.Join("|", movie.Tags.Select(t => _tagRepository.Get(t).Label))); + environmentVariables.Add("Radarr_Movie_Tags", string.Join("|", movie.Tags.Select(t => _tagRepository.Find(t)?.Label).Where(l => l.IsNotNullOrWhiteSpace()))); environmentVariables.Add("Radarr_Movie_ImdbId", movie.MovieMetadata.Value.ImdbId ?? string.Empty); environmentVariables.Add("Radarr_Movie_TmdbId", movie.MovieMetadata.Value.TmdbId.ToString()); environmentVariables.Add("Radarr_Movie_In_Cinemas_Date", movie.MovieMetadata.Value.InCinemas.ToString() ?? string.Empty); diff --git a/src/NzbDrone.Core/Notifications/Discord/Discord.cs b/src/NzbDrone.Core/Notifications/Discord/Discord.cs index 189064db6..e81fdae24 100644 --- a/src/NzbDrone.Core/Notifications/Discord/Discord.cs +++ b/src/NzbDrone.Core/Notifications/Discord/Discord.cs @@ -625,7 +625,11 @@ namespace NzbDrone.Core.Notifications.Discord private IEnumerable GetTagLabels(Movie movie) { - return movie.Tags?.Select(t => _tagRepository.Get(t)?.Label).OrderBy(t => t).Take(5); + return movie.Tags? + .Select(t => _tagRepository.Find(t)?.Label) + .Where(l => l.IsNotNullOrWhiteSpace()) + .OrderBy(l => l) + .Take(5); } } } diff --git a/src/NzbDrone.Core/Notifications/Webhook/WebhookBase.cs b/src/NzbDrone.Core/Notifications/Webhook/WebhookBase.cs index 128d574f0..1e5b2ae2a 100644 --- a/src/NzbDrone.Core/Notifications/Webhook/WebhookBase.cs +++ b/src/NzbDrone.Core/Notifications/Webhook/WebhookBase.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using NzbDrone.Common.Extensions; using NzbDrone.Core.Configuration; using NzbDrone.Core.Localization; using NzbDrone.Core.MediaFiles; @@ -253,7 +254,10 @@ namespace NzbDrone.Core.Notifications.Webhook private IEnumerable GetTagLabels(Movie movie) { - return movie.Tags?.Select(t => _tagRepository.Get(t)?.Label).OrderBy(t => t); + return movie.Tags? + .Select(t => _tagRepository.Find(t)?.Label) + .Where(l => l.IsNotNullOrWhiteSpace()) + .OrderBy(l => l); } } }