Skip to content

Commit

Permalink
Allow to specify a feed for generation (#881)
Browse files Browse the repository at this point in the history
When testing locally e.g. a specific country, one first generates a config file full of feeds, just to remove them. This change allows to specify a certain feeds.json, to only fill the feeds of a specified country in the config.yml
  • Loading branch information
1Maxnet1 authored Feb 11, 2025
1 parent c468323 commit afc8f79
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/generate-motis-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
sys.exit(1)

flavour = sys.argv[1]
feed = sys.argv[2] if len(sys.argv) > 2 else ""

feed_dir = Path("feeds/")

Expand All @@ -45,7 +46,12 @@
)
config["timetable"]["datasets"] = {}

for feed in sorted(feed_dir.glob("*.json")):
if feed == "":
glob = "*.json"
else:
glob = f"{feed}.json"

for feed in sorted(feed_dir.glob(glob)):
with open(feed, "r") as f:
parsed = json.load(f)
region = metadata.Region(parsed)
Expand Down

0 comments on commit afc8f79

Please sign in to comment.