Skip to content

Commit

Permalink
BaseNewsnabIndexer: Add imdb, tvdb and tvmaze to feed base release (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Celsiusss committed Apr 15, 2024
1 parent d79674c commit ddf2a76
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Jackett.Common/Indexers/Feeds/BaseNewznabIndexer.cs
Expand Up @@ -65,6 +65,13 @@ protected virtual ReleaseInfo ResultFromFeedItem(XElement item)
categoryids = new List<int> { int.Parse(categories.Last(e => !string.IsNullOrEmpty(e.Value)).Value) };
else
categoryids = new List<int> { int.Parse(attributes.First(e => e.Attribute("name").Value == "category").Attribute("value").Value) };
var imdb = long.TryParse(ReadAttribute(attributes, "imdb"), out longVal) ? (long?)longVal : null;
var imdbId = ReadAttribute(attributes, "imdbid");
if (imdb == null && imdbId.StartsWith("tt"))
imdb = long.TryParse(imdbId.Substring(2), out longVal) ? (long?)longVal : null;
var rageId = long.TryParse(ReadAttribute(attributes, "rageid"), out longVal) ? (long?)longVal : null;
var tvdbId = long.TryParse(ReadAttribute(attributes, "tvdbid"), out longVal) ? (long?)longVal : null;
var tvMazeid = long.TryParse(ReadAttribute(attributes, "tvmazeid"), out longVal) ? (long?)longVal : null;

var release = new ReleaseInfo
{
Expand All @@ -82,14 +89,18 @@ protected virtual ReleaseInfo ResultFromFeedItem(XElement item)
Peers = peers,
InfoHash = attributes.First(e => e.Attribute("name").Value == "infohash").Attribute("value").Value,
DownloadVolumeFactor = downloadvolumefactor,
UploadVolumeFactor = uploadvolumefactor
UploadVolumeFactor = uploadvolumefactor,
Imdb = imdb,
RageID = rageId,
TVDBId = tvdbId,
TVMazeId = tvMazeid
};
if (magneturi != null)
release.MagnetUri = magneturi;
return release;
}

private string ReadAttribute(IEnumerable<XElement> attributes, string attributeName)
protected string ReadAttribute(IEnumerable<XElement> attributes, string attributeName)
{
var attribute = attributes.FirstOrDefault(e => e.Attribute("name").Value == attributeName);
if (attribute == null)
Expand Down

0 comments on commit ddf2a76

Please sign in to comment.