정답 자동 생성: 플레이리스트 가져오기가 제목을 먼저 정리한 뒤 정답을 만들어 괄호 안 다른 이름(LOVE SCENARIO)·일본어 원제·그 발음을 잃던 것 — 찾은 그대로의 제목으로 정답을 만들고 화면에는 정리된 제목. 괄호 안 한글로 이미 바뀐 일본어 제목(夜に駆ける (밤에 달리다))은 위키백과 우선 처리를 건너뛰던 것 — 원제로 위키백과 → 괄호 안 한글 → 읽는 소리 순서를 정하고, 밀린 괄호 안 한글 이름은 정답으로 남김. 회귀 테스트 2개(고치기 전 코드에서 실패 확인)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-11-04 16:19:06 +09:00
parent b0bfad6f6e
commit 04da87562b
3 changed files with 61 additions and 2 deletions

View File

@@ -138,6 +138,7 @@ async function runImport(d: ImportDeps, job: ImportJob, tracks: LavalinkTrack[])
'SELECT id, title, artist, youtube_id, youtube_status, duration_sec FROM songs WHERE match_key = ? AND deleted_at IS NULL ORDER BY youtube_status = \'matched\' DESC LIMIT 1',
);
const aliases = aliasesOf(d.db);
const rawTitles: string[] = [];
for (const [i, t] of tracks.entries()) {
const dur = t.length ? Math.round(t.length / 1000) : null;
const yt = t.sourceName === 'youtube';
@@ -177,6 +178,8 @@ async function runImport(d: ImportDeps, job: ImportJob, tracks: LavalinkTrack[])
if (i < tracks.length - 1) await Bun.sleep(d.delayMs ?? 700);
}
// shown title without brackets / feat. / version marks (the answers come at the end, docs/13)
// the title as found goes to the answers below (its brackets hold other names), the row shows it cleaned meanwhile
rawTitles.push(row.title);
row.title = cleanTitle(row.title).title;
job.rows.push(row);
job.done = i + 1;
@@ -184,7 +187,7 @@ async function runImport(d: ImportDeps, job: ImportJob, tracks: LavalinkTrack[])
// answers for every song at once: 한글 발음, 일본어 읽기 (one process), J-POP 한글 이름 (위키백과)
const answers = await songAnswersBatch(
d.db,
job.rows.map((r) => ({ title: r.title, artist: r.artist, songId: r.songId })),
job.rows.map((r, i) => ({ title: rawTitles[i]!, artist: r.artist, songId: r.songId })),
{ korean: true, wiki: d.wiki, read: d.read },
);
job.rows.forEach((r, i) => {