Accept flexible hardcore metadata labels

This commit is contained in:
2026-06-27 14:33:34 +02:00
parent 95dc8939b6
commit 0a0951e5e5
3 changed files with 98 additions and 5 deletions
+45 -4
View File
@@ -1,5 +1,6 @@
from __future__ import annotations
import re
from typing import Any
try:
@@ -44,9 +45,32 @@ HARDCORE_ACTION_FAMILY_CHOICES = {
def normalize_hardcore_action_family(value: Any, default: str = "") -> str:
text = str(value or "").strip().lower()
if text == "penetrative":
text = ACTION_PENETRATION
text = re.sub(r"[^a-z0-9]+", "_", str(value or "").strip().lower()).strip("_")
aliases = {
"penetrative": ACTION_PENETRATION,
"penetrative_sex": ACTION_PENETRATION,
"penetration_sex": ACTION_PENETRATION,
"vaginal": ACTION_PENETRATION,
"vaginal_penetration": ACTION_PENETRATION,
"double": ACTION_TOY_DOUBLE,
"double_penetration": ACTION_TOY_DOUBLE,
"toy_double_penetration": ACTION_TOY_DOUBLE,
"toy_assisted_double": ACTION_TOY_DOUBLE,
"toy_assisted_double_penetration": ACTION_TOY_DOUBLE,
"outer_course": ACTION_OUTERCOURSE,
"outercourse_sex": ACTION_OUTERCOURSE,
"manual": ACTION_FOREPLAY,
"manual_stimulation": ACTION_FOREPLAY,
"interaction": ACTION_FOREPLAY,
"body_worship": ACTION_FOREPLAY,
"body_worship_touching": ACTION_FOREPLAY,
"foreplay_teasing": ACTION_FOREPLAY,
"cumshot": ACTION_CLIMAX,
"cumshot_climax": ACTION_CLIMAX,
"orgasm_aftermath": ACTION_CLIMAX,
"oral_sex": ACTION_ORAL,
}
text = aliases.get(text, text)
return text if text in HARDCORE_ACTION_FAMILY_CHOICES else default
@@ -86,7 +110,24 @@ def source_hardcore_action_family(
inferred = infer_hardcore_action_family(role_graph, hard_item, composition, axis_values)
if inferred in (ACTION_CLIMAX, ACTION_TOY_DOUBLE):
return inferred
family = str(source_family or "").strip().lower()
family = re.sub(r"[^a-z0-9]+", "_", str(source_family or "").strip().lower()).strip("_")
family = {
"penetration": "penetrative",
"penetrative_sex": "penetrative",
"outer_course": "outercourse",
"outercourse_sex": "outercourse",
"manual_stimulation": "manual",
"foreplay_teasing": "foreplay",
"body_worship": "interaction",
"body_worship_touching": "interaction",
"clothing_position_transitions": "interaction",
"dominant_guidance": "interaction",
"camera_performance": "interaction",
"group_coordination": "interaction",
"cumshot": "climax",
"cumshot_climax": "climax",
"oral_sex": "oral",
}.get(family, family)
source_mapping = {
"penetrative": ACTION_PENETRATION,
"foreplay": ACTION_FOREPLAY,