derf / Travel-Status-DE-DeutscheBahn

Commandline Public Transit Departure Monitor
https://finalrewind.org/projects/Travel-Status-DE-DeutscheBahn
Other
16 stars 3 forks source link

Conceptual improvements to handling opL and prodL #10

Closed deingithub closed 6 months ago

deingithub commented 7 months ago

Some, especially international, trains, change operators and type/number while en route. The way this currently seems to be handled by the library is that the first (or well, the res.journey.prodXth, but I haven't seen a number other than 0 there yet) set of operator and product are taken for the entire train, even if these get changed after one or two stops (in the case i noticed this, the REX3 Znojmo–Wiener Neustadt was consistently listed as the Os 2241 it starts its journey in Czechia as). With the current API, it's not possible to access any data past the first set of operator/product without very haphazardly looking for remarks like "Verkehrt ab hier als REX 2241 in Richtung Wiener Neustadt Hbf". A possible API shape to improve this might be $journey->at(stop on route)->{operator}, ->{type} and so on.

derf commented 6 months ago

9ef75520eeaf1a568650f7368782ac63b80c09b2 seems to be working nicely; closing this as completed.

deingithub commented 6 months ago

Thanks!