Support new tag namespace: "location:"

Treat it as "other:".
This commit is contained in:
FooIbar committed 2025-08-16 17:21:53 +08:00
1 parent ac41117a78
commit 88c9e5e902
3 files changed
+6 -2

No files matched your search

@@ -68,6 +68,7 @@ object EhTagDatabase : CoroutineScope {
// Copied from https://github.com/EhTagTranslation/EhSyringe/blob/c0cf88da04081072492829673aca34380b14dae6/src/plugin/suggest.ts#L37
// TODO: Optimize
private val nsScore = mapOf(
TagNamespace.Location.prefix to 10f,
TagNamespace.Other.prefix to 10f,
TagNamespace.Female.prefix to 9f,
TagNamespace.Male.prefix to 8.5f,
@@ -16,6 +16,7 @@ sealed class TagNamespace(val value: String, val prefix: String?) {
object Female : TagNamespace("female", "f")
object Group : TagNamespace("group", "g")
object Language : TagNamespace("language", "l")
object Location : TagNamespace("location", "loc")
object Male : TagNamespace("male", "m")
object Mixed : TagNamespace("mixed", "x")
object Other : TagNamespace("other", "o")
@@ -31,6 +32,7 @@ sealed class TagNamespace(val value: String, val prefix: String?) {
Female.value -> Female
Group.value -> Group
Language.value -> Language
Location.value -> Location
Male.value -> Male
Mixed.value -> Mixed
Other.value -> Other
@@ -12,6 +12,7 @@ import com.hippo.ehviewer.client.data.TagNamespace.Character
import com.hippo.ehviewer.client.data.TagNamespace.Cosplayer
import com.hippo.ehviewer.client.data.TagNamespace.Female
import com.hippo.ehviewer.client.data.TagNamespace.Group
import com.hippo.ehviewer.client.data.TagNamespace.Location
import com.hippo.ehviewer.client.data.TagNamespace.Male
import com.hippo.ehviewer.client.data.TagNamespace.Mixed
import com.hippo.ehviewer.client.data.TagNamespace.Other
@@ -60,7 +61,7 @@ fun GalleryInfo.getComicInfo(): ComicInfo {
Group -> groups.addAll(list)
Character -> characters.addAll(list)
Parody -> parodies.addAll(list)
Other -> otherTags.addAll(list)
Location, Other -> otherTags.addAll(list)
Female, Male, Mixed -> ns.prefix.let { prefix ->
list.forEach { tag -> otherTags.add("$prefix:$tag") }
}
@@ -76,7 +77,7 @@ fun GalleryInfo.getComicInfo(): ComicInfo {
Group -> groups.add(tag)
Character -> characters.add(tag)
Parody -> if (tag != TAG_ORIGINAL) parodies.add(tag)
Other -> otherTags.add(tag)
Location, Other -> otherTags.add(tag)
Female, Male, Mixed -> ns.prefix.let { otherTags.add("$it:$tag") }
else -> Unit
}