Update the EH search engine to fix issues with the current search features

This commit is contained in:
Jobobby04
2020-08-03 17:21:10 -04:00
parent fb19f6b860
commit 4f803494ff
5 changed files with 127 additions and 80 deletions
+14 -2
View File
@@ -48,9 +48,21 @@ class SourceTagsUtil {
"$namespace:$tag"
}
companion object {
fun Manga.getRaisedTags(): List<RaisedTag>? = this.getGenres()?.map { parseTag(it) }
fun Manga.getRaisedTags(genres: List<String>? = null): List<RaisedTag>? = (genres ?: this.getGenres())?.map { parseTag(it) }
fun parseTag(tag: String) = RaisedTag(tag.substringBefore(':').trimOrNull(), (tag.substringAfter(':').trimOrNull() ?: tag), TAG_TYPE_DEFAULT)
fun parseTag(tag: String) = RaisedTag(
(
if (tag.startsWith("-")) {
tag.substringAfter("-")
} else {
tag
}
).substringBefore(':', missingDelimiterValue = "").trimOrNull(),
tag.substringAfter(':', missingDelimiterValue = tag).trim(),
if (tag.startsWith("-")) TAG_TYPE_EXCLUDE else TAG_TYPE_DEFAULT
)
const val TAG_TYPE_EXCLUDE = 69 // why not
const val DOUJINSHI_COLOR = "#f44336"
const val MANGA_COLOR = "#ff9800"