NAME

db-iris - Interface to the DeutscheBahn online departure monitor

SYNOPSIS

db-iris [-rx] [-d date] [-o output-flags] [-t time] [-v|-V via] [other options ...] station

VERSION

version 1.90

DESCRIPTION

db-iris is an interface to the DeutscheBahn departure monitor available at https://iris.noncd.db.de/wbt/js/index.html.

It requests all trains departing from (or arriving at) station in the next two hours and lists them on stdout. station can be a DS100 station code (such as "EE"), a normal station name (such as "Essen Hbf" or "Dortmund Universität"), or an IBNR / european station number (such as 8000098). If no exact match is found, db-iris will try to find station names similar to station.

By default, db-iris shows the following data for each train:

  • scheduled departure time (see also -ot, -r).

  • delay in minutes, cancellation, or a question mark (?) indicating that no real-time data is available.

  • train line or number.

  • destination (see also -or). An exclamation mark (!) indicates that at least one stop has been cancelled (see -oc).

  • platform. An exclamation mark (!) indicates that it is not the scheduled one.

OPTIONS

-c, --class classlist

Comma-separated list of train classes to filter by. Using this option causes all trains whose class is not in classlist to be discarded.

Valid classes are:

D    Non-DB train. Usually local transport
F    "Fernverkehr", long-distance transport
N    "Nahverkehr", local and regional transport
S    S-Bahn, rather slow local/regional transport
-d, --date date

Request results for date, which is either a date string in in dd.mm. or dd.mm.YYYY format, or tomorrow. Note that typically only slight (a few hours max) deviations from the current time are supported by the IRIS backend, larger ones will not return data.

--json

List results as JSON, see Travel::Status::DE::IRIS::Result(3pm) for a partial documentation of arrival/departure keys. The --output option has no effect when using --json.

Note that JSON entries not mentioned in Travel::Status::DE::IRIS::Result(3pm) are NOT guaranteed to be compatible between releases. Their structure is not part of the db-iris / Travel::Status::DE::IRIS versioning scheme; it may change in backwards-incompatible ways anytime.

-l, --lookahead int

Do not return results which are more than int minutes in the future. Defaults to 120 (2 hours).

Note that this is only an upper limit, not a guarantee to get every train with a departure in less than int minutes. This guarantee holds only for int below 120. However, any non-negative number is accepted for this option.

--no-cache

If the Cache::File module is available, server replies are cached in ~/.cache/db-iris-schedule and ~/.cache/db-iris-realtime (or paths relative to $XDG_CACHE_HOME, if set). Use this option to disable caching altogether. Note that this will significantly decrease db-iris responsiveness, especially on mobile networks such as WifiOnICE.

-o, --output outputtypes

For each result, output outputtypes in addition to the normal time, delay, line and destination information. outputtypes is a comma-separated list, this option may be repeated. Each output type has both a short and long form, so both -ot,d and --output=times,delay are valid.

Valid output types are:

a / additional

If a train's route deviates from its schedule: Print a list of additional (unscheduled) stops it will serve.

c / canceled

If a train's route deviates from its schedule: Print a list of canceled stops (scheduled stops which will not be served).

d / delay

If a train is delayed, show the most recent reason for this delay.

D / delays

List all delay reasons entered into the IRIS for each train, even if the particular train is on time by now.

f / fullroute

Show the entire route (both before and after station).

m / messages

List all messages (delay and qos) entered into the IRIS with timestamps.

q / qos

List all quality of service messages entered into the IRIS. These contain information like "Missing carriage" or "Broken air conditioning".

Note that some qos messages may supersede older ones. superseded messages are omitted, use the m / messages type to see those as well.

r / route

Show up to three stops between station and the train's destination.

R / replacements

For cancelled trains: Print their replacement train(s), if present. For unplanned trains: Print the train(s) they replace, if present.

t / times

Show both scheduled and expected arrival and departure times.

-p, --platforms platforms

Only show arrivals/departures at platforms (comma-separated list, option may be repeated). This applies to actual departures, not schedules.

-r, --realtime

Show estimated instead of scheduled time where available. Cannot be combined with --output=times.

-t, --time time

Request results for time in HH:MM or HH:MM:SS format. Note that only slight deviations (a few hours max) from the current time are supported by the IRIS backend, larger ones will not return data.

-T, --type typelist

Comma-separated list of train types to filter by. Using this option causes all arrivals/departures whose type is not in typelist to be discarded.

The following valid values are known:

local transport:
IRE  Inter-Regio Express (rare)
RB   Regionalbahn (slower than RE)
RE   Regional-Express
S    S-Bahn

regional/interregional transport:
D    "Schnellzug" (generic fast train, rare)
EC   Eurocity
IC   Intercity
IR   Inter-Regio (rare in Germany, mostly used in Switzerland)
ICE  Intercity-Express
THA  Thalys

Depending on the city and country, other types may be used as well. Examples include "ABR" / "NWB" (private trains included in the local transport tariff system), "HKX" (private train not included in any DB tariffs) and "SBB" (unknown swiss train class)

-v, --via viastation

Only show trains serving viastation after station. In this case, viastation must match the station as contained in the train's route (see -of), DS100 codes are not supported.

-V, --track-via viastation

Only show trains serving viastation after station. Show result timestamps as "HH:MM -> HH:MM +x", where the first time is the scheduled departure (without delay) at station and the second the scheduled arrival (also without delay) at viastation. If a delay is known, it will be indicated by +x.

Note that here, viastation must be a regular station name or DS100 code.

Caveat: Some trains may change their identity along the route. track-via is not able to handle those and will miss trains changing their identifier between station and viastation

Sometimes, Deutsche Bahn splits up major stations in their IRIS interface. For instance, "Köln Messe/Deutz" actually consists of "Köln Messe/Deutz" (KKDZ), "Köln Messe/Deutz Gl. 9-10" (KKDZB) and "Köln Messe/Deutz (tief)" (KKDT).

By default, db-iris will show departures for all of these stations when queried for any of them. When this option is set, only the departures for the station part specified on the commandline are shown.

--version

Show version information.

EXIT STATUS

0: Normal operation
1: Invalid arguments or unknown station
2: Cannot get departures from backend (network issues?)
3: Invalid date/time specified

CONFIGURATION

None.

DEPENDENCIES

  • Class::Accessor(3pm)

  • DateTime(3pm)

  • LWP::UserAgent(3pm)

  • XML::LibXML(3pm)

RECOMMENDS

  • Cache::File(3pm)

BUGS AND LIMITATIONS

There are no known bugs at the moment.

AUTHOR

Copyright (C) 2013-2023 by Birte Kristina Friesel <derf@finalrewind.org>

The station data used by this script is provided by DB Station&Service AG, Europaplatz 1, 10557 Berlin, Germany and available under a CC-BY 4.0 license on https://data.deutschebahn.com/dataset/data-haltestellen.

LICENSE

This program is licensed under the same terms as Perl itself.