From 8ad6b96f02ff60b643d16b588717e426aecba85f Mon Sep 17 00:00:00 2001 From: Johnny322 Date: Sun, 8 Feb 2026 16:36:01 +0100 Subject: [PATCH] Maybe readd error --- src/dataLoader.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/dataLoader.ts b/src/dataLoader.ts index 6ef034a..b409470 100644 --- a/src/dataLoader.ts +++ b/src/dataLoader.ts @@ -25,15 +25,15 @@ type GameMap = Record< } > -const songFiles = import.meta.globEager('./Data/*/*/songs/*.mp3') as Record< - string, - { default: string } -> +const songFiles = { + ...import.meta.globEager('./Data/*/*/Songs/*.mp3'), + ...import.meta.globEager('./Data/*/*/songs/*.mp3') +} as Record -const answerFiles = import.meta.globEager('./Data/*/*/answers/*.mp3') as Record< - string, - { default: string } -> +const answerFiles = { + ...import.meta.globEager('./Data/*/*/Answers/*.mp3'), + ...import.meta.globEager('./Data/*/*/answers/*.mp3') +} as Record const getParts = (path: string) => { const normalized = path.replace(/\\/g, '/') @@ -54,7 +54,7 @@ const getParts = (path: string) => { const addEntry = (target: GameMap, info: ReturnType, url: string) => { if (!info) return const { game, category, type, file } = info - const number = Number(file.replace('.mp3', '')) + const number = Number(file.replace(/\.mp3$/i, '')) if (!Number.isFinite(number)) return if (!target[game]) { @@ -71,7 +71,9 @@ const addEntry = (target: GameMap, info: ReturnType, url: strin clues: [] } } - const bucket = type === 'Songs' ? 'songs' : 'answers' + const normalizedType = type.toLowerCase() + if (normalizedType !== 'songs' && normalizedType !== 'answers') return + const bucket = normalizedType === 'songs' ? 'songs' : 'answers' target[game].categories[category][bucket][number] = url }