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

Fixed: Ignore invalid tags in CustomScript/Discord/Webhook

This commit is contained in:
Bogdan 2024-02-08 00:47:40 +02:00
parent 2510f44c25
commit 3d0f22ca7c
3 changed files with 11 additions and 3 deletions

View File

@ -69,7 +69,7 @@ public override void OnGrab(GrabMessage message)
environmentVariables.Add("Radarr_Movie_Year", movie.MovieMetadata.Value.Year.ToString()); 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_OriginalLanguage", IsoLanguages.Get(movie.MovieMetadata.Value.OriginalLanguage).ThreeLetterCode);
environmentVariables.Add("Radarr_Movie_Genres", string.Join("|", movie.MovieMetadata.Value.Genres)); 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_ImdbId", movie.MovieMetadata.Value.ImdbId ?? string.Empty);
environmentVariables.Add("Radarr_Movie_TmdbId", movie.MovieMetadata.Value.TmdbId.ToString()); environmentVariables.Add("Radarr_Movie_TmdbId", movie.MovieMetadata.Value.TmdbId.ToString());
environmentVariables.Add("Radarr_Movie_In_Cinemas_Date", movie.MovieMetadata.Value.InCinemas.ToString() ?? string.Empty); environmentVariables.Add("Radarr_Movie_In_Cinemas_Date", movie.MovieMetadata.Value.InCinemas.ToString() ?? string.Empty);

View File

@ -625,7 +625,11 @@ private string GetTitle(Movie movie)
private IEnumerable<string> GetTagLabels(Movie movie) 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);
} }
} }
} }

View File

@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Localization; using NzbDrone.Core.Localization;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
@ -253,7 +254,10 @@ protected WebhookPayload BuildTestPayload()
private IEnumerable<string> GetTagLabels(Movie movie) 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);
} }
} }
} }