원곡찾기: 길이가 다를 때 멜론은 보통 길이인데 영상이 90초 미만(인트로·짧은 버전)이거나 7분 넘으면서 2배 넘게 길면(메가믹스) 제목+가수만으로 확정하지 않음 — 운영 적용 뒤 확인한 이브 - 아가페(38초)·버스커버스커 - 골목길(37초)·룰라 - 꼬마 룰라(50초)·터보 - X-Mas Dance Party(555초)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-29 11:01:06 +09:00
parent dd8ed20572
commit 71251a08a8
3 changed files with 13 additions and 4 deletions

View File

@@ -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);

View File

@@ -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('뮤직비디오·가사 영상 등');