diff --git a/src/backend/hafas/parse/line.nim b/src/backend/hafas/parse/line.nim index 4839f41..20757cf 100644 --- a/src/backend/hafas/parse/line.nim +++ b/src/backend/hafas/parse/line.nim @@ -15,7 +15,8 @@ proc fetchTrainTypes() {.async.} = let resp = await client.getContent("https://lib.finalrewind.org/dbdb/ice_type.json") let data = parseJson(resp) for key, info in pairs(data): - trainTypes[key] = info{"type"}.getStr + if info{"type"}.getStr != "" and info{"type"}.getStr != "EC" and info{"type"}.getStr != "IC": + trainTypes[key] = info{"type"}.getStr asyncCheck fetchTrainTypes() @@ -43,7 +44,7 @@ proc parseLine*(common: CommonData, i: int): Option[Line] = # DB if res.productName == "IC" or res.productName == "ICE" or res.productName == "EE" or res.productName == "ECE": - if trainTypes.contains(res.tripNum): + if trainTypes.contains(res.tripNum) and trainTypes[res.tripNum] != res.productName: res.trainType = some(trainTypes[res.tripNum]) if line.nameS.isSome and (res.product == bus or res.product == tram or res.product == ferry):