mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Changed torznab parser to use additional attributes
This commit is contained in:
@@ -74,8 +74,18 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||
torrentInfo.DownloadVolumeFactor = downloadFactor;
|
||||
torrentInfo.UploadVolumeFactor = uploadFactor;
|
||||
|
||||
torrentInfo.ImdbId = GetIntAttribute(item, new[] { "imdb", "imdbid" });
|
||||
torrentInfo.TmdbId = GetIntAttribute(item, new[] { "tmdbid", "tmdb" });
|
||||
torrentInfo.TvdbId = GetIntAttribute(item, new[] { "tvdbid", "tvdb" });
|
||||
torrentInfo.TvMazeId = GetIntAttribute(item, new[] { "tvmazeid", "tvmaze" });
|
||||
torrentInfo.TraktId = GetIntAttribute(item, new[] { "traktid", "trakt" });
|
||||
torrentInfo.TvRageId = GetIntAttribute(item, new[] { "rageid" });
|
||||
torrentInfo.Grabs = GetIntAttribute(item, new[] { "grabs" });
|
||||
torrentInfo.Files = GetIntAttribute(item, new[] { "files" });
|
||||
|
||||
torrentInfo.IndexerFlags = GetFlags(item);
|
||||
torrentInfo.PosterUrl = GetPosterUrl(item);
|
||||
torrentInfo.InfoHash = GetInfoHash(item);
|
||||
}
|
||||
|
||||
return torrentInfo;
|
||||
@@ -287,5 +297,21 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
protected virtual int GetIntAttribute(XElement item, string[] attributes)
|
||||
{
|
||||
foreach (var attr in attributes)
|
||||
{
|
||||
var idString = TryGetTorznabAttribute(item, attr);
|
||||
int idInt;
|
||||
|
||||
if (!idString.IsNullOrWhiteSpace() && int.TryParse(idString, out idInt))
|
||||
{
|
||||
return idInt;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user