diff options
author | Melody Horn <melody@boringcactus.com> | 2020-06-03 10:37:47 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2020-06-03 10:37:47 -0600 |
commit | 7aa98542c5e871ae0cdd49e495312525cb1ee1e9 (patch) | |
tree | 8b25f9314ebc3a20420026839c2e80f49ff5a11e /dev/georgia/convert.py | |
download | pig.observer-7aa98542c5e871ae0cdd49e495312525cb1ee1e9.tar.gz pig.observer-7aa98542c5e871ae0cdd49e495312525cb1ee1e9.zip |
initial import
Diffstat (limited to 'dev/georgia/convert.py')
-rw-r--r-- | dev/georgia/convert.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/dev/georgia/convert.py b/dev/georgia/convert.py new file mode 100644 index 0000000..eddcbb0 --- /dev/null +++ b/dev/georgia/convert.py @@ -0,0 +1,22 @@ +import json +from pprint import pprint +from collections import defaultdict + +with open('cctv.json', 'r') as f: + raw_data = json.load(f) + +cameras = raw_data['features'] + +sources = defaultdict(list) +for camera in cameras: + subdiv = camera['properties']['subdivision'] + result = dict() + result['id'] = camera['properties']['cctv_id'] + if 'HLS' in camera['properties']: + result['stream'] = camera['properties']['HLS'] + else: + result['url'] = camera['properties']['url'] + result['name'] = camera['properties']['location_description'] + sources[subdiv].append(result) +with open('sources.js', 'w') as f: + json.dump(dict(sources), f) |