From 94be8a07469d8e2cf84c38a27c4a50b8bfda374a Mon Sep 17 00:00:00 2001 From: jaehwang Date: Tue, 20 Jan 2026 15:11:03 +0900 Subject: [PATCH] upload db on timestamped lyric --- app/song/api/routers/v1/song.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/song/api/routers/v1/song.py b/app/song/api/routers/v1/song.py index ce49696..25c9ffe 100644 --- a/app/song/api/routers/v1/song.py +++ b/app/song/api/routers/v1/song.py @@ -25,6 +25,8 @@ from app.dependencies.pagination import ( from app.home.models import Project from app.lyric.models import Lyric from app.song.models import Song +from app.song.models import SongTimestamp + from app.song.schemas.song_schema import ( DownloadSongResponse, GenerateSongRequest, @@ -390,6 +392,17 @@ async def get_song_status( timestamped_lyrics = await suno_service.align_lyrics(word_data, sentences) # TODO : DB upload timestamped_lyrics + for order_idx, timestamped_lyric in enumerate(timestamped_lyrics): + song_timestamp = SongTimestamp( + suno_audio_id = suno_audio_id, + order_idx = order_idx, + lyric_line = timestamped_lyric["text"], + start_time = timestamped_lyric["start_sec"], + end_time = timestamped_lyric["end_sec"] + ) + session.add(song_timestamp) + + await session.commit() if song and song.status != "completed": # 첫 번째 클립의 audio_url과 duration을 직접 DB에 저장