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
Jonas Stendahl 4 years ago committed by GitHub
parent d8e0fa6ac2
commit b254ee548d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -39,12 +39,12 @@ namespace NzbDrone.Core.Indexers.Torznab
protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo) protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo)
{ {
var torrentInfo = base.ProcessItem(item, releaseInfo) as TorrentInfo; var torrentInfo = base.ProcessItem(item, releaseInfo) as TorrentInfo;
if (GetImdbId(item) != null) var imdbId = GetImdbId(item);
{ int parsedImdbId;
if (torrentInfo != null)
if (imdbId != null && int.TryParse(imdbId, out parsedImdbId))
{ {
torrentInfo.ImdbId = int.Parse(GetImdbId(item).Substring(2)); torrentInfo.ImdbId = parsedImdbId;
}
} }
torrentInfo.IndexerFlags = GetFlags(item); torrentInfo.IndexerFlags = GetFlags(item);
@ -108,8 +108,8 @@ namespace NzbDrone.Core.Indexers.Torznab
protected virtual string GetImdbId(XElement item) protected virtual string GetImdbId(XElement item)
{ {
var imdbIdString = TryGetTorznabAttribute(item, "imdbid"); var imdbId = TryGetTorznabAttribute(item, "imdb");
return (!imdbIdString.IsNullOrWhiteSpace() ? imdbIdString.Substring(2) : null); return (!imdbId.IsNullOrWhiteSpace() ? imdbId : null);
} }
protected override string GetInfoHash(XElement item) protected override string GetInfoHash(XElement item)

Loading…
Cancel
Save