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) {
|
with(metdata) {
|
||||||
url = manga.url
|
url = manga.url
|
||||||
exh = this@EHentai.exh
|
exh = this@EHentai.exh
|
||||||
title = select("#gn").text().nullIfBlank()
|
title = select("#gn").text().nullIfBlank()?.trim()
|
||||||
altTitle = select("#gj").text().nullIfBlank()
|
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
|
//Parse the table
|
||||||
select("#gdd tr").forEach {
|
select("#gdd tr").forEach {
|
||||||
|
@ -4,7 +4,6 @@ import exh.metadata.models.ExGalleryMetadata
|
|||||||
import exh.metadata.models.Tag
|
import exh.metadata.models.Tag
|
||||||
|
|
||||||
class SearchEngine {
|
class SearchEngine {
|
||||||
//TODO Namespace alias
|
|
||||||
fun matches(metadata: ExGalleryMetadata, query: List<QueryComponent>): Boolean {
|
fun matches(metadata: ExGalleryMetadata, query: List<QueryComponent>): Boolean {
|
||||||
|
|
||||||
fun matchTagList(tags: List<Tag>,
|
fun matchTagList(tags: List<Tag>,
|
||||||
@ -37,13 +36,21 @@ class SearchEngine {
|
|||||||
if(!matchTagList(metadata.tags.entries.flatMap { it.value },
|
if(!matchTagList(metadata.tags.entries.flatMap { it.value },
|
||||||
component)) return false
|
component)) return false
|
||||||
} else if(component is Namespace) {
|
} else if(component is Namespace) {
|
||||||
//Match namespace
|
if(component.namespace == "uploader") {
|
||||||
val ns = metadata.tags.entries.filter {
|
//Match uploader
|
||||||
it.key == component.namespace
|
if(!component.tag?.rawTextOnly().equals(metadata.uploader,
|
||||||
}.flatMap { it.value }
|
ignoreCase = true)) {
|
||||||
//Match tags
|
return false
|
||||||
if(!matchTagList(ns, component.tag!!))
|
}
|
||||||
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
|
return true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user