mingming2323's picture
Rename to 러브로그(LoveLog) and clean up unused files
ff932fe
"""장면별 이미지 — PNG를 base64로 로드."""
import base64
from pathlib import Path
SCENE_TAGS = [
"cafe", "restaurant", "park", "street", "store",
"home", "bar", "phone", "cinema", "night",
]
_IMG_DIR = Path(__file__).parent / "scene_images"
def _load_images() -> tuple[dict[str, str], str]:
images = {}
for tag in SCENE_TAGS:
path = _IMG_DIR / f"{tag}.png"
if path.exists():
b64 = base64.b64encode(path.read_bytes()).decode()
images[tag] = f"data:image/png;base64,{b64}"
default_path = _IMG_DIR / "default.png"
default = ""
if default_path.exists():
b64 = base64.b64encode(default_path.read_bytes()).decode()
default = f"data:image/png;base64,{b64}"
return images, default
_SCENE_IMAGES, _DEFAULT_IMAGE = _load_images()
SCENE_TAGS_STR = ", ".join(SCENE_TAGS)
def get_scene_image(tag: str) -> str:
"""태그에 해당하는 이미지의 base64 data URI 반환."""
return _SCENE_IMAGES.get(tag, _DEFAULT_IMAGE)