From 7aa98542c5e871ae0cdd49e495312525cb1ee1e9 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Wed, 3 Jun 2020 10:37:47 -0600 Subject: initial import --- dev/georgia/convert.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 dev/georgia/convert.py (limited to 'dev/georgia/convert.py') 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) -- cgit v1.2.3