diff --git a/.github/workflows/test-import.yml b/.github/workflows/test-import.yml index e0c9c826..ebf4c79a 100644 --- a/.github/workflows/test-import.yml +++ b/.github/workflows/test-import.yml @@ -22,3 +22,4 @@ jobs: run: | find . -type d -exec chmod 777 {} \; docker run -v $PWD:/transitous -w /transitous transitous ci/fetch-feeds.py merge-request + docker run -v $PWD:/transitous -w /transitous transitous src/generate-motis-config.py full diff --git a/feeds/ca.json b/feeds/ca.json index b2de73ce..15e6bbc4 100644 --- a/feeds/ca.json +++ b/feeds/ca.json @@ -204,12 +204,12 @@ { "name": "Metrolinx-orangeville", "type": "transitland-atlas", - "transitland-atlas-id": "f-orangeville~on~ca~rt" + "transitland-atlas-id": "f-orangeville~transit~ca" }, { "name": "Metrolinx-orangeville", "type": "transitland-atlas", - "transitland-atlas-id": "f-orangeville~transit~ca" + "transitland-atlas-id": "f-orangeville~on~ca~rt" }, { "name": "Metrolinx-orillia", diff --git a/src/fetch.py b/src/fetch.py index 66e2fba4..e736575e 100755 --- a/src/fetch.py +++ b/src/fetch.py @@ -6,8 +6,9 @@ from metadata import * from pathlib import Path from datetime import datetime, timezone -import email.utils +from utils import eprint +import email.utils import requests import transitland import json @@ -17,10 +18,6 @@ import shutil -def eprint(*args, **kwargs): - print(*args, file=sys.stderr, **kwargs) - - def validate_source_name(name: str): if " " in name: eprint(f"Error: Feed names must not contain spaces, found {name}.") diff --git a/src/generate-motis-config.py b/src/generate-motis-config.py index 7e1036ec..003a9f92 100755 --- a/src/generate-motis-config.py +++ b/src/generate-motis-config.py @@ -12,6 +12,7 @@ from pathlib import Path from jinja2 import Template +from utils import eprint if __name__ == "__main__": @@ -56,6 +57,17 @@ "path": schedule_file }) case "gtfs-rt" if isinstance(source, metadata.UrlSource): + referenced_static_feed = list(filter( + lambda f: f["id"] == schedule_name, gtfs_feeds)) + + if not referenced_static_feed: + eprint("Error: The name of a realtime (gtfs-rt) " + + "feed needs to match the name of its " + + "static base feed defined before the " + + "realtime feed. Found nothing " + + "belonging to", source.name) + sys.exit(1) + gtfsrt_feeds.append({ "id": schedule_name, "url": source.url,