"""Shared helpers, serializers and constants for the plex route package.""" from typing import TYPE_CHECKING from sqlalchemy.orm import Session from app import logs from app.plex import queries from app.plex.cards import norm_lang as _norm_lang # noqa: F401 — the package's historic name from app.routes._common import not_found if TYPE_CHECKING: from app.plex.models import PlexItem log = logs.get_logger(__name__) def item_or_404(db: Session, rating_key: str) -> "PlexItem": it = queries.item(db, rating_key) if it is None: raise not_found("plex_item") return it