Fixed: Ignore invalid tags in CustomScript/Discord/Webhook

pull/9735/head
Bogdan 9 months ago
parent 2510f44c25
commit 3d0f22ca7c

@ -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);

@ -625,7 +625,11 @@ namespace NzbDrone.Core.Notifications.Discord
private IEnumerable<string> 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);
}
}
}

@ -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<string> 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);
}
}
}

Loading…
Cancel
Save