code to call recorder functions from frointend

This commit is contained in:
2019-12-12 18:44:07 +01:00
parent da200f95b8
commit bb4db25dcd
6 changed files with 160 additions and 79 deletions

View File

@@ -67,12 +67,14 @@ def update_recorder_models_database(drop: bool = False):
db.session.commit()
r_as = get_defined_recorder_adapters()
for r_a in r_as:
if r_a.get('class') is None: # skip modules without class (helpers.py, e.g.)
continue
try:
r_m = RecorderModel.get_by_adapter_id(r_a["id"])
model_checksum = calculate_md5_checksum(dumps(r_a["commands"]))
if r_m is None:
r_m = RecorderModel(record_adapter_id=r_a["id"], model_name=r_a["name"], checksum=model_checksum,
**r_a.get('class', {}).get_recorder_params())
**r_a.get('class').get_recorder_params())
db.session.add(r_m)
db.session.flush()
db.session.refresh(r_m)