Centralize exact subcategory selectors

This commit is contained in:
2026-06-27 15:09:36 +02:00
parent 5ae2f31a20
commit 728d3e559c
5 changed files with 131 additions and 8 deletions
+10 -1
View File
@@ -4,6 +4,11 @@ import json
import re
from typing import Any
try:
from . import category_library as category_policy
except ImportError: # Allows local smoke tests from the repository root.
import category_library as category_policy
INSTA_OF_SOFT_LEVELS = {
"social_tease": "Instagram-style thirst-trap post, suggestive polished social feed energy",
@@ -409,7 +414,11 @@ def softcore_category(level: str) -> tuple[str, str]:
level,
INSTA_OF_SOFTCORE_SUBCATEGORY_BY_LEVEL["lingerie_tease"],
)
category, _subcategory = subcategory.split(" / ", 1)
exact_choice = category_policy.split_exact_subcategory_choice(
category_policy.load_category_library(),
subcategory,
)
category = exact_choice[0]["name"] if exact_choice else subcategory.split(" / ", 1)[0]
return category, subcategory