From b254ee548d119b3102ecbc2f51c80de132bf30f3 Mon Sep 17 00:00:00 2001 From: Jonas Stendahl Date: Tue, 11 Feb 2020 00:53:22 +0100 Subject: [PATCH] Fixed: IMDb ID handling for Torznab indexers (#4089) * Fix IMDb IDs * Fix type errors * Attribute is named imdb * Use TryParse instead * Use TryParse properly * Pass out keyword * Use variable instead of property --- .../Indexers/Torznab/TorznabRssParser.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Torznab/TorznabRssParser.cs b/src/NzbDrone.Core/Indexers/Torznab/TorznabRssParser.cs index f95f79478..ecfde2ef7 100644 --- a/src/NzbDrone.Core/Indexers/Torznab/TorznabRssParser.cs +++ b/src/NzbDrone.Core/Indexers/Torznab/TorznabRssParser.cs @@ -39,12 +39,12 @@ namespace NzbDrone.Core.Indexers.Torznab protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo) { var torrentInfo = base.ProcessItem(item, releaseInfo) as TorrentInfo; - if (GetImdbId(item) != null) + var imdbId = GetImdbId(item); + int parsedImdbId; + + if (imdbId != null && int.TryParse(imdbId, out parsedImdbId)) { - if (torrentInfo != null) - { - torrentInfo.ImdbId = int.Parse(GetImdbId(item).Substring(2)); - } + torrentInfo.ImdbId = parsedImdbId; } torrentInfo.IndexerFlags = GetFlags(item); @@ -108,8 +108,8 @@ namespace NzbDrone.Core.Indexers.Torznab protected virtual string GetImdbId(XElement item) { - var imdbIdString = TryGetTorznabAttribute(item, "imdbid"); - return (!imdbIdString.IsNullOrWhiteSpace() ? imdbIdString.Substring(2) : null); + var imdbId = TryGetTorznabAttribute(item, "imdb"); + return (!imdbId.IsNullOrWhiteSpace() ? imdbId : null); } protected override string GetInfoHash(XElement item)