mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-18 11:51:42 +03:00
27 lines
825 B
Python
Executable File
27 lines
825 B
Python
Executable File
#!/usr/bin/python3
|
|
# 790e13e9278e54cd7e1f5a2969a00057e33f778c changed the JSON schema. This script
|
|
# updates all of the data/ files. Keeping it around as an example for the next
|
|
# transition.
|
|
#
|
|
# The Rust code also implements this transformation (in
|
|
# map_model/src/edits/compat.rs), but it's less convenient to run it over all
|
|
# the data files, since it operates on entire map edits.
|
|
|
|
import json
|
|
import sys
|
|
|
|
for path in sys.argv[1:]:
|
|
with open(path) as f:
|
|
data = json.load(f)
|
|
data['plans'] = [{
|
|
'start_time_seconds': 0,
|
|
'stages': data['stages'],
|
|
'offset_seconds': data['offset_seconds'],
|
|
}]
|
|
del data['stages']
|
|
del data['offset_seconds']
|
|
|
|
with open(path, 'w') as f:
|
|
f.write(json.dumps(data, indent=2))
|
|
f.close()
|