Use params IMDBID, TVDBID, TVMAZEID and TMDBID with json response (#15015)

This commit is contained in:
swannie-eire 2024-01-26 08:12:43 +00:00 committed by GitHub
parent 4b00491152
commit 8e771dc62a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 0 deletions

View File

@ -9,6 +9,10 @@ namespace Jackett.Common.Models.DTO
public string Query { get; set; }
public int[] Category { get; set; }
public string[] Tracker { get; set; }
public string ImdbId { get; set; }
public int TvdbId { get; set; }
public int TmdbId { get; set; }
public int TvMazeId { get; set; }
public static TorznabQuery ToTorznabQuery(ApiSearch request)
{
@ -50,6 +54,10 @@ namespace Jackett.Common.Models.DTO
stringQuery.SearchTerm = queryStr;
stringQuery.Categories = request.Category ?? Array.Empty<int>();
stringQuery.TmdbID = request.TmdbId;
stringQuery.TvdbID = request.TvdbId;
stringQuery.ImdbID = request.ImdbId;
stringQuery.TvmazeID = request.TvMazeId;
// try to build an IMDB Query (tt plus 6 to 8 digits)
if (stringQuery.SanitizedSearchTerm.StartsWith("tt") && stringQuery.SanitizedSearchTerm.Length <= 10)
@ -67,6 +75,9 @@ namespace Jackett.Common.Models.DTO
}
}
return stringQuery;
}
}

View File

@ -212,6 +212,26 @@ namespace Jackett.Server.Controllers
{
request.Query = t.Value.ToString();
}
if (t.Key == "imdbid")
{
request.ImdbId = t.Value.ToString();
}
if (t.Key == "tmdbid")
{
request.TmdbId = Int32.Parse(t.Value.ToString());
}
if (t.Key == "tvdbid")
{
request.TvdbId = Int32.Parse(t.Value.ToString());
}
if (t.Key == "tvmazeid")
{
request.TvMazeId = Int32.Parse(t.Value.ToString());
}
}
var manualResult = new ManualSearchResult();