Fixed: Importing Plex RSS lists with invalid items (#6374)

This commit is contained in:
Bogdan 2024-01-19 07:42:51 +02:00 committed by GitHub
parent 8dd3b45c90
commit bfd24da2d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -3,18 +3,19 @@ using System.Xml.Linq;
using NLog; using NLog;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.ImportLists.Rss.Plex namespace NzbDrone.Core.ImportLists.Rss.Plex
{ {
public class PlexRssImportParser : RssImportBaseParser public class PlexRssImportParser : RssImportBaseParser
{ {
private readonly Logger _logger;
private static readonly Regex ImdbIdRegex = new (@"(tt\d{7,8})", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex ImdbIdRegex = new (@"(tt\d{7,8})", RegexOptions.IgnoreCase | RegexOptions.Compiled);
public PlexRssImportParser(Logger logger) public PlexRssImportParser(Logger logger)
: base(logger) : base(logger)
{ {
_logger = logger;
} }
protected override ImportListItemInfo ProcessItem(XElement item) protected override ImportListItemInfo ProcessItem(XElement item)
@ -53,7 +54,9 @@ namespace NzbDrone.Core.ImportLists.Rss.Plex
if (info.ImdbId.IsNullOrWhiteSpace() && info.TvdbId == 0 && info.TmdbId == 0) if (info.ImdbId.IsNullOrWhiteSpace() && info.TvdbId == 0 && info.TmdbId == 0)
{ {
throw new UnsupportedFeedException("Each item in the RSS feed must have a guid element with a IMDB ID, TVDB ID or TMDB ID"); _logger.Warn("Each item in the RSS feed must have a guid element with a IMDB ID, TVDB ID or TMDB ID: '{0}'", info.Title);
return null;
} }
return info; return info;