Add uploader faux-namespace to search engine.
This commit is contained in:
parent
c49b865ee7
commit
63d58c7a4f
@ -180,14 +180,14 @@ class EHentai(override val id: Int,
|
||||
with(metdata) {
|
||||
url = manga.url
|
||||
exh = this@EHentai.exh
|
||||
title = select("#gn").text().nullIfBlank()
|
||||
altTitle = select("#gj").text().nullIfBlank()
|
||||
title = select("#gn").text().nullIfBlank()?.trim()
|
||||
altTitle = select("#gj").text().nullIfBlank()?.trim()
|
||||
|
||||
thumbnailUrl = select("#gd1 img").attr("src").nullIfBlank()
|
||||
thumbnailUrl = select("#gd1 img").attr("src").nullIfBlank()?.trim()
|
||||
|
||||
genre = select(".ic").attr("alt").nullIfBlank()
|
||||
genre = select(".ic").attr("alt").nullIfBlank()?.trim()
|
||||
|
||||
uploader = select("#gdn").text().nullIfBlank()
|
||||
uploader = select("#gdn").text().nullIfBlank()?.trim()
|
||||
|
||||
//Parse the table
|
||||
select("#gdd tr").forEach {
|
||||
|
@ -4,7 +4,6 @@ import exh.metadata.models.ExGalleryMetadata
|
||||
import exh.metadata.models.Tag
|
||||
|
||||
class SearchEngine {
|
||||
//TODO Namespace alias
|
||||
fun matches(metadata: ExGalleryMetadata, query: List<QueryComponent>): Boolean {
|
||||
|
||||
fun matchTagList(tags: List<Tag>,
|
||||
@ -37,13 +36,21 @@ class SearchEngine {
|
||||
if(!matchTagList(metadata.tags.entries.flatMap { it.value },
|
||||
component)) return false
|
||||
} else if(component is Namespace) {
|
||||
//Match namespace
|
||||
val ns = metadata.tags.entries.filter {
|
||||
it.key == component.namespace
|
||||
}.flatMap { it.value }
|
||||
//Match tags
|
||||
if(!matchTagList(ns, component.tag!!))
|
||||
return false
|
||||
if(component.namespace == "uploader") {
|
||||
//Match uploader
|
||||
if(!component.tag?.rawTextOnly().equals(metadata.uploader,
|
||||
ignoreCase = true)) {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
//Match namespace
|
||||
val ns = metadata.tags.entries.filter {
|
||||
it.key == component.namespace
|
||||
}.flatMap { it.value }
|
||||
//Match tags
|
||||
if (!matchTagList(ns, component.tag!!))
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
Loading…
x
Reference in New Issue
Block a user