fix: Ensure platform is stripped of non-digit chars for audio file matching
This commit is contained in:
@@ -1862,6 +1862,8 @@ function handleTrainApproaching(ws, data) {
|
||||
const stationName = getCorrectStationName(data.stationName);
|
||||
const stationCode = data.stationCode;
|
||||
const platform = data.stationPlatform || data.platform || '1';
|
||||
const cleanPlatform = String(platform).replace(/\D/g, ''); // 提取数字部分
|
||||
const finalPlatform = cleanPlatform || '1';
|
||||
|
||||
const destCode = data.destCode || getStationCodeFromName(data.destination) || 'UNK';
|
||||
|
||||
@@ -1880,7 +1882,7 @@ function handleTrainApproaching(ws, data) {
|
||||
// 中文:ch-fc1 + ch-fc2 + ch-fc3 + ch-终点编号 + ch-fc4
|
||||
const seq = [
|
||||
'ksts',
|
||||
'ja-fc1', `ja-${platform}`, 'ja-fc2', `ja-${destCode}`, 'ja-fc3',
|
||||
'ja-fc1', `ja-${finalPlatform}`, 'ja-fc2', `ja-${destCode}`, 'ja-fc3',
|
||||
'ch-fc1', 'ch-fc2', 'ch-fc3', `ch-${destCode}`, 'ch-fc4'
|
||||
];
|
||||
|
||||
@@ -1909,6 +1911,8 @@ function handleTrainArrival(ws, data) {
|
||||
const stationName = getCorrectStationName(data.stationName);
|
||||
const stationCode = data.stationCode;
|
||||
const platform = data.stationPlatform || data.platform || '1';
|
||||
const cleanPlatform = String(platform).replace(/\D/g, ''); // 提取数字部分
|
||||
const finalPlatform = cleanPlatform || '1';
|
||||
|
||||
const lineCode = data.lineCode || (stationCode ? stationCode.split('-')[0] : 'UNK');
|
||||
const destCode = data.destCode || getStationCodeFromName(data.destination) || 'UNK';
|
||||
@@ -1942,8 +1946,8 @@ function handleTrainArrival(ws, data) {
|
||||
// Broadcast Audio Logic
|
||||
const seq = [
|
||||
'ksts',
|
||||
`ja-${platform}`, 'ja-zt', `ja-${lineCode}`, `ja-${destCode}`, 'ja-to', 'ja-nextsta', `ja-${nextCode}`, 'ja-warn',
|
||||
`ch-${platform}`, 'ch-zt', `ch-${lineCode}`, 'ch-to', `ch-${destCode}`, 'ch-nextsta', `ch-${nextCode}`, 'ch-warn'
|
||||
`ja-${finalPlatform}`, 'ja-zt', `ja-${lineCode}`, `ja-${destCode}`, 'ja-to', 'ja-nextsta', `ja-${nextCode}`, 'ja-warn',
|
||||
`ch-${finalPlatform}`, 'ch-zt', `ch-${lineCode}`, 'ch-to', `ch-${destCode}`, 'ch-nextsta', `ch-${nextCode}`, 'ch-warn'
|
||||
];
|
||||
|
||||
enqueueHlsPush(stationName, seq);
|
||||
|
||||
Reference in New Issue
Block a user