재생목록으로 엑셀 만들기: 관리자 → 퀴즈 목록 카드. 플레이리스트 가져오기와 같은 검토(서버 DB 곡, 영상 제목 정리, 스포티파이는 유튜브 뮤직 검색, 다른 사이트 재생 확인) 결과를 파일로 만들기가 그대로 읽는 엑셀로 받음 — 시트 '퀴즈'(순번·유튜브 영상 링크·제목·가수·시작(초)·하이라이트(초)·길이(초)·비고)와 '빠진 곡'(재생 막힘·없는 영상·못 찾은 곡·같은 영상, 이유와 함께; 제목 열이 없어 곡으로 읽히지 않음). 비고: DB 곡 / 제목·가수 확인 필요(영상 제목에 가수-제목 형식이 없어 채널 이름을 가수로 씀, 플레이리스트 가져오기에도 표시) / 확인 필요 / 유튜브 뮤직에서 찾음. 조회수 열은 넣지 않음(이지선다는 서버가 불러옴). 파일로 만들기·파일에서 가져오기: '시작·하이라이트가 빈 곡: 자동 / 처음부터' 선택(처음부터 = 0/0으로 적어 하이라이트부터 방에서도 처음부터), 길이(초) 열 읽기. 파일로 만들기의 자동 곡은 서버 DB에 같은 영상이 있으면 그 하이라이트(직접 위치로)와 길이를 씀 — 파일 곡은 DB와 연결하지 않아 자동이 늘 처음부터였던 것. writeXlsxSheets(여러 시트). 단위·API 테스트, e2e quiz 단계, docs 10·12
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -46,15 +46,18 @@ export async function loadPlaylist(ll: Lavalink, url: string, fetchImpl: typeof
|
||||
|
||||
const NOISE = /\s*[([【][^)\]】]*(official|m\/?v|music video|lyric|audio|visuali[sz]er|performance|teaser|live clip|가사|뮤직비디오)[^)\]】]*[)\]】]\s*/gi;
|
||||
|
||||
/** "아이유(IU) - 좋은 날 (Official MV)" → 좋은 날 / 아이유(IU); "IVE 아이브 'LOVE DIVE' MV" → LOVE DIVE / IVE 아이브; Topic channels are the artist. */
|
||||
export function cleanVideoTitle(title: string, channel: string): { title: string; artist: string } {
|
||||
/**
|
||||
* "아이유(IU) - 좋은 날 (Official MV)" → 좋은 날 / 아이유(IU); "IVE 아이브 'LOVE DIVE' MV" → LOVE DIVE / IVE 아이브; Topic channels are the artist.
|
||||
* `guessed`: the title had neither form, so the whole title is the song and the channel name the artist (worth a look).
|
||||
*/
|
||||
export function cleanVideoTitle(title: string, channel: string): { title: string; artist: string; guessed: boolean } {
|
||||
const t = title.replace(NOISE, ' ').replace(/\s+(M\/?V|MV|Official Video)$/i, '').replace(/\s+/g, ' ').trim();
|
||||
if (/ - Topic$/.test(channel)) return { title: t, artist: channel.replace(/ - Topic$/, '') };
|
||||
if (/ - Topic$/.test(channel)) return { title: t, artist: channel.replace(/ - Topic$/, ''), guessed: false };
|
||||
const dash = /^(.+?)\s+[-–—]\s+(.+)$/.exec(t);
|
||||
if (dash) return { artist: dash[1]!.trim(), title: dash[2]!.trim() };
|
||||
if (dash) return { artist: dash[1]!.trim(), title: dash[2]!.trim(), guessed: false };
|
||||
const quoted = /^(.+?)\s*['"‘“『「](.+?)['"’”』」]/.exec(t);
|
||||
if (quoted) return { artist: quoted[1]!.trim(), title: quoted[2]!.trim() };
|
||||
return { title: t, artist: channel.replace(/(Official|VEVO|공식)$/i, '').trim() || channel };
|
||||
if (quoted) return { artist: quoted[1]!.trim(), title: quoted[2]!.trim(), guessed: false };
|
||||
return { title: t, artist: channel.replace(/(Official|VEVO|공식)$/i, '').trim() || channel, guessed: true };
|
||||
}
|
||||
|
||||
export type ImportStatus = 'db' | 'video' | 'found' | 'check' | 'missing' | 'blocked';
|
||||
@@ -128,13 +131,13 @@ async function runImport(d: ImportDeps, job: ImportJob, tracks: LavalinkTrack[])
|
||||
for (const [i, t] of tracks.entries()) {
|
||||
const dur = t.length ? Math.round(t.length / 1000) : null;
|
||||
const yt = t.sourceName === 'youtube';
|
||||
const named = yt ? cleanVideoTitle(t.title, t.author) : { title: t.title, artist: t.author };
|
||||
const named = yt ? cleanVideoTitle(t.title, t.author) : { title: t.title, artist: t.author, guessed: false };
|
||||
const row: ImportRow = { n: i + 1, source: { title: t.title, artist: t.author }, title: named.title, artist: named.artist, durationSec: dur, videoId: null, songId: null, status: 'missing', note: '' };
|
||||
const dbSong = (yt ? byVideo.get(t.identifier) : null) ?? byKey.get(songMatchKey(named.title, named.artist));
|
||||
if (yt) {
|
||||
row.videoId = t.identifier;
|
||||
if (dbSong) Object.assign(row, { songId: dbSong.id, title: dbSong.title, artist: dbSong.artist, status: 'db', note: '서버 DB 곡 (플레이리스트 영상 사용)' });
|
||||
else row.status = 'video';
|
||||
else Object.assign(row, { status: 'video', note: named.guessed ? '제목·가수 확인 필요 (영상 제목 형식이 달라 채널 이름을 가수로 씀)' : '' });
|
||||
const e = await d.embed(t.identifier);
|
||||
if (e.state !== 'ok') Object.assign(row, { status: 'blocked', note: e.state === 'noembed' ? '다른 사이트 재생이 막힌 영상' : e.state === 'dead' ? '없는 영상' : '영상 확인 실패' });
|
||||
} else if (dbSong?.youtube_id && dbSong.youtube_status === 'matched') {
|
||||
|
||||
Reference in New Issue
Block a user