Parse "tmdbid" and "imdb" attributes in Newznab and Torznab parsers

pull/10574/head
Bogdan 3 weeks ago
parent 2c9292c249
commit 2d2de7f76b

@ -91,6 +91,8 @@ namespace NzbDrone.Core.Indexers.Newznab
protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo)
{
releaseInfo = base.ProcessItem(item, releaseInfo);
releaseInfo.TmdbId = GetTmdbId(item);
releaseInfo.ImdbId = GetImdbId(item);
releaseInfo.IndexerFlags = GetFlags(item);
@ -173,6 +175,18 @@ namespace NzbDrone.Core.Indexers.Newznab
return url;
}
protected virtual int GetTmdbId(XElement item)
{
var tmdbIdString = TryGetNewznabAttribute(item, "tmdbid");
if (!tmdbIdString.IsNullOrWhiteSpace() && int.TryParse(tmdbIdString, out var tmdbId))
{
return tmdbId;
}
return 0;
}
protected virtual int GetImdbId(XElement item)
{
var imdbIdString = TryGetNewznabAttribute(item, "imdb");

@ -62,11 +62,8 @@ namespace NzbDrone.Core.Indexers.Torznab
if (torrentInfo != null)
{
if (GetImdbId(item) != null)
{
torrentInfo.ImdbId = int.Parse(GetImdbId(item).Substring(2));
}
torrentInfo.TmdbId = GetTmdbId(item);
torrentInfo.ImdbId = GetImdbId(item);
torrentInfo.IndexerFlags = GetFlags(item);
}
@ -156,10 +153,28 @@ namespace NzbDrone.Core.Indexers.Torznab
return url;
}
protected virtual string GetImdbId(XElement item)
protected virtual int GetTmdbId(XElement item)
{
var tmdbIdString = TryGetTorznabAttribute(item, "tmdbid");
if (!tmdbIdString.IsNullOrWhiteSpace() && int.TryParse(tmdbIdString, out var tmdbId))
{
return tmdbId;
}
return 0;
}
protected virtual int GetImdbId(XElement item)
{
var imdbIdString = TryGetTorznabAttribute(item, "imdbid");
return !imdbIdString.IsNullOrWhiteSpace() ? imdbIdString.Substring(2) : null;
var imdbIdString = TryGetTorznabAttribute(item, "imdb");
if (!imdbIdString.IsNullOrWhiteSpace() && int.TryParse(imdbIdString, out var imdbId))
{
return imdbId;
}
return 0;
}
protected override string GetInfoHash(XElement item)

Loading…
Cancel
Save