fix: parse CRN ETA as value plus unit

This commit is contained in:
2026-08-02 17:05:53 +08:00
parent 96222ebf06
commit a1db54b295
2 changed files with 20 additions and 13 deletions
+8 -7
View File
@@ -2428,15 +2428,16 @@ function Main.loop()
for _, lineText in pairs(lines) do
if lineText and lineText ~= "" and lineText:match("[%w%?%[]") then
local cleanLine = string.gsub(lineText, "%s*%(?%+%s*%d+.-%)?", "")
local platform, etaStr, tName, dest
platform, etaStr, tName, dest = string.match(cleanLine, "^(%d+)%s+(.-)%s+(%[.-%][^%s]*)%s+(.*)$")
local etaValue, etaUnit, tName, dest
etaValue, etaUnit, tName, dest = string.match(cleanLine, "^(%S+)%s+(.-)%s+(%[.-%][^%s]*)%s+(.*)$")
if not tName then
platform, etaStr, tName, dest = string.match(cleanLine, "^([^%s]+)%s+(.-)%s+(%[.-%][^%s]*)%s+(.*)$")
etaValue, etaUnit, tName, dest = string.match(cleanLine, "^([^%s]+)%s+(.-)%s+([^%s]+)%s+(.*)$")
end
if not tName then
platform, etaStr, tName, dest = string.match(cleanLine, "^([^%s]+)%s+(.-)%s+([^%s]+)%s+(.*)$")
end
if tName and etaStr then
if tName and etaValue then
local etaStr = tostring(etaValue or "")
if etaUnit and etaUnit ~= "" then
etaStr = etaStr .. " " .. tostring(etaUnit)
end
local etaSeconds = parseEtaText(etaStr)
if dest then
local textKey = tName .. "_" .. dest