Jay Berkenbilt
a9fbbd5dca
Objectinfo json: write incrementally and in numeric order
...
This script was used on test data:
----------
#!/usr/bin/env python3
import json
import sys
import re
def json_dumps(data):
return json.dumps(data, ensure_ascii=False,
indent=2, separators=(',', ': '))
for filename in sys.argv[1:]:
with open(filename, 'r') as f:
data = json.loads(f.read())
if 'objectinfo' not in data:
continue
trailer = None
to_sort = []
for k, v in data['objectinfo'].items():
if k == 'trailer':
trailer = v
else:
m = re.match(r'^(\d+) \d+ R', k)
if m:
to_sort.append([int(m.group(1)), k, v])
newobjectinfo = {x[1]: x[2] for x in sorted(to_sort)}
if trailer is not None:
newobjectinfo['trailer'] = trailer
data['objectinfo'] = newobjectinfo
print(json_dumps(data))
----------
2022-05-07 08:26:31 -04:00
..
2022-05-07 08:26:31 -04:00
2022-04-09 14:37:00 -04:00
2022-05-03 18:31:22 -04:00
2022-04-05 14:56:19 -04:00
2022-04-04 08:10:40 -04:00
2022-04-09 17:33:29 -04:00
2022-04-16 11:39:14 -04:00
2022-05-04 12:07:11 -04:00
2022-05-03 18:54:51 -04:00
2022-04-16 11:39:14 -04:00
2022-04-16 11:39:14 -04:00
2022-05-04 12:07:11 -04:00
2022-04-16 11:39:14 -04:00
2022-04-16 11:39:14 -04:00
2022-05-07 08:26:31 -04:00
2022-04-16 11:39:14 -04:00
2022-04-03 17:58:36 -04:00
2022-04-04 08:10:40 -04:00
2022-04-30 13:26:43 -04:00
2022-04-16 11:39:14 -04:00
2022-04-04 08:10:40 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:23 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:54:51 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-07 08:26:31 -04:00
2022-05-03 18:31:22 -04:00
2022-04-30 13:27:18 -04:00
2022-04-16 11:39:14 -04:00
2022-04-30 13:27:18 -04:00
2022-05-03 18:31:23 -04:00
2022-04-16 11:39:14 -04:00
2022-04-16 11:39:14 -04:00
2022-05-03 18:31:22 -04:00
2022-04-16 11:39:14 -04:00
2022-04-16 11:39:14 -04:00
2022-04-16 11:39:14 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-04-16 11:39:14 -04:00
2022-04-16 11:39:14 -04:00
2022-04-30 13:26:43 -04:00
2022-04-23 18:25:43 -04:00
2022-04-30 17:24:15 -04:00
2022-05-04 12:07:11 -04:00
2022-04-30 13:27:18 -04:00
2022-04-16 11:39:14 -04:00
2022-04-30 13:27:18 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-04-30 13:26:43 -04:00
2022-04-30 14:15:07 -04:00
2022-04-30 13:26:43 -04:00
2022-04-04 08:10:40 -04:00
2022-04-30 13:26:43 -04:00
2022-05-03 18:31:23 -04:00
2022-04-30 13:26:43 -04:00
2022-05-07 08:26:31 -04:00
2022-04-30 13:26:43 -04:00
2022-04-04 08:10:40 -04:00
2022-05-07 08:26:31 -04:00
2022-04-16 10:41:46 -04:00
2022-04-16 13:35:27 -04:00
2022-04-16 13:35:27 -04:00
2020-04-03 12:16:24 -04:00
2022-05-03 18:31:23 -04:00
2022-04-04 08:10:40 -04:00
2022-04-16 11:39:14 -04:00
2022-04-16 11:39:14 -04:00
2022-04-30 13:27:18 -04:00
2022-04-29 20:39:54 -04:00
2022-05-03 18:31:23 -04:00
2020-12-28 12:58:19 -05:00
2022-04-16 11:39:14 -04:00
2022-04-30 13:27:18 -04:00
2022-01-30 13:11:03 -05:00
2022-05-03 18:31:23 -04:00
2022-04-04 08:10:40 -04:00
2022-04-04 08:10:40 -04:00
2022-04-30 13:27:18 -04:00
2022-05-03 18:31:22 -04:00
2022-05-03 18:31:22 -04:00
2022-04-04 08:10:40 -04:00
2022-04-03 17:58:36 -04:00
2022-04-16 13:35:27 -04:00
2022-04-30 13:26:43 -04:00
2022-04-03 17:58:36 -04:00
2022-04-03 17:58:36 -04:00
2022-04-09 17:33:29 -04:00
2022-04-30 13:26:43 -04:00