Files
CC-StationBroadcast/CloudServer
Henry_Du a58632272e fix(announce): 修复进站预告音频终点站名字被跳过的问题
根因链:
- station_broadcast.lua 通过 BlockReader / CreateTarget 两个分支触发 train_approaching 发送时,只带 destination (中文名/站名),未带 destCode;server 端只能走 getStationCodeFromName(destination) 正则解析,正则没匹配到就会得到 UNK → ch-UNK.wav / ja-UNK.wav 不存在 → 整条目的地段音频被 ffmpeg concat 跳过
- 对比 train_arrival (Peripherals.station 分支) 是有 destCode 字段的(由 Utils.getStationCode + schedule 解析得到),所以到站广播终点站名能正常播出,预告(走 Display/BlockReader 分支)不能
修复:
1. station_broadcast.lua 四处 train_approaching / train_alert Network.send 全部补 destCode = Utils.getStationCode(destination):
   - L4053 (alert, blockreader) / L4091 (approach, blockreader)
   - L4221 (alert, createTarget) / L4257 (approach, createTarget)
2. server.js 新增 resolveStationAudioCode(rawCode, rawName) 三级兜底解析:
   - L1: 直接用 raw destCode(优先级最高,客户端算好的)
   - L2: 正则解析 destination 名字抽取 code(parens/dash/下划线模式)
   - L3: 把 destination 名拿去 findStationByFlexibleName 已注册站台表里 fuzzy 匹配,取其 code
   - 解析不到就打 WARN 日志,提示会跳过这一段
3. handleTrainApproaching / handleTrainArrival / handleTrainDeparture 三个 handler 的 destCode / nextCode 全部切到 resolveStationAudioCode 统一入口,不再各写一遍正则,所有预告/到站/发车音频用同一条解析链,保证结果一致
APP_VERSION_TEXT bump 到 v1.0.110
2026-08-17 18:05:21 +08:00
..
2026-07-31 18:23:24 +08:00