mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Add support for book-search (#9306)
This commit is contained in:
@@ -26,6 +26,8 @@ namespace Jackett.Common.Models
|
||||
|
||||
public List<string> SupportedMusicSearchParamsList;
|
||||
|
||||
public bool BookSearchAvailable { get; set; }
|
||||
|
||||
public List<TorznabCategory> Categories { get; private set; }
|
||||
|
||||
public TorznabCapabilities()
|
||||
@@ -38,6 +40,7 @@ namespace Jackett.Common.Models
|
||||
SupportsImdbMovieSearch = false;
|
||||
SupportsImdbTVSearch = false;
|
||||
SupportedMusicSearchParamsList = new List<string>();
|
||||
BookSearchAvailable = false;
|
||||
}
|
||||
|
||||
public TorznabCapabilities(params TorznabCategory[] cats)
|
||||
@@ -48,6 +51,7 @@ namespace Jackett.Common.Models
|
||||
SupportsImdbMovieSearch = false;
|
||||
SupportsImdbTVSearch = false;
|
||||
SupportedMusicSearchParamsList = new List<string>();
|
||||
BookSearchAvailable = false;
|
||||
Categories = new List<TorznabCategory>();
|
||||
Categories.AddRange(cats);
|
||||
MovieSearchAvailable = Categories.Any(i => TorznabCatType.Movies.Contains(i));
|
||||
@@ -79,6 +83,17 @@ namespace Jackett.Common.Models
|
||||
|
||||
private string SupportedMusicSearchParams => string.Join(",", SupportedMusicSearchParamsList);
|
||||
|
||||
private string SupportedBookSearchParams
|
||||
{
|
||||
get
|
||||
{
|
||||
var parameters = new List<string>() { "q" };
|
||||
if (BookSearchAvailable)
|
||||
parameters.Add("author,title");
|
||||
return string.Join(",", parameters);
|
||||
}
|
||||
}
|
||||
|
||||
public bool SupportsCategories(int[] categories)
|
||||
{
|
||||
var subCategories = Categories.SelectMany(c => c.SubCategories);
|
||||
@@ -122,6 +137,10 @@ namespace Jackett.Common.Models
|
||||
new XElement("audio-search",
|
||||
new XAttribute("available", MusicSearchAvailable ? "yes" : "no"),
|
||||
new XAttribute("supportedParams", SupportedMusicSearchParams)
|
||||
),
|
||||
new XElement("book-search",
|
||||
new XAttribute("available", BookSearchAvailable ? "yes" : "no"),
|
||||
new XAttribute("supportedParams", SupportedBookSearchParams)
|
||||
)
|
||||
),
|
||||
new XElement("categories",
|
||||
@@ -149,6 +168,7 @@ namespace Jackett.Common.Models
|
||||
lhs.SearchAvailable = lhs.SearchAvailable || rhs.SearchAvailable;
|
||||
lhs.TVSearchAvailable = lhs.TVSearchAvailable || rhs.TVSearchAvailable;
|
||||
lhs.MovieSearchAvailable = lhs.MovieSearchAvailable || rhs.MovieSearchAvailable;
|
||||
lhs.BookSearchAvailable = lhs.BookSearchAvailable || rhs.BookSearchAvailable;
|
||||
lhs.SupportsTVRageSearch = lhs.SupportsTVRageSearch || rhs.SupportsTVRageSearch;
|
||||
lhs.SupportsImdbMovieSearch = lhs.SupportsImdbMovieSearch || rhs.SupportsImdbMovieSearch;
|
||||
lhs.SupportsImdbTVSearch = lhs.SupportsImdbTVSearch || rhs.SupportsImdbTVSearch;
|
||||
|
Reference in New Issue
Block a user