diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-01-09 12:21:21 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-01-09 12:21:21 +0100 |
commit | 75ba4f064a65ebad77d130f160b9469418e49c9f (patch) | |
tree | 85ab6398ae59159eab0acb1501d206f322aa9449 /python/gui/api.py | |
parent | 8dd12110d63f89eab62097b391fb909478db3d94 (diff) | |
download | dabmod-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-x | python/gui/api.py | 18 |
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() |