diff --git a/apps/server/src/collector/collector.test.ts b/apps/server/src/collector/collector.test.ts index f84384e..38ecef8 100644 --- a/apps/server/src/collector/collector.test.ts +++ b/apps/server/src/collector/collector.test.ts @@ -54,6 +54,11 @@ test('scoring: title+artist confident whatever the length, MR/cover/MV/other mix 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); + // 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); + // a wrong Melon length (62 seconds) does not count as a normal song + expect(isConfident(scoreResult({ title: "I'll Be There", artist: '이브', durationSec: 62 }, yt("I'll Be There", '이브(Eve)', 253), 0))).toBe(true); // a title artists reuse album after album expect(isConfident(scoreResult({ title: 'Intro', artist: '나얼', durationSec: 214 }, yt('Intro', '나얼 Naul', 56), 0))).toBe(false); expect(isConfident(scoreResult(song, yt('다른 노래', 'SG워너비', 237), 0))).toBe(false); diff --git a/apps/server/src/collector/score.ts b/apps/server/src/collector/score.ts index e9590eb..cec142b 100644 --- a/apps/server/src/collector/score.ts +++ b/apps/server/src/collector/score.ts @@ -35,6 +35,8 @@ export interface Scored extends YtmSong { otherCut: boolean; /** The song's title is one artists reuse ("Intro"). */ genericTitle: boolean; + /** A normal-length song but a result under 90 seconds (an intro, skit, preview) or over 7 minutes and twice as long (a megamix). */ + oddLength: boolean; /** |song length − result length| in seconds, null when either is unknown. */ lengthDiff: number | null; } @@ -93,14 +95,15 @@ export function scoreResult(song: { title: string; artist: string; durationSec: if (junk) score -= 40; const video = isVideoTitle(r.title) && !isVideoTitle(song.title); const otherCut = namesOtherCut(r.title, song.title); - return { ...r, score, titleOk, artistOk, artistSound, junk, video, otherCut, genericTitle: GENERIC_TITLE.test(song.title), lengthDiff }; + const oddLength = !!song.durationSec && song.durationSec >= 90 && !!r.durationSec && (r.durationSec < 90 || (r.durationSec > 420 && r.durationSec > 2 * song.durationSec)); + return { ...r, score, titleOk, artistOk, artistSound, junk, video, otherCut, genericTitle: GENERIC_TITLE.test(song.title), oddLength, lengthDiff }; } /** * 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 - * or the title is one artists reuse ("Intro"); + * 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. */ @@ -108,7 +111,7 @@ export function isConfident(s: Scored): boolean { if (!s.titleOk) return false; const plain = !s.junk && !s.video && s.topic !== false; const lengthOff = s.lengthDiff !== null && s.lengthDiff > MAX_LENGTH_DIFF; - if (s.artistOk && plain && !(lengthOff && (s.otherCut || s.genericTitle))) return true; + 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; return s.score >= 70 && (s.lengthDiff === null || s.lengthDiff <= MAX_LENGTH_DIFF); } @@ -130,6 +133,7 @@ export function notConfidentReasons(s: Scored): string[] { if (s.artistOk && s.lengthDiff !== null && s.lengthDiff > MAX_LENGTH_DIFF) { if (s.otherCut) out.push(`길이 ${s.lengthDiff}초 차이 · 믹스·연도 등 다른 버전 표시`); else if (s.genericTitle) out.push(`길이 ${s.lengthDiff}초 차이 · 흔한 제목(Intro 등)`); + else if (s.oddLength) out.push(`길이 ${s.lengthDiff}초 차이 · 영상이 너무 짧거나 김(인트로·짧은 버전 등)`); } if (s.junk) out.push('커버·노래방·라이브 등 다른 버전'); if (s.video) out.push('뮤직비디오·가사 영상 등'); diff --git a/docs/12-decisions.md b/docs/12-decisions.md index 6ee37de..ce1d151 100644 --- a/docs/12-decisions.md +++ b/docs/12-decisions.md @@ -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처럼 흔하면 보류. 실제 영상 제목(oEmbed)도 같은 기준으로 한 번 더 본다. 리마스터는 같은 녹음. 공식 Topic이 아닌 일반 유튜브 영상은 길이 무시 안 함 +1. **제목 + 가수가 맞으면 곡 길이가 달라도 확정**(다른 녹음·멜론 길이 오류). 단 길이가 15초 넘게 다를 때는 결과가 MV·가사 영상·inst.·라이브·커버이거나, 노래 제목에 없는 믹스/에디트/버전/연도(`(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_`)