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 stationName = getCorrectStationName(data.stationName);
|
||||||
const stationCode = data.stationCode;
|
const stationCode = data.stationCode;
|
||||||
const platform = data.stationPlatform || data.platform || '1';
|
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';
|
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
|
// 中文:ch-fc1 + ch-fc2 + ch-fc3 + ch-终点编号 + ch-fc4
|
||||||
const seq = [
|
const seq = [
|
||||||
'ksts',
|
'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'
|
'ch-fc1', 'ch-fc2', 'ch-fc3', `ch-${destCode}`, 'ch-fc4'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -1909,6 +1911,8 @@ function handleTrainArrival(ws, data) {
|
|||||||
const stationName = getCorrectStationName(data.stationName);
|
const stationName = getCorrectStationName(data.stationName);
|
||||||
const stationCode = data.stationCode;
|
const stationCode = data.stationCode;
|
||||||
const platform = data.stationPlatform || data.platform || '1';
|
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 lineCode = data.lineCode || (stationCode ? stationCode.split('-')[0] : 'UNK');
|
||||||
const destCode = data.destCode || getStationCodeFromName(data.destination) || 'UNK';
|
const destCode = data.destCode || getStationCodeFromName(data.destination) || 'UNK';
|
||||||
@@ -1942,8 +1946,8 @@ function handleTrainArrival(ws, data) {
|
|||||||
// Broadcast Audio Logic
|
// Broadcast Audio Logic
|
||||||
const seq = [
|
const seq = [
|
||||||
'ksts',
|
'ksts',
|
||||||
`ja-${platform}`, 'ja-zt', `ja-${lineCode}`, `ja-${destCode}`, 'ja-to', 'ja-nextsta', `ja-${nextCode}`, 'ja-warn',
|
`ja-${finalPlatform}`, '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'
|
`ch-${finalPlatform}`, 'ch-zt', `ch-${lineCode}`, 'ch-to', `ch-${destCode}`, 'ch-nextsta', `ch-${nextCode}`, 'ch-warn'
|
||||||
];
|
];
|
||||||
|
|
||||||
enqueueHlsPush(stationName, seq);
|
enqueueHlsPush(stationName, seq);
|
||||||
|
|||||||
@@ -2263,7 +2263,7 @@ function Main.loop()
|
|||||||
type = "train_approaching",
|
type = "train_approaching",
|
||||||
stationName = State.stationName,
|
stationName = State.stationName,
|
||||||
stationCode = State.stationCode,
|
stationCode = State.stationCode,
|
||||||
stationPlatform = State.stationPlatform,
|
stationPlatform = State.stationPlatform or "1",
|
||||||
trainId = tName,
|
trainId = tName,
|
||||||
destination = dest,
|
destination = dest,
|
||||||
eta = etaVal
|
eta = etaVal
|
||||||
|
|||||||
Reference in New Issue
Block a user