응원가 공유·플레이어 문구 '오늘의' → 제작일 표기 (예: 8월 28일 OO 응원가)
songs API에 dateKst(경기일) 추가, OG 공유 제목·프론트 shareText·artist에 적용 — 매일 갱신되는 콘텐츠임을 드러낸다 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
df367070ce
commit
bb930cc59f
@ -58,7 +58,10 @@ def _team_label(code: str | None) -> str:
|
|||||||
async def song_share(
|
async def song_share(
|
||||||
match_id: str, team_code: str, db: AsyncSession = Depends(get_db)
|
match_id: str, team_code: str, db: AsyncSession = Depends(get_db)
|
||||||
) -> HTMLResponse:
|
) -> HTMLResponse:
|
||||||
"""응원가 공유 OG — '오늘의 OO 응원가' 제목 + Suno 앨범아트 썸네일."""
|
"""응원가 공유 OG — '8월 28일 OO 응원가' 제목 + Suno 앨범아트 썸네일.
|
||||||
|
|
||||||
|
제목의 날짜는 제작일(경기일 KST) — 매일 갱신되는 콘텐츠임을 드러낸다.
|
||||||
|
"""
|
||||||
s = (
|
s = (
|
||||||
await db.execute(
|
await db.execute(
|
||||||
select(Song).where(Song.match_id == match_id, Song.team_code == team_code)
|
select(Song).where(Song.match_id == match_id, Song.team_code == team_code)
|
||||||
@ -66,9 +69,10 @@ async def song_share(
|
|||||||
).scalar_one_or_none()
|
).scalar_one_or_none()
|
||||||
team = (s.team_name if s else "") or _team_label(team_code) or team_code
|
team = (s.team_name if s else "") or _team_label(team_code) or team_code
|
||||||
song_title = (s.title if s else "") or f"{team} 응원가"
|
song_title = (s.title if s else "") or f"{team} 응원가"
|
||||||
title = f"오늘의 {team} 응원가 — {song_title}"
|
day = f"{s.date_kst.month}월 {s.date_kst.day}일" if s and s.date_kst else "오늘의"
|
||||||
|
title = f"{day} {team} 응원가 — {song_title}"
|
||||||
desc = (
|
desc = (
|
||||||
"AI가 오늘 경기(순위·선발 라인업·전날 결과)를 반영해 만든 응원가. "
|
"AI가 경기 당일(순위·선발 라인업·전날 결과)을 반영해 매일 새로 만드는 응원가. "
|
||||||
"듣고 나서 GPT·Claude·Gemini와 승부예측도 겨뤄보세요!"
|
"듣고 나서 GPT·Claude·Gemini와 승부예측도 겨뤄보세요!"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,8 @@ def _song_out(s: Song) -> dict:
|
|||||||
"teamName": s.team_name,
|
"teamName": s.team_name,
|
||||||
"title": s.title,
|
"title": s.title,
|
||||||
"lyrics": s.lyrics,
|
"lyrics": s.lyrics,
|
||||||
|
# 제작일(경기일 KST) — 공유·플레이어 문구의 "8월 28일 OO 응원가" 표기용
|
||||||
|
"dateKst": s.date_kst.isoformat() if s.date_kst else None,
|
||||||
"tracks": tracks,
|
"tracks": tracks,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,6 +57,8 @@ export interface SongOut {
|
|||||||
teamName: string;
|
teamName: string;
|
||||||
title: string;
|
title: string;
|
||||||
lyrics?: string;
|
lyrics?: string;
|
||||||
|
/** 제작일(경기일 KST, YYYY-MM-DD) — "8월 28일 OO 응원가" 표기용 */
|
||||||
|
dateKst?: string | null;
|
||||||
tracks: SongTrackOut[];
|
tracks: SongTrackOut[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,14 +42,18 @@ function fetchMatchSongsCached(matchId: string): Promise<SongOut[]> {
|
|||||||
|
|
||||||
function songToTracks(s: SongOut): Track[] {
|
function songToTracks(s: SongOut): Track[] {
|
||||||
const base = s.title || `${s.teamName} 응원가`;
|
const base = s.title || `${s.teamName} 응원가`;
|
||||||
// 공유는 응원가 전용 링크 — 크롤러에 "오늘의 OO 응원가" OG 카드가 나간다
|
// 제작일 표기 ("8월 28일") — 매일 갱신되는 콘텐츠임을 드러낸다. 날짜 없으면 "오늘의"
|
||||||
|
const day = s.dateKst
|
||||||
|
? `${Number(s.dateKst.slice(5, 7))}월 ${Number(s.dateKst.slice(8, 10))}일`
|
||||||
|
: "오늘의";
|
||||||
|
// 공유는 응원가 전용 링크 — 크롤러에 "8월 28일 OO 응원가" OG 카드가 나간다
|
||||||
const shareUrl = `${window.location.origin}/song/${s.matchId}/${s.teamCode}`;
|
const shareUrl = `${window.location.origin}/song/${s.matchId}/${s.teamCode}`;
|
||||||
const shareText = `오늘의 ${s.teamName} 응원가 「${base}」 — TriplePick`;
|
const shareText = `${day} ${s.teamName} 응원가 「${base}」 — TriplePick`;
|
||||||
return (s.tracks || [])
|
return (s.tracks || [])
|
||||||
.filter((t) => t.audioUrl)
|
.filter((t) => t.audioUrl)
|
||||||
.map((t, i) => ({
|
.map((t, i) => ({
|
||||||
title: s.tracks.length > 1 ? `${base} #${i + 1}` : base,
|
title: s.tracks.length > 1 ? `${base} #${i + 1}` : base,
|
||||||
artist: `오늘의 ${s.teamName} 응원가`,
|
artist: `${day} ${s.teamName} 응원가`,
|
||||||
src: t.audioUrl,
|
src: t.audioUrl,
|
||||||
cover: t.imageUrl,
|
cover: t.imageUrl,
|
||||||
lyrics: s.lyrics || undefined,
|
lyrics: s.lyrics || undefined,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user