Fixed: (Newznab) Parse Imdb, Tmdb, RageId, Tvdbid from indexer

Fixes #656
pull/654/head
Qstick 3 years ago
parent 1ffab661da
commit b5a2f68bde

@ -90,7 +90,7 @@ namespace NzbDrone.Core.IndexerSearch
r.Categories == null ? null : from c in r.Categories select GetNabElement("category", c.Id, protocol),
r.IndexerFlags == null ? null : from f in r.IndexerFlags select GetNabElement("tag", f.Name, protocol),
GetNabElement("rageid", r.TvRageId, protocol),
GetNabElement("thetvdb", r.TvdbId, protocol),
GetNabElement("tvdbid", r.TvdbId, protocol),
GetNabElement("imdb", r.ImdbId.ToString("D7"), protocol),
GetNabElement("tmdb", r.TmdbId, protocol),
GetNabElement("seeders", t.Seeders, protocol),

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Indexers.Exceptions;
@ -96,9 +95,12 @@ namespace NzbDrone.Core.Indexers.Newznab
}
releaseInfo = base.ProcessItem(item, releaseInfo);
releaseInfo.ImdbId = GetImdbId(item);
releaseInfo.Grabs = GetGrabs(item);
releaseInfo.Files = GetFiles(item);
releaseInfo.ImdbId = GetIntAttribute(item, "imdb");
releaseInfo.TmdbId = GetIntAttribute(item, "tmdb");
releaseInfo.TvdbId = GetIntAttribute(item, "tvdbid");
releaseInfo.TvRageId = GetIntAttribute(item, "rageid");
releaseInfo.Grabs = GetIntAttribute(item, "grabs");
releaseInfo.Files = GetIntAttribute(item, "files");
releaseInfo.PosterUrl = GetPosterUrl(item);
return releaseInfo;
@ -195,27 +197,14 @@ namespace NzbDrone.Core.Indexers.Newznab
return url;
}
protected virtual int GetImdbId(XElement item)
protected virtual int GetIntAttribute(XElement item, string attribute)
{
var imdbIdString = TryGetNewznabAttribute(item, "imdb");
int imdbId;
var idString = TryGetNewznabAttribute(item, attribute);
int idInt;
if (!imdbIdString.IsNullOrWhiteSpace() && int.TryParse(imdbIdString, out imdbId))
if (!idString.IsNullOrWhiteSpace() && int.TryParse(idString, out idInt))
{
return imdbId;
}
return 0;
}
protected virtual int GetGrabs(XElement item)
{
var grabsString = TryGetNewznabAttribute(item, "grabs");
int grabs;
if (!grabsString.IsNullOrWhiteSpace() && int.TryParse(grabsString, out grabs))
{
return grabs;
return idInt;
}
return 0;
@ -226,19 +215,6 @@ namespace NzbDrone.Core.Indexers.Newznab
return ParseUrl(TryGetNewznabAttribute(item, "coverurl"));
}
protected virtual int GetFiles(XElement item)
{
var filesString = TryGetNewznabAttribute(item, "files");
int files;
if (!filesString.IsNullOrWhiteSpace() && int.TryParse(filesString, out files))
{
return files;
}
return 0;
}
protected virtual int GetImdbYear(XElement item)
{
var imdbYearString = TryGetNewznabAttribute(item, "imdbyear");

Loading…
Cancel
Save