core: rawsearch support. resolves #8246 closes #11889 (#13409)

This commit is contained in:
bakerboy448 2022-07-28 22:55:41 -05:00 committed by GitHub
parent ba889e81ec
commit 605b2a3cd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 28 additions and 13 deletions

View File

@ -126,6 +126,7 @@ caps:
movie-search: [q]
music-search: [q, album, artist]
book-search: [q]
allowrawsearch: true
settings:
- name: flaresolverr
@ -180,9 +181,6 @@ search:
- path: "{{ if or .Query.Album .Query.Artist .Keywords }}sort-search{{ else }}cat/Movies{{ end }}{{ if or .Query.Album .Query.Artist }}/{{ or .Query.Album .Query.Artist }}{{ else }}/{{ .Keywords }}{{ end }}{{ if or .Query.Album .Query.Artist .Keywords }}/{{ else }}{{ end }}{{ .Config.sort }}/{{ .Config.type }}/1/"
- path: "{{ if or .Query.Album .Query.Artist .Keywords }}sort-search{{ else }}cat/TV{{ end }}{{ if or .Query.Album .Query.Artist }}/{{ or .Query.Album .Query.Artist }}{{ else }}/{{ .Keywords }}{{ end }}{{ if or .Query.Album .Query.Artist .Keywords }}/{{ else }}{{ end }}{{ .Config.sort }}/{{ .Config.type }}/{{ if or .Query.Album .Query.Artist .Keywords }}2{{ else }}1{{ end }}/"
- path: "{{ if or .Query.Album .Query.Artist .Keywords }}sort-search{{ else }}cat/Music{{ end }}{{ if or .Query.Album .Query.Artist }}/{{ or .Query.Album .Query.Artist }}{{ else }}/{{ .Keywords }}{{ end }}{{ if or .Query.Album .Query.Artist .Keywords }}/{{ else }}{{ end }}{{ .Config.sort }}/{{ .Config.type }}/{{ if or .Query.Album .Query.Artist .Keywords }}3{{ else }}1{{ end }}/"
keywordsfilters:
- name: replace # use this as a workaround till #893 is implemented
args: ["Greys Anatomy", "Grey's Anatomy"]
rows:
selector: tr:has(a[href^="/torrent/"])
@ -210,8 +208,6 @@ search:
args: ["-", " "]
- name: re_replace
args: ["~([\\w]+(?:[\\[\\]\\(\\)\\w]+)?)$", "-$1"]
- name: replace
args: ["Grey's Anatomy", "Greys Anatomy"]
- name: replace
args: ["\u000f", ""] # get rid of unwanted character #6582
# cleanup for Sonarr

View File

@ -46,6 +46,7 @@ caps:
modes:
search: [q]
tv-search: [q, season, ep]
allowrawsearch: true
settings: []

View File

@ -116,6 +116,7 @@ caps:
tv-search: [q]
movie-search: [q]
book-search: [q]
allowrawsearch: true
search:
paths:

View File

@ -19,6 +19,7 @@ caps:
modes:
search: [q]
tv-search: [q, season, ep]
allowrawsearch: true
settings:
- name: username

View File

@ -106,6 +106,7 @@ caps:
movie-search: [q]
music-search: [q]
book-search: [q]
allowrawsearch: true
settings:
- name: cookie

View File

@ -106,6 +106,7 @@ caps:
movie-search: [q]
music-search: [q]
book-search: [q]
allowrawsearch: true
settings:
- name: username

View File

@ -57,7 +57,8 @@ namespace Jackett.Common.Indexers
BookSearchParams = new List<BookSearchParam>
{
BookSearchParam.Q
}
},
SupportsRawSearch = true
},
logger: l,
p: ps,

View File

@ -122,6 +122,7 @@ namespace Jackett.Common.Indexers
Type = Definition.Type;
TorznabCaps = new TorznabCapabilities();
TorznabCaps.ParseCardigannSearchModes(Definition.Caps.Modes);
TorznabCaps.SupportsRawSearch = Definition.Caps.Allowrawsearch;
// init config Data
configData = new ConfigurationData();

