summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md9
-rwxr-xr-xbin/db-zugbildung-to-json8
2 files changed, 12 insertions, 5 deletions
diff --git a/README.md b/README.md
index a6cb99f..5b7a57e 100644
--- a/README.md
+++ b/README.md
@@ -169,24 +169,23 @@ Otherwise, the property is not present. It is **reliable**.
"Erfurt (07:40/07:45)",
"Nürnberg"
],
- "postEnd": null,
"preStart": "Berlin-Rummelsburg (Triebzuganlage)",
"start": "Berlin-Gesundbrunnen (05:53)"
}
}
```
-Scheduled route. It is divided into five parts:
+Scheduled route. It contains up to five properties:
-* **preStart**: Station (without passenger service) where the train is prepared / provisioned. May be null.
+* **preStart**: Station (without passenger service) where the train is prepared / provisioned.
* **start**: First station(s) with passenger service. Often contains the scheduled departure time.
* **middle**: List of noteworthy stations along the route. May be empty.
This is not the complete route. Individual stations may contain timestamps.
* **end**: Terminal station(s) with passenger service. Often contains the scheduled arrival time.
-* **postEnd**: Station (without passenger service) where the train is parked. May be null.
+* **postEnd**: Station (without passenger service) where the train is parked.
Station entries are taken as-is from the PDF file. They may differ from station
-names used in iris-tts or HAFAS. A null preStart / postEnd entry does not
+names used in iris-tts or HAFAS. A missing preStart / postEnd entry does not
imply that the train is prepared / parked at the first / last station with
passenger service. Station names may be surrounded by brackets.
diff --git a/bin/db-zugbildung-to-json b/bin/db-zugbildung-to-json
index c00b784..759f2f7 100755
--- a/bin/db-zugbildung-to-json
+++ b/bin/db-zugbildung-to-json
@@ -440,6 +440,14 @@ for my $train ( values %map ) {
end => $end,
postEnd => $post_end,
};
+
+ for my $k ( keys %{ $train->{route} } ) {
+ if ( not defined $train->{route}{$k} ) {
+
+ # avoid null values (leave out the property instead)
+ delete $train->{route}{$k};
+ }
+ }
}
for my $train ( values %map ) {