원곡찾기: MV·inst.·라이브·커버는 길이가 같아도 확정하지 않음 — 검색 줄 제목(점수 경로 포함)과 실제 영상 제목(oEmbed) 모두. 길이가 같은 결과의 실제 영상이 '광 (Official MV)'·'(Inst.)'이면 matched로 저장되던 것. 회귀 테스트(매칭·reconfirm)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -52,8 +52,9 @@ test('scoring: title+artist confident whatever the length, MR/cover/MV/other mix
|
||||
expect(isConfident(scoreResult(song, yt('광 (Sleep Mix)', 'SG워너비', 3600), 0))).toBe(false);
|
||||
expect(isConfident(scoreResult(song, yt('광 (2021)', 'SG워너비', 300), 0))).toBe(false);
|
||||
expect(isConfident(scoreResult(song, { ...yt('광', 'SG워너비', 300), topic: false }, 0))).toBe(false);
|
||||
// an MV with the same length still counts as before (score path)
|
||||
expect(isConfident(scoreResult(song, yt('광 (Official MV)', 'SG워너비', 238), 0))).toBe(true);
|
||||
// an MV or inst. is never the original, even with the same length
|
||||
expect(isConfident(scoreResult(song, yt('광 (Official MV)', 'SG워너비', 237), 0))).toBe(false);
|
||||
expect(isConfident(scoreResult(song, { ...yt('광 (Official MV)', 'SG워너비', 237), topic: false }, 0))).toBe(false);
|
||||
// a 38-second track or a 10-minute one under the same title is an intro, skit or megamix, not the song
|
||||
expect(isConfident(scoreResult(song, yt('광', 'SG워너비', 38), 0))).toBe(false);
|
||||
expect(isConfident(scoreResult(song, yt('광', 'SG워너비', 555), 0))).toBe(false);
|
||||
@@ -180,6 +181,26 @@ test('artist names learnt from confirmed songs (2+ songs) confirm waiting candid
|
||||
expect(st(farMv).youtube_status).toBe('candidate');
|
||||
});
|
||||
|
||||
test('YouTube matching: the actual video being an MV or inst. keeps the song a 후보 even with the same length', async () => {
|
||||
const db = freshDb();
|
||||
const c = new Catalog(db);
|
||||
const [mv] = c.upsert({ title: '광', artists: [{ name: 'SG워너비' }], durationSec: 237, source: 't', ref: '1' });
|
||||
const [inst] = c.upsert({ title: '내사람', artists: [{ name: 'SG워너비' }], durationSec: 300, source: 't', ref: '2' });
|
||||
const results: Record<string, YtmSong[]> = {
|
||||
'SG워너비 광': [{ videoId: 'gwangmv0001', title: '광', artists: 'SG워너비', album: null, durationSec: 237 }],
|
||||
'SG워너비 내사람': [{ videoId: 'mineinst001', title: '내사람', artists: 'SG워너비', album: null, durationSec: 300 }],
|
||||
};
|
||||
const titles: Record<string, string> = { gwangmv0001: '광 (Official MV)', mineinst001: '내사람 (Inst.)' };
|
||||
const stats = await matchYoutube(db, { searchSongs: async (q) => results[q] ?? [] }, { delayMs: 0 }, async (id) => ({ state: 'ok', author: 'SG Wannabe', title: titles[id]! }));
|
||||
expect(stats.matched).toBe(0);
|
||||
const st = (id: number) => db.query<{ youtube_status: string }, [number]>('SELECT youtube_status FROM songs WHERE id = ?').get(id)!.youtube_status;
|
||||
expect(st(mv!)).toBe('candidate');
|
||||
expect(st(inst!)).toBe('candidate');
|
||||
// reconfirm-youtube checks the same way
|
||||
expect((await reconfirmCandidates(db, { delayMs: 0 }, async (id) => ({ state: 'ok', author: 'SG Wannabe', title: titles[id]! }))).matched).toBe(0);
|
||||
expect([st(mv!), st(inst!)]).toEqual(['candidate', 'candidate']);
|
||||
});
|
||||
|
||||
function freshDb() {
|
||||
return openDb(tempDbPath());
|
||||
}
|
||||
|
||||
@@ -43,12 +43,12 @@ function setAutoVideo(db: Database, id: number, status: 'matched' | 'candidate',
|
||||
}
|
||||
|
||||
/**
|
||||
* A result confirmed despite a length difference (title + artist) whose actual video turns out to be a music video,
|
||||
* inst., live, another mix … (the YouTube title, not the search row): left as 후보.
|
||||
* The actual video (its YouTube title, not the search row) turns out to be a music video, inst., live … — whatever the
|
||||
* length — or, for a result confirmed despite a length difference, another mix/edit/year: left as 후보.
|
||||
*/
|
||||
function isOtherCut(c: Scored, videoTitle: string, songTitle: string): boolean {
|
||||
if (!confirmedDespiteLength(c)) return false;
|
||||
return (isVideoTitle(videoTitle) && !isVideoTitle(songTitle)) || (isJunkTitle(videoTitle) && !isJunkTitle(songTitle)) || namesOtherCut(videoTitle, songTitle);
|
||||
if ((isVideoTitle(videoTitle) && !isVideoTitle(songTitle)) || (isJunkTitle(videoTitle) && !isJunkTitle(songTitle))) return true;
|
||||
return confirmedDespiteLength(c) && namesOtherCut(videoTitle, songTitle);
|
||||
}
|
||||
|
||||
async function searchRetry(ytm: Pick<YtMusic, 'searchSongs'>, query: string, job: Job | null): Promise<YtmSong[]> {
|
||||
|
||||
@@ -10,7 +10,7 @@ const BENIGN = /\b(?:radio edit|original|album|single|mono|stereo|remaster(?:ed)
|
||||
export const MAX_LENGTH_DIFF = 15;
|
||||
/** An artist that only sounds the same in the other script (디제이디오씨 ~ DJ DOC) confirms only this close. */
|
||||
export const MAX_SOUND_LENGTH_DIFF = 8;
|
||||
/** A music video or another cut of the song: never confirmed by title and artist alone when the length is off. */
|
||||
/** A music video, lyric video, stage clip …: never confirmed (unless the song's own title says so). */
|
||||
/** Words of a different cut or recording: a mix, an edit, a dated re-recording … (only used when the length is off too). */
|
||||
const CUT = /\b(?:mix|edit|ver|version|edition|demo|medley|reprise|session|take|cut|re-?recorded|piano|orchestra|strings|sleep|lo-?fi|extended|short|full|intro|outro)\b|\b(?:19|20)\d{2}\b|버전|믹스/gi;
|
||||
/** A remaster is the same recording: "(2021 Remastered)" is not a dated re-recording. */
|
||||
@@ -100,16 +100,17 @@ export function scoreResult(song: { title: string; artist: string; durationSec:
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto-confirm, any of:
|
||||
* Never a cover/inst./live (junk) or a music video. Otherwise auto-confirm, any of:
|
||||
* - title + artist, whatever the length (a different take or a wrong Melon length), unless the result is a cover/inst./live
|
||||
* (junk), a music video or not an official Topic track — and when the length is off, unless it names another mix/edit/year
|
||||
* not an official Topic track — and when the length is off, unless it names another mix/edit/year
|
||||
* or the title is one artists reuse ("Intro"), or the result is under 90 seconds / over 7 minutes and twice the song's length;
|
||||
* - title + artist written in the other script that sounds the same, within MAX_SOUND_LENGTH_DIFF seconds;
|
||||
* - title + a close length (score 70+, e.g. without the artist), within MAX_LENGTH_DIFF seconds.
|
||||
*/
|
||||
export function isConfident(s: Scored): boolean {
|
||||
if (!s.titleOk) return false;
|
||||
const plain = !s.junk && !s.video && s.topic !== false;
|
||||
// a music video, inst., live, cover … is never the original, whatever its length
|
||||
if (!s.titleOk || s.junk || s.video) return false;
|
||||
const plain = s.topic !== false;
|
||||
const lengthOff = s.lengthDiff !== null && s.lengthDiff > MAX_LENGTH_DIFF;
|
||||
if (s.artistOk && plain && !(lengthOff && (s.otherCut || s.genericTitle || s.oddLength))) return true;
|
||||
if (s.artistSound && plain && s.lengthDiff !== null && s.lengthDiff <= MAX_SOUND_LENGTH_DIFF) return true;
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
2. 쌓인 후보는 `cli.ts reconfirm-youtube`로 저장된 검색 결과를 다시 비교했다(2,313곡 중 282곡 확정). 관리자 원곡 찾기 목록은 채널 이름 대신 실제 가수와 확정 안 된 이유를 보여 준다
|
||||
|
||||
## 원곡 찾기 자동 확정 기준 2차 (2026-10-29, 사용자 확인)
|
||||
1. **제목 + 가수가 맞으면 곡 길이가 달라도 확정**(다른 녹음·멜론 길이 오류). 단 길이가 15초 넘게 다를 때는 결과가 MV·가사 영상·inst.·라이브·커버이거나, 노래 제목에 없는 믹스/에디트/버전/연도(`(Sleep Mix)`, `(2021)`)가 붙었거나, 제목이 Intro·Outro처럼 흔하거나, 멜론은 보통 길이(90초 이상)인데 영상이 90초 미만이거나 7분 넘으면서 2배 넘게 길면(인트로·짧은 버전·메가믹스) 보류. 실제 영상 제목(oEmbed)도 같은 기준으로 한 번 더 본다. 리마스터는 같은 녹음. 공식 Topic이 아닌 일반 유튜브 영상은 길이 무시 안 함
|
||||
1. **제목 + 가수가 맞으면 곡 길이가 달라도 확정**(다른 녹음·멜론 길이 오류). 결과(검색 줄 제목이든 실제 영상 제목이든)가 MV·가사 영상·inst.·라이브·커버면 길이와 관계없이 확정하지 않는다. 길이가 15초 넘게 다를 때는 노래 제목에 없는 믹스/에디트/버전/연도(`(Sleep Mix)`, `(2021)`)가 붙었거나, 제목이 Intro·Outro처럼 흔하거나, 멜론은 보통 길이(90초 이상)인데 영상이 90초 미만이거나 7분 넘으면서 2배 넘게 길면(인트로·짧은 버전·메가믹스) 보류. 실제 영상 제목(oEmbed)도 같은 기준으로 한 번 더 본다. 리마스터는 같은 녹음. 공식 Topic이 아닌 일반 유튜브 영상은 길이 무시 안 함
|
||||
2. **"한글 English" 표기 나눠 비교**: `북극성 Polaris`, `헤이즈 Heize`, `더 클래식 The Classic`(괄호 없이 띄어쓰기로 붙은 것). 제목을 나눠 맞춘 것은 가수도 맞을 때만 인정(다른 가수의 `작은 촛불 Little Flame`과 길이가 같다고 확정하지 않음). 뒤 영어가 몇 번째 곡을 뜻하면(`Part 2`, `I`, `Vol.1`) 나누지 않고, `/`·`+`로 여러 곡을 이은 메들리도 나누지 않음
|
||||
3. **한글/영문 가수 이름은 발음으로 비교**(`collector/sound.ts`): 자음 뼈대가 같고, `Park Jung Hyun`처럼 로마자 한국 이름이면 모음 계열(아/에/오/이)도 같아야 함. 성이 뒤로 간 이름(`Bo Kyung Kim`), 알파벳 읽기(`DJ DOC`=디제이디오씨, `S.E.S.`=에스이에스) 포함. 발음으로만 맞은 곡은 제목이 같고 길이 차이 8초 이내일 때만 확정
|
||||
4. **다른 문자 이름으로 다시 검색**: 결과에 그 가수의 곡이 하나도 없으면, 저장된 검색 결과에서 발음이 같은 다른 문자 이름(`DJ DOC`)을 찾아 `이름 제목`으로 한 번 더 검색(매일 원곡 찾기에 포함). 이 검색 결과는 그 가수 곡일 때만 확정. 이미 쌓인 후보는 `cli.ts research-youtube`(검색 방법별 한 번씩, `yt_research_<source>`)
|
||||
|
||||
Reference in New Issue
Block a user