diff --git a/app/p2v/api/routers/v1/public.py b/app/p2v/api/routers/v1/public.py index fcec472..99f6c5a 100644 --- a/app/p2v/api/routers/v1/public.py +++ b/app/p2v/api/routers/v1/public.py @@ -11,7 +11,8 @@ from sqlalchemy.ext.asyncio import AsyncSession from app.database.session import get_session from app.p2v.constants import JOB_TYPE_PLAYREEL, JOB_TYPE_VIDEO from app.p2v.schemas.public import P2vDetailResponse -from app.p2v.services.public_content import fetch_public, like_state, poster_of +from app.p2v.services.public_content import (fetch_public, like_state, narration_text_of, + poster_of) from app.user.dependencies.auth import get_current_user_optional from app.user.models import User from app.utils.upload_blob_as_request import to_playback_url @@ -57,7 +58,7 @@ async def share_page( raise HTTPException(404, "공유 가능한 콘텐츠를 찾을 수 없습니다.") html = build_p2v_share_html( P2vShareData(ctype=ctype, content_id=row.id, poster_url=poster_of(ctype, row), - name=row.name), + name=row.name, description=narration_text_of(ctype, row)), share_url=resolve_share_url( request.headers, str(request.url).split("?", maxsplit=1)[0], diff --git a/app/p2v/services/public_content.py b/app/p2v/services/public_content.py index 56167eb..8c36cde 100644 --- a/app/p2v/services/public_content.py +++ b/app/p2v/services/public_content.py @@ -60,6 +60,14 @@ def poster_of(ctype: str, row) -> str | None: return row.thumbnail_url if ctype == JOB_TYPE_VIDEO else playreel_thumbnail_url(row) +def narration_text_of(ctype: str, row) -> str | None: + """공유 설명으로 쓰는 내레이션 한 줄. 무빙 포스터만 지원하고 없으면 None.""" + if ctype != JOB_TYPE_VIDEO: + return None + lines = [str(line).strip() for line in row.narration_lines or [] if line] + return " ".join(line for line in lines if line) or None + + async def like_state( session: AsyncSession, ctype: str, content_id: int, user_uuid: str | None ) -> tuple[int, bool]: diff --git a/app/video/services/share_page.py b/app/video/services/share_page.py index c0bfd70..d9dc169 100644 --- a/app/video/services/share_page.py +++ b/app/video/services/share_page.py @@ -166,6 +166,7 @@ class P2vShareData: content_id: int poster_url: str | None name: str | None = None + description: str | None = None def build_p2v_share_html( @@ -181,7 +182,7 @@ def build_p2v_share_html( detail_path=f"{path_prefix}/{data.content_id}", poster_url=data.poster_url, title=_share_title(data.name, fallback_title, fallback_store=fallback_title), - description=_share_description(None), + description=_share_description(data.description), share_url=share_url, frontend_base_url=frontend_base_url, configured_default_image_url=configured_default_image_url,