mirror of
https://github.com/Radarr/Radarr
synced 2024-12-22 07:52:34 +00:00
Parse "tmdbid" and "imdb" attributes in Newznab and Torznab parsers
This commit is contained in:
parent
2c9292c249
commit
2d2de7f76b
2 changed files with 37 additions and 8 deletions
|
@ -91,6 +91,8 @@ protected override bool PostProcess(IndexerResponse indexerResponse, List<XEleme
|
|||
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 @@ protected override string GetDownloadUrl(XElement item)
|
|||
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 @@ protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInf
|
|||
|
||||
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 @@ protected override string GetDownloadUrl(XElement item)
|
|||
return url;
|
||||
}
|
||||
|
||||
protected virtual string GetImdbId(XElement item)
|
||||
protected virtual int GetTmdbId(XElement item)
|
||||
{
|
||||
var imdbIdString = TryGetTorznabAttribute(item, "imdbid");
|
||||
return !imdbIdString.IsNullOrWhiteSpace() ? imdbIdString.Substring(2) : null;
|
||||
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, "imdb");
|
||||
|
||||
if (!imdbIdString.IsNullOrWhiteSpace() && int.TryParse(imdbIdString, out var imdbId))
|
||||
{
|
||||
return imdbId;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected override string GetInfoHash(XElement item)
|
||||
|
|
Loading…
Reference in a new issue