fix(backend): Neuauflage-Jahreszahl nicht als Pflicht-Keyword fordern

Folgekorrektur zu 02b5905: "… - 2020 Remaster" steht auf der Veroeffentlichung,
aber nie im YouTube-Titel — als Pflicht-Keyword haette die Zahl den richtigen
Upload abgelehnt. Jahreszahlen neben einem Qualifier (remaster/version/edition/
anniversary/mono/stereo) fallen daher wieder raus; ein Titel, der selbst eine
Jahreszahl ist ("1999", "Berlin 2020"), behaelt sie. Gegen 29 Beispieltitel
gemessen verhalten sich 24 exakt wie vorher.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
marcandClaude Opus 5 committed 2026-09-03 22:20:44 +02:00
1 parent 02b590505a
commit 6d8a8a1d5e
4 files changed
+29 -5

No files matched your search

+9 -2
View File
@@ -30,8 +30,15 @@ function buildTitleKeywords(title) {
// longest-two rule threw them away: "700 Main Street" kept only Street+Main and happily matched
// "777 Main Street" by a different artist. Numbers are therefore always required, on top of the
// two longest words.
const numbers = words.filter(w => /^\d+$/.test(w));
const wordsNoNum = words.filter(w => !/^\d+$/.test(w));
// Ausnahme: die Jahreszahl einer Neuauflage ("… - 2020 Remaster") steht auf der Veroeffentlichung,
// aber nie im YouTube-Titel — als Pflicht-Keyword wuerde sie den richtigen Upload ablehnen. Nur
// wenn ein solches Qualifier-Wort daneben steht; ein Titel, der SELBST eine Jahreszahl ist
// ("1999", "Berlin 2020"), behaelt sie.
const RELEASE_QUALIFIER = /\b(remaster|remastered|version|edition|anniversary|mono|stereo)\b/i;
const isEditionYear = w => /^(19|20)\d{2}$/.test(w) && RELEASE_QUALIFIER.test(title || '');
const isRequiredNum = w => /^\d+$/.test(w) && !isEditionYear(w);
const numbers = words.filter(isRequiredNum);
const wordsNoNum = words.filter(w => !isRequiredNum(w));
const top2 = wordsNoNum.sort((a, b) => b.length - a.length).slice(0, 2);
// Uploaders abbreviate the same word the release spells out ("700 Main St" vs "700 Main Street"),
// which rejected the official Art Track in every cascade step. Accept either spelling; \b keeps
+12
View File
@@ -33,3 +33,15 @@ test('titles without numbers keep the previous two-longest-words behaviour', ()
assert.equal(accepts('Bohemian Rhapsody', 'Queen - Bohemian Rhapsody (Official Video)'), true);
assert.equal(accepts('Bohemian Rhapsody', 'Queen - Another One Bites The Dust'), false);
});
test('a remaster year is not required — YouTube titles never carry it', () => {
// "… - 2020 Remaster" steht auf der Veröffentlichung, der Upload heißt schlicht
// "Take Me Home, Country Roads". Vor dieser Ausnahme hätte die 2020 ihn abgelehnt.
assert.equal(accepts('Take Me Home, Country Roads - 2020 Remaster',
'John Denver - Take Me Home, Country Roads'), true);
});
test('a year that IS the title stays required', () => {
assert.equal(accepts('1999', 'Prince - 1999 (Official Music Video)'), true);
assert.equal(accepts('1999', 'Prince - 1984 (Official Music Video)'), false);
});