Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarily disable ch-opentransportdata to stop MOTIS crash #107

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions feeds/ch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
{
"name": "opentransportdataswiss",
"type": "transitland-atlas",
"transitland-atlas-id": "f-u0-switzerland"
"transitland-atlas-id": "f-u0-switzerland",
"enabled": false
},
{
"name": "opentransportdataswiss",
"type": "url",
"spec": "gtfs-rt",
"url": "https://api.opentransportdata.swiss/gtfsrt2020",
"authorization": "57c5dbbbf1fe4d000100001833a821a9de3748e5876bfb6c1efe6973"
"authorization": "57c5dbbbf1fe4d000100001833a821a9de3748e5876bfb6c1efe6973",
"enabled": false
}
]
}
4 changes: 2 additions & 2 deletions motis/config.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ host=127.0.0.1
[import]
{% if coastline_file and flavour != "import" %}paths=coastline:{{ coastline_file }}{% endif %}
{% if pbf_file and flavour != "import" %}paths=osm:{{ pbf_file }}{% endif %}
{% for feed in gtfs_feeds %}paths=schedule-{{ feed.id }}:{{ feed.path }}
{% for feed in gtfs_feeds %}{% if feed.enabled %}paths=schedule-{{ feed.id }}:{{ feed.path }}{% endif %}
{% endfor %}
[nigiri]
first_day=TODAY
num_days=365
match_duplicates=true
{% if flavour != "import" %}
{% for feed in gtfsrt_feeds %}gtfsrt={{ feed.id }}|{{ feed.url }}{% if feed.authorization %}|{{ feed.authorization }}{% endif %}
{% for feed in gtfsrt_feeds %}{% if feed.enabled %}gtfsrt={{ feed.id }}|{{ feed.url }}{% if feed.authorization %}|{{ feed.authorization }}{% endif %}{% endif %}
{% endfor %}
{% endif %}
[intermodal]
Expand Down
6 changes: 4 additions & 2 deletions src/generate-motis-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@

gtfs_feeds.append({
"id": schedule_name,
"path": schedule_file
"path": schedule_file,
"enabled": source.enabled
})
case "gtfs-rt" if isinstance(source, metadata.UrlSource):
referenced_static_feed = list(filter(
Expand All @@ -71,7 +72,8 @@
gtfsrt_feeds.append({
"id": schedule_name,
"url": source.url,
"authorization": source.authorization
"authorization": source.authorization,
"enabled": source.enabled
})

with open("motis/config.ini.j2") as f:
Expand Down
4 changes: 4 additions & 0 deletions src/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ class Source:
fix: bool = False
license: Optional[License] = None
spec: str = "gtfs"
enabled: bool = True

def __init__(self, parsed: dict = None):
self.license = License()
if parsed:
if "enabled" in parsed:
self.enabled = bool(parsed["enabled"])

if "license" in parsed:
if "spdx-identifier" in parsed["license"]:
self.license.spdx_identifier = parsed["license"]["spdx-identifier"]
Expand Down
2 changes: 2 additions & 0 deletions src/transitland.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ def source_by_id(self, source: TransitlandSource) -> Union[HttpSource, UrlSource
result.url = feed["urls"]["static_current"]
result.options = source.options
result.spec = "gtfs"
result.enabled = source.enabled
elif "realtime_trip_updates" in feed["urls"]:
result = UrlSource()
result.name = source.name
result.url = feed["urls"]["realtime_trip_updates"]
result.spec = "gtfs-rt"
result.enabled = source.enabled
else:
return None

Expand Down