Skip to content

Commit

Permalink
New: (Cardigann) - Cardigann v4 Support for Genre, Year, and TraktID
Browse files Browse the repository at this point in the history
  • Loading branch information
Qstick committed Feb 5, 2022
1 parent 88c6cbf commit 7e0f88a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/NzbDrone.Core/IndexerSearch/NewznabResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ public string ToXml(DownloadProtocol protocol)
r.IndexerFlags == null ? null : from f in r.IndexerFlags select GetNabElement("tag", f.Name, protocol),
r.Languages == null ? null : from c in r.Languages select GetNabElement("language", c.Id, protocol),
r.Subs == null ? null : from c in r.Subs select GetNabElement("subs", c.Id, 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("seeders", t.Seeders, protocol),
GetNabElement("files", r.Files, protocol),
GetNabElement("grabs", r.Grabs, protocol),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class IndexerDefinitionUpdateService : IIndexerDefinitionUpdateService, I
/* Update Service will fall back if version # does not exist for an indexer per Ta */

private const string DEFINITION_BRANCH = "master";
private const int DEFINITION_VERSION = 3;
private const int DEFINITION_VERSION = 4;

//Used when moving yml to C#
private readonly List<string> _defintionBlocklist = new List<string>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,13 @@ private string ParseFields(string value, string fieldName, TorrentInfo release,
release.TvRageId = (int)ParseUtil.CoerceLong(rageID);
value = release.TvRageId.ToString();
break;
case "traktid":
var traktIDRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
var traktIDMatch = traktIDRegEx.Match(value);
var traktID = traktIDMatch.Groups[1].Value;
release.TvRageId = (int)ParseUtil.CoerceLong(traktID);

This comment has been minimized.

Copy link
@garfield69

garfield69 Feb 5, 2022

Contributor

tvrageid is not normally equal to traktid. By design or error?

This comment has been minimized.

Copy link
@Qstick

Qstick Feb 5, 2022

Author Contributor

Error 😆

value = release.TvRageId.ToString();
break;
case "tvdbid":
var tvdbIdRegEx = new Regex(@"(\d+)", RegexOptions.Compiled);
var tvdbIdMatch = tvdbIdRegEx.Match(value);
Expand All @@ -577,6 +584,14 @@ private string ParseFields(string value, string fieldName, TorrentInfo release,

value = release.PosterUrl;
break;
case "genre":
release.Genres = release.Genres.Union(value.Split(',')).ToList();
value = release.Genres.ToString();

This comment has been minimized.

Copy link
@garfield69

garfield69 Jul 24, 2022

Contributor

this line of code does not result in the value being loaded with the content of release.Genres in string format, rather it results in value being loaded with System.Collections.Generic.List`1[System.String]

[edit] should probably be value = string.Join(",", release.Genres);

break;
case "year":
release.Year = ParseUtil.CoerceInt(value);
value = release.Year.ToString();
break;
case "author":
release.Author = value;
break;
Expand Down
3 changes: 3 additions & 0 deletions src/NzbDrone.Core/Parser/Model/ReleaseInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public ReleaseInfo()
public int TvRageId { get; set; }
public int ImdbId { get; set; }
public int TmdbId { get; set; }
public int TraktId { get; set; }
public int Year { get; set; }
public string Author { get; set; }
public string BookTitle { get; set; }
public string Artist { get; set; }
Expand All @@ -45,6 +47,7 @@ public ReleaseInfo()
public string Container { get; set; }
public string Codec { get; set; }
public string Resolution { get; set; }
public ICollection<string> Genres { get; set; }
public ICollection<Language> Languages { get; set; }
public ICollection<Language> Subs { get; set; }
public ICollection<IndexerCategory> Categories { get; set; }
Expand Down

0 comments on commit 7e0f88a

Please sign in to comment.