- 노라보세: 8,572곡(멜론 ID·연도·최고순위·장르·5단계 난이도·가사), 500 나는 묶음은 반씩 나눠 재요청, 원본 캐시로 재실행 안전 - 스타맵 803곡: 같은 곡은 합치고(363) 새 곡 440, 맵 제작자 연도(올해)는 버림 - 유튜브: 제목·가수·길이 점수로 확정/후보, 퍼가기 금지 영상 제외, 검색 방식별로 시도 기록 - 관리자: 노래 검색·장르·연도·난이도·유튜브 상태·출처 필터, 편집 패널(미리듣기·후보 선택·하이라이트·별칭·숨김), 수집 기록 - 테스트 32개, e2e에 노래 편집 단계 추가 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
/** Starcraft "노래 맞추기" map songs (data/seed/sta_songs.json, docs/07). Years there are unreliable: used only to fill gaps. */
|
|
import type { Database } from 'bun:sqlite';
|
|
import { Catalog, Job } from './catalog';
|
|
|
|
interface StaSong {
|
|
id: number;
|
|
title: string;
|
|
artist: string;
|
|
year?: number;
|
|
found_in: string[];
|
|
}
|
|
|
|
export async function importSta(db: Database, seedPath: string) {
|
|
const data = (await Bun.file(seedPath).json()) as { songs: StaSong[] };
|
|
const job = new Job(db, 'import-sta', data.songs.length);
|
|
const catalog = new Catalog(db);
|
|
const thisYear = new Date().getFullYear();
|
|
let created = 0;
|
|
for (const [i, s] of data.songs.entries()) {
|
|
const [, isNew] = catalog.upsert({
|
|
title: s.title.trim(),
|
|
artists: [{ name: s.artist.trim() }],
|
|
// 26 songs say "2026" (map maker's date, not the release): only take years before this year.
|
|
year: s.year && s.year < thisYear ? s.year : null,
|
|
genres: ['kpop'],
|
|
source: 'sta',
|
|
ref: String(s.id),
|
|
});
|
|
if (isNew) created++;
|
|
if (i % 100 === 0) job.progress(i);
|
|
}
|
|
job.progress(data.songs.length);
|
|
job.log(`sta done: ${data.songs.length} songs, new ${created} (rest merged into existing songs)`);
|
|
job.finish('done');
|
|
return { total: data.songs.length, created };
|
|
}
|