Fixed: (Newznab) Parsing of Ids from non-standard feeds

Fixes #1261
pull/1214/head
Qstick 2 years ago
parent ae8f017ca8
commit 587a73f3d6

@ -93,12 +93,13 @@ namespace NzbDrone.Core.IndexerSearch
r.Languages == null ? null : from c in r.Languages select GetNabElement("language", c, protocol),
r.Subs == null ? null : from c in r.Subs select GetNabElement("subs", c, protocol),
r.Genres == null ? null : GetNabElement("genre", string.Join(", ", r.Genres), protocol),
GetNabElement("rageid", r.TvRageId, protocol),
GetNabElement("tvdbid", r.TvdbId, protocol),
GetNabElement("imdb", r.ImdbId.ToString("D7"), protocol),
GetNabElement("tmdbid", r.TmdbId, protocol),
GetNabElement("traktid", r.TraktId, protocol),
GetNabElement("doubanid", r.DoubanId, protocol),
r.TvRageId == 0 ? null : GetNabElement("rageid", r.TvRageId, protocol),
r.TvdbId == 0 ? null : GetNabElement("tvdbid", r.TvdbId, protocol),
r.ImdbId == 0 ? null : GetNabElement("imdb", r.ImdbId.ToString("D7"), protocol),
r.TmdbId == 0 ? null : GetNabElement("tmdbid", r.TmdbId, protocol),
r.TraktId == 0 ? null : GetNabElement("traktid", r.TraktId, protocol),
r.TvMazeId == 0 ? null : GetNabElement("tvmazeid", r.TvMazeId, protocol),
r.DoubanId == 0 ? null : GetNabElement("doubanid", r.DoubanId, protocol),
GetNabElement("seeders", t.Seeders, protocol),
GetNabElement("files", r.Files, protocol),
GetNabElement("grabs", r.Grabs, protocol),

@ -100,12 +100,14 @@ namespace NzbDrone.Core.Indexers.Newznab
}
releaseInfo = base.ProcessItem(item, releaseInfo);
releaseInfo.ImdbId = GetIntAttribute(item, "imdb");
releaseInfo.TmdbId = GetIntAttribute(item, "tmdbid");
releaseInfo.TvdbId = GetIntAttribute(item, "tvdbid");
releaseInfo.TvRageId = GetIntAttribute(item, "rageid");
releaseInfo.Grabs = GetIntAttribute(item, "grabs");
releaseInfo.Files = GetIntAttribute(item, "files");
releaseInfo.ImdbId = GetIntAttribute(item, new[] { "imdb", "imdbid" });
releaseInfo.TmdbId = GetIntAttribute(item, new[] { "tmdbid", "tmdb" });
releaseInfo.TvdbId = GetIntAttribute(item, new[] { "tvdbid", "tvdb" });
releaseInfo.TvMazeId = GetIntAttribute(item, new[] { "tvmazeid", "tvmaze" });
releaseInfo.TraktId = GetIntAttribute(item, new[] { "traktid", "trakt" });
releaseInfo.TvRageId = GetIntAttribute(item, new[] { "rageid" });
releaseInfo.Grabs = GetIntAttribute(item, new[] { "grabs" });
releaseInfo.Files = GetIntAttribute(item, new[] { "files" });
releaseInfo.PosterUrl = GetPosterUrl(item);
return releaseInfo;
@ -206,14 +208,17 @@ namespace NzbDrone.Core.Indexers.Newznab
return url;
}
protected virtual int GetIntAttribute(XElement item, string attribute)
protected virtual int GetIntAttribute(XElement item, string[] attributes)
{
var idString = TryGetNewznabAttribute(item, attribute);
int idInt;
if (!idString.IsNullOrWhiteSpace() && int.TryParse(idString, out idInt))
foreach (var attr in attributes)
{
return idInt;
var idString = TryGetNewznabAttribute(item, attr);
int idInt;
if (!idString.IsNullOrWhiteSpace() && int.TryParse(idString, out idInt))
{
return idInt;
}
}
return 0;

@ -34,6 +34,7 @@ namespace NzbDrone.Core.Parser.Model
public int ImdbId { get; set; }
public int TmdbId { get; set; }
public int TraktId { get; set; }
public int TvMazeId { get; set; }
public int DoubanId { get; set; }
public int Year { get; set; }
public string Author { get; set; }

Loading…
Cancel
Save