View File

@ -62,7 +62,8 @@ namespace Jackett.Common.Indexers
BookSearchParams = new List<BookSearchParam>
{
BookSearchParam.Q
}
},
SupportsRawSearch = true
},
configService: configService,
client: wc,

View File

@ -72,6 +72,7 @@ namespace Jackett.Common.Models
public Dictionary<string, string> Categories { get; set; }
public List<CategorymappingBlock> Categorymappings { get; set; }
public Dictionary<string, List<string>> Modes { get; set; }
public bool Allowrawsearch { get; internal set; }
}
public class captchaBlock

View File

@ -60,6 +60,8 @@ namespace Jackett.Common.Models
public bool SearchAvailable { get; set; }
public bool SupportsRawSearch { get; set; }
public List<TvSearchParam> TvSearchParams;
public bool TvSearchAvailable => (TvSearchParams.Count > 0);
public bool TvSearchSeasonAvailable => (TvSearchParams.Contains(TvSearchParam.Season));
@ -106,6 +108,7 @@ namespace Jackett.Common.Models
public TorznabCapabilities()
{
SupportsRawSearch = false;
SearchAvailable = true;
TvSearchParams = new List<TvSearchParam>();
MovieSearchParams = new List<MovieSearchParam>();
@ -297,28 +300,34 @@ namespace Jackett.Common.Models
new XElement("searching",
new XElement("search",
new XAttribute("available", SearchAvailable ? "yes" : "no"),
new XAttribute("supportedParams", "q")
new XAttribute("supportedParams", "q"),
SupportsRawSearch ? new XAttribute("searchEngine", "raw") : null
),
new XElement("tv-search",
new XAttribute("available", TvSearchAvailable ? "yes" : "no"),
new XAttribute("supportedParams", SupportedTvSearchParams())
new XAttribute("supportedParams", SupportedTvSearchParams()),
SupportsRawSearch ? new XAttribute("searchEngine", "raw") : null
),
new XElement("movie-search",
new XAttribute("available", MovieSearchAvailable ? "yes" : "no"),
new XAttribute("supportedParams", SupportedMovieSearchParams())
new XAttribute("supportedParams", SupportedMovieSearchParams()),
SupportsRawSearch ? new XAttribute("searchEngine", "raw") : null
),
new XElement("music-search",
new XAttribute("available", MusicSearchAvailable ? "yes" : "no"),
new XAttribute("supportedParams", SupportedMusicSearchParams())
new XAttribute("supportedParams", SupportedMusicSearchParams()),
SupportsRawSearch ? new XAttribute("searchEngine", "raw") : null
),
// inconsistent but apparently already used by various newznab indexers (see #1896)
new XElement("audio-search",
new XAttribute("available", MusicSearchAvailable ? "yes" : "no"),
new XAttribute("supportedParams", SupportedMusicSearchParams())
new XAttribute("supportedParams", SupportedMusicSearchParams()),
SupportsRawSearch ? new XAttribute("searchEngine", "raw") : null
),
new XElement("book-search",
new XAttribute("available", BookSearchAvailable ? "yes" : "no"),
new XAttribute("supportedParams", SupportedBookSearchParams())
new XAttribute("supportedParams", SupportedBookSearchParams()),
SupportsRawSearch ? new XAttribute("searchEngine", "raw") : null
)
),
new XElement("categories",
@ -349,6 +358,7 @@ namespace Jackett.Common.Models
lhs.MusicSearchParams = lhs.MusicSearchParams.Union(rhs.MusicSearchParams).ToList();
lhs.BookSearchParams = lhs.BookSearchParams.Union(rhs.BookSearchParams).ToList();
lhs.Categories.Concat(rhs.Categories);
lhs.SupportsRawSearch = lhs.SupportsRawSearch || rhs.SupportsRawSearch;
return lhs;
}
}