Centralize exact subcategory selectors
This commit is contained in:
+10
-1
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user