From 0a8883aaf53e7332bf315960e9323ce6056e68fb Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Sun, 4 Feb 2024 22:42:12 +0100 Subject: [PATCH] use yml deefuzzer file by default, use write_conf method --- telecaster/models.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/telecaster/models.py b/telecaster/models.py index fa4323f..f25a877 100644 --- a/telecaster/models.py +++ b/telecaster/models.py @@ -54,6 +54,8 @@ from south.modelsinspector import add_introspection_rules from teleforma.models import Conference +from deefuzzer.tools.utils import get_conf_dict, write_conf + from tools import * @@ -132,7 +134,7 @@ class Station(Model): self.department = self.course.department.name self.organization = self.course.department.organization.name - self.conf = xml2dict(conf_file) + self.conf = get_conf_dict(conf_file) self.date = datetime.datetime.now().strftime("%Y") self.time = datetime.datetime.now().strftime("%x-%X") self.time_txt = self.time.replace('/','_').replace(':','_').replace(' ','_') @@ -183,14 +185,11 @@ class Station(Model): #FIXME: only one format in deefuzzer conf file self.format = station['media']['format'] self.deefuzzer_file = 'cache' + os.sep + 'station_' + \ - station['media']['format'] + '.xml' + station['media']['format'] + '.yaml' self.save() - self.deefuzzer_xml = dicttoxml(self.conf) def deefuzzer_write_conf(self): - conf_file = open(self.deefuzzer_file.path,'w') - conf_file.write(self.deefuzzer_xml) - conf_file.close() + write_conf(self.conf, self.deefuzzer_file) def deefuzzer_start(self): command = '/usr/local/bin/deefuzzer ' + self.deefuzzer_file.path + ' &' -- 2.39.5