Fix: implement case-insensitive file matching for broadcast audio sequences to fix missing uppercase line and station names

This commit is contained in:
2026-08-01 22:54:10 +08:00
parent 2fae7305f6
commit 4b3bd91023
7 changed files with 19 additions and 6 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+19 -6
View File
@@ -1235,6 +1235,14 @@ function getOrCreateHlsStreamState(streamName) {
return hlsStreams[streamName];
}
function findFileCaseInsensitive(dir, filename) {
if (!fs.existsSync(dir)) return null;
const files = fs.readdirSync(dir);
const lowerFilename = filename.toLowerCase();
const match = files.find(f => f.toLowerCase() === lowerFilename);
return match ? path.join(dir, match) : null;
}
function resolveSequenceFiles(seq) {
ensureSilenceWav();
const files = [];
@@ -1245,14 +1253,19 @@ function resolveSequenceFiles(seq) {
continue;
}
const candidates = [
path.join(audioStationDir, `${item}.wav`),
path.join(audioLineDir, `${item}.wav`),
path.join(audioVoiceDir, `${item}.wav`),
...getBeepAudioDirs().map(dir => path.join(dir, `${item}.wav`))
const dirsToSearch = [
audioStationDir,
audioLineDir,
audioVoiceDir,
...getBeepAudioDirs()
];
const found = candidates.find(p => fs.existsSync(p));
let found = null;
for (const dir of dirsToSearch) {
found = findFileCaseInsensitive(dir, `${item}.wav`);
if (found) break;
}
if (found) {
files.push(found);
} else {