More dataloader
Some checks failed
On Push Deploy / deploy (push) Has been cancelled

This commit is contained in:
Johnny322
2026-02-08 16:32:51 +01:00
parent 56599afd59
commit db284f0394

View File

@@ -38,12 +38,16 @@ const answerFiles = import.meta.globEager('./Data/*/*/answers/*.mp3') as Record<
const getParts = (path: string) => {
const normalized = path.replace(/\\/g, '/')
const parts = normalized.split('/')
const dataIndex = parts.findIndex((part) => part.toLowerCase() === 'data')
const lowerParts = parts.map((part) => part.toLowerCase())
const dataIndex = lowerParts.indexOf('data')
if (dataIndex === -1) return null
const game = parts[dataIndex + 1]
const category = parts[dataIndex + 2]
const type = parts[dataIndex + 3]
const file = parts[dataIndex + 4]
const typeIndex = lowerParts.findIndex((part) => part === 'songs' || part === 'answers')
if (typeIndex === -1) return null
const type = lowerParts[typeIndex]
const file = parts[typeIndex + 1]
if (!game || !category || !file) return null
return { game, category, type, file }
}