mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
ImdbTVSearchSupport added for c# based indexers (#5791)
This commit is contained in:
@@ -293,7 +293,9 @@ namespace Jackett.Common.Indexers
|
||||
if (query.HasSpecifiedCategories)
|
||||
if (!caps.SupportsCategories(query.Categories))
|
||||
return false;
|
||||
if (caps.SupportsImdbMovieSearch && query.IsImdbQuery)
|
||||
if (caps.SupportsImdbTVSearch && query.IsImdbQuery && query.IsTVSearch)
|
||||
return true;
|
||||
if (caps.SupportsImdbMovieSearch && query.IsImdbQuery && query.IsMovieSearch)
|
||||
return true;
|
||||
else if (!caps.SupportsImdbMovieSearch && query.IsImdbQuery && query.QueryType != "TorrentPotato") // potato query should always contain imdb+search term
|
||||
return false;
|
||||
|
@@ -48,6 +48,7 @@ namespace Jackett.Common.Indexers
|
||||
Language = "hu-hu";
|
||||
Type = "private";
|
||||
|
||||
TorznabCaps.SupportsImdbTVSearch = true;
|
||||
AddCategoryMapping(1, TorznabCatType.TV);
|
||||
AddCategoryMapping(2, TorznabCatType.TVHD);
|
||||
AddCategoryMapping(3, TorznabCatType.TVSD);
|
||||
@@ -270,7 +271,19 @@ namespace Jackett.Common.Indexers
|
||||
limit = 100;
|
||||
if (query.IsImdbQuery)
|
||||
{
|
||||
/* Currently this is not supported for series */
|
||||
seriesinfo = series.Find(x => x.imdbid.Equals(query.ImdbIDShort));
|
||||
if (seriesinfo != null && !query.ImdbIDShort.Equals(""))
|
||||
{
|
||||
String querrySeason = "";
|
||||
if (query.Season != 0)
|
||||
querrySeason = query.Season.ToString();
|
||||
exactSearchURL = SearchUrl + "?s=" + querrySeason + "&e=" + query.Episode + "&g=" + seriesinfo.id + "&now=" + unixTimestamp.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
// IMDB_ID was not founded in site database.
|
||||
return releases;
|
||||
}
|
||||
|
||||
}
|
||||
if (!query.IsImdbQuery || noimdbmatch)
|
||||
|
@@ -20,6 +20,8 @@ namespace Jackett.Common.Models
|
||||
|
||||
public bool SupportsImdbMovieSearch { get; set; }
|
||||
|
||||
public bool SupportsImdbTVSearch { get; set; }
|
||||
|
||||
public bool MusicSearchAvailable
|
||||
{
|
||||
get
|
||||
@@ -40,6 +42,7 @@ namespace Jackett.Common.Models
|
||||
MovieSearchAvailable = false;
|
||||
SupportsTVRageSearch = false;
|
||||
SupportsImdbMovieSearch = false;
|
||||
SupportsImdbTVSearch = false;
|
||||
SupportedMusicSearchParamsList = new List<string>();
|
||||
}
|
||||
|
||||
@@ -49,6 +52,7 @@ namespace Jackett.Common.Models
|
||||
TVSearchAvailable = true;
|
||||
SupportsTVRageSearch = false;
|
||||
SupportsImdbMovieSearch = false;
|
||||
SupportsImdbTVSearch = false;
|
||||
SupportedMusicSearchParamsList = new List<string>();
|
||||
Categories = new List<TorznabCategory>();
|
||||
Categories.AddRange(cats);
|
||||
@@ -62,6 +66,8 @@ namespace Jackett.Common.Models
|
||||
var parameters = new List<string>() { "q", "season", "ep" };
|
||||
if (SupportsTVRageSearch)
|
||||
parameters.Add("rid");
|
||||
if (SupportsImdbTVSearch)
|
||||
parameters.Add("imdbid");
|
||||
return string.Join(",", parameters);
|
||||
}
|
||||
}
|
||||
@@ -160,6 +166,7 @@ namespace Jackett.Common.Models
|
||||
lhs.MovieSearchAvailable = lhs.MovieSearchAvailable || rhs.MovieSearchAvailable;
|
||||
lhs.SupportsTVRageSearch = lhs.SupportsTVRageSearch || rhs.SupportsTVRageSearch;
|
||||
lhs.SupportsImdbMovieSearch = lhs.SupportsImdbMovieSearch || rhs.SupportsImdbMovieSearch;
|
||||
lhs.SupportsImdbTVSearch = lhs.SupportsImdbTVSearch || rhs.SupportsImdbTVSearch;
|
||||
lhs.Categories.AddRange(rhs.Categories.Where(x => x.ID < 100000).Except(lhs.Categories)); // exclude indexer specific categories (>= 100000)
|
||||
|
||||
return lhs;
|
||||
|
@@ -355,10 +355,16 @@ namespace Jackett.Server.Controllers
|
||||
return GetErrorXML(201, "Incorrect parameter: invalid imdbid format");
|
||||
}
|
||||
|
||||
if (!CurrentIndexer.TorznabCaps.SupportsImdbMovieSearch)
|
||||
if (CurrentQuery.IsMovieSearch && !CurrentIndexer.TorznabCaps.SupportsImdbMovieSearch)
|
||||
{
|
||||
logger.Warn($"A search request with imdbid from {Request.HttpContext.Connection.RemoteIpAddress} was made but the indexer {CurrentIndexer.DisplayName} doesn't support it.");
|
||||
return GetErrorXML(203, "Function Not Available: imdbid is not supported by this indexer");
|
||||
return GetErrorXML(203, "Function Not Available: imdbid is not supported for movie search by this indexer");
|
||||
}
|
||||
|
||||
if (CurrentQuery.IsTVSearch && !CurrentIndexer.TorznabCaps.SupportsImdbTVSearch)
|
||||
{
|
||||
logger.Warn($"A search request with imdbid from {Request.HttpContext.Connection.RemoteIpAddress} was made but the indexer {CurrentIndexer.DisplayName} doesn't support it.");
|
||||
return GetErrorXML(203, "Function Not Available: imdbid is not supported for TV search by this indexer");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user