mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Add support for movie-search
This commit is contained in:
@@ -532,7 +532,11 @@ namespace Jackett.Indexers
|
|||||||
{
|
{
|
||||||
categoryMapping.Add(new CategoryMapping(trackerCategory, trackerCategoryDesc, newznabCategory.ID));
|
categoryMapping.Add(new CategoryMapping(trackerCategory, trackerCategoryDesc, newznabCategory.ID));
|
||||||
if (!TorznabCaps.Categories.Contains(newznabCategory))
|
if (!TorznabCaps.Categories.Contains(newznabCategory))
|
||||||
|
{
|
||||||
TorznabCaps.Categories.Add(newznabCategory);
|
TorznabCaps.Categories.Add(newznabCategory);
|
||||||
|
if (TorznabCatType.Movies.Contains(newznabCategory))
|
||||||
|
TorznabCaps.MovieSearchAvailable = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void AddCategoryMapping(int trackerCategory, TorznabCategory newznabCategory, string trackerCategoryDesc = null)
|
protected void AddCategoryMapping(int trackerCategory, TorznabCategory newznabCategory, string trackerCategoryDesc = null)
|
||||||
|
@@ -15,8 +15,12 @@ namespace Jackett.Models
|
|||||||
|
|
||||||
public bool TVSearchAvailable { get; set; }
|
public bool TVSearchAvailable { get; set; }
|
||||||
|
|
||||||
|
public bool MovieSearchAvailable { get; set; }
|
||||||
|
|
||||||
public bool SupportsTVRageSearch { get; set; }
|
public bool SupportsTVRageSearch { get; set; }
|
||||||
|
|
||||||
|
public bool SupportsImdbSearch { get; set; }
|
||||||
|
|
||||||
public List<TorznabCategory> Categories { get; private set; }
|
public List<TorznabCategory> Categories { get; private set; }
|
||||||
|
|
||||||
public TorznabCapabilities()
|
public TorznabCapabilities()
|
||||||
@@ -24,7 +28,9 @@ namespace Jackett.Models
|
|||||||
Categories = new List<TorznabCategory>();
|
Categories = new List<TorznabCategory>();
|
||||||
SearchAvailable = true;
|
SearchAvailable = true;
|
||||||
TVSearchAvailable = true;
|
TVSearchAvailable = true;
|
||||||
|
MovieSearchAvailable = false;
|
||||||
SupportsTVRageSearch = false;
|
SupportsTVRageSearch = false;
|
||||||
|
SupportsImdbSearch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TorznabCapabilities(params TorznabCategory[] cats)
|
public TorznabCapabilities(params TorznabCategory[] cats)
|
||||||
@@ -32,8 +38,10 @@ namespace Jackett.Models
|
|||||||
SearchAvailable = true;
|
SearchAvailable = true;
|
||||||
TVSearchAvailable = true;
|
TVSearchAvailable = true;
|
||||||
SupportsTVRageSearch = false;
|
SupportsTVRageSearch = false;
|
||||||
|
SupportsImdbSearch = false;
|
||||||
Categories = new List<TorznabCategory>();
|
Categories = new List<TorznabCategory>();
|
||||||
Categories.AddRange(cats);
|
Categories.AddRange(cats);
|
||||||
|
MovieSearchAvailable = Categories.Any(i => TorznabCatType.Movies.Contains(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
string SupportedTVSearchParams
|
string SupportedTVSearchParams
|
||||||
@@ -47,6 +55,17 @@ namespace Jackett.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string SupportedMovieSearchParams
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var parameters = new List<string>() { "q" };
|
||||||
|
if (SupportsImdbSearch)
|
||||||
|
parameters.Add("imdbid");
|
||||||
|
return string.Join(",", parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public JArray CapsToJson()
|
public JArray CapsToJson()
|
||||||
{
|
{
|
||||||
var jArray = new JArray();
|
var jArray = new JArray();
|
||||||
@@ -70,6 +89,10 @@ namespace Jackett.Models
|
|||||||
new XElement("tv-search",
|
new XElement("tv-search",
|
||||||
new XAttribute("available", TVSearchAvailable ? "yes" : "no"),
|
new XAttribute("available", TVSearchAvailable ? "yes" : "no"),
|
||||||
new XAttribute("supportedParams", SupportedTVSearchParams)
|
new XAttribute("supportedParams", SupportedTVSearchParams)
|
||||||
|
),
|
||||||
|
new XElement("movie-search",
|
||||||
|
new XAttribute("available", MovieSearchAvailable ? "yes" : "no"),
|
||||||
|
new XAttribute("supportedParams", SupportedMovieSearchParams)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
new XElement("categories",
|
new XElement("categories",
|
||||||
|
@@ -26,6 +26,17 @@ namespace Jackett.Models
|
|||||||
SubCategories = new List<TorznabCategory>();
|
SubCategories = new List<TorznabCategory>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Contains(TorznabCategory cat)
|
||||||
|
{
|
||||||
|
if (this == cat)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (SubCategories.Contains(cat))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public JToken ToJson()
|
public JToken ToJson()
|
||||||
{
|
{
|
||||||
var t = new JObject();
|
var t = new JObject();
|
||||||
|
@@ -131,10 +131,13 @@ namespace Jackett.Models
|
|||||||
|
|
||||||
if (query["cat"] != null)
|
if (query["cat"] != null)
|
||||||
{
|
{
|
||||||
q.Categories = query["cat"].Split(',').Select(s => int.Parse(s)).ToArray();
|
q.Categories = query["cat"].Split(',').Where(s => !string.IsNullOrWhiteSpace(s)).Select(s => int.Parse(s)).ToArray();
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
q.Categories = new int[0];
|
if (q.QueryType == "movie" && string.IsNullOrWhiteSpace(query["imdbid"]))
|
||||||
|
q.Categories = new int[] { TorznabCatType.Movies.ID };
|
||||||
|
else
|
||||||
|
q.Categories = new int[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query["extended"] != null)
|
if (query["extended"] != null)
|
||||||
@@ -151,6 +154,8 @@ namespace Jackett.Models
|
|||||||
q.Offset = ParseUtil.CoerceInt(query["offset"]);
|
q.Offset = ParseUtil.CoerceInt(query["offset"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
q.ImdbID = query["imdbid"];
|
||||||
|
|
||||||
int rageId;
|
int rageId;
|
||||||
if (int.TryParse(query["rid"], out rageId))
|
if (int.TryParse(query["rid"], out rageId))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user