summaryrefslogtreecommitdiffstats
path: root/python/gui/api.py
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-01-09 12:21:21 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-01-09 12:21:21 +0100
commit75ba4f064a65ebad77d130f160b9469418e49c9f (patch)
tree85ab6398ae59159eab0acb1501d206f322aa9449 /python/gui/api.py
parent8dd12110d63f89eab62097b391fb909478db3d94 (diff)
downloaddabmod-75ba4f064a65ebad77d130f160b9469418e49c9f.tar.gz
dabmod-75ba4f064a65ebad77d130f160b9469418e49c9f.tar.bz2
dabmod-75ba4f064a65ebad77d130f160b9469418e49c9f.zip
GUI: Add ability to restore previous DPD settings
Diffstat (limited to 'python/gui/api.py')
-rwxr-xr-xpython/gui/api.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/python/gui/api.py b/python/gui/api.py
index 42c89c9..c0effde 100755
--- a/python/gui/api.py
+++ b/python/gui/api.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2018
+# Copyright (C) 2019
# Matthias P. Braendli, matthias.braendli@mpb.li
#
# http://www.opendigitalradio.org
@@ -125,12 +125,20 @@ class API:
@cherrypy.expose
@cherrypy.tools.json_out()
- def dpd_settings(self, setting: str, value: str, **kwargs):
+ def dpd_restore_dump(self, **kwargs):
if cherrypy.request.method == 'POST':
- data = {'setting': setting, 'value': value}
- return self._wrap_dpd("set_setting", data)
+ cl = cherrypy.request.headers['Content-Length']
+ rawbody = cherrypy.request.body.read(int(cl))
+ params = json.loads(rawbody.decode())
+ if 'dump_id' in params:
+ data = {'dump_id': params['dump_id']}
+ return self._wrap_dpd("restore_dump", data)
+ else:
+ cherrypy.response.status = 400
+ return send_error("Missing dump_id")
else:
- return self._wrap_dpd("get_settings")
+ cherrypy.response.status = 400
+ return send_error("POST only")
@cherrypy.expose
@cherrypy.tools.json_out()