From 4f67cd02fa66aed49f6b4cf516e4f310b36427da Mon Sep 17 00:00:00 2001 From: gahusb Date: Thu, 7 May 2026 17:43:55 +0900 Subject: [PATCH] =?UTF-8?q?fix(music-lab):=20pipeline=20=EC=9D=91=EB=8B=B5?= =?UTF-8?q?=EC=97=90=20track=5Ftitle=20=ED=8F=AC=ED=95=A8=20(LEFT=20JOIN?= =?UTF-8?q?=20music=5Flibrary)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- music-lab/app/db.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/music-lab/app/db.py b/music-lab/app/db.py index b60199e..de5cd11 100644 --- a/music-lab/app/db.py +++ b/music-lab/app/db.py @@ -958,7 +958,12 @@ def create_pipeline(track_id: int) -> int: def get_pipeline(pid: int) -> Optional[Dict[str, Any]]: with _conn() as conn: - row = conn.execute("SELECT * FROM video_pipelines WHERE id = ?", (pid,)).fetchone() + row = conn.execute(""" + SELECT vp.*, ml.title AS track_title + FROM video_pipelines vp + LEFT JOIN music_library ml ON ml.id = vp.track_id + WHERE vp.id = ? + """, (pid,)).fetchone() if not row: return None return _parse_pipeline_row(row) @@ -985,15 +990,16 @@ def update_pipeline_state(pid: int, state: str, **fields) -> None: def list_pipelines(active_only: bool = False) -> List[Dict[str, Any]]: + sql = """ + SELECT vp.*, ml.title AS track_title + FROM video_pipelines vp + LEFT JOIN music_library ml ON ml.id = vp.track_id + """ + if active_only: + sql += " WHERE vp.state NOT IN ('published','cancelled','failed','awaiting_manual')" + sql += " ORDER BY vp.created_at DESC" with _conn() as conn: - if active_only: - rows = conn.execute(""" - SELECT * FROM video_pipelines - WHERE state NOT IN ('published','cancelled','failed','awaiting_manual') - ORDER BY created_at DESC - """).fetchall() - else: - rows = conn.execute("SELECT * FROM video_pipelines ORDER BY created_at DESC").fetchall() + rows = conn.execute(sql).fetchall() return [_parse_pipeline_row(r) for r in rows]