- +1 fix
This commit is contained in:
parent
4db0350dfe
commit
9504a2295c
|
|
@ -67,10 +67,11 @@ FORCE_RUN = False
|
|||
EXIT_OK = 0
|
||||
EXIT_ERROR = 1
|
||||
|
||||
|
||||
# Use silence eraser or not (speech detector is used in this case)
|
||||
USE_SILENCE_ERASER = True
|
||||
|
||||
LOG_FILEPATH = None
|
||||
|
||||
def remove_oldest_log_audio():
|
||||
list_of_files = os.listdir(LOG_AUDIO_DIR)
|
||||
if len(list_of_files) > 20:
|
||||
|
|
@ -256,6 +257,7 @@ def make_call(target: str):
|
|||
# os.remove(record_file)
|
||||
|
||||
# Add prefix and suffix silence for reference to give a chance to record all the file
|
||||
utils.log(f'Preparing reference file...')
|
||||
reference_filename = Path('/dev/shm/reference_built.wav')
|
||||
if reference_filename.exists():
|
||||
os.remove(reference_filename)
|
||||
|
|
@ -263,10 +265,13 @@ def make_call(target: str):
|
|||
|
||||
# Find duration of prepared reference file
|
||||
reference_length = int(utils.get_wav_length(reference_filename))
|
||||
utils.log(f' Done.')
|
||||
|
||||
# Compose a command
|
||||
utils.close_log_file()
|
||||
cmd = f'/usr/bin/python3 {DIR_THIS}/bt_call_controller.py --play-file {reference_filename} --record-file {record_file} --timelimit {reference_length} --target {target}'
|
||||
retcode = os.system(cmd)
|
||||
utils.open_log_file(LOG_FILEPATH, 'at')
|
||||
if retcode != 0:
|
||||
utils.log_error(f'BT caller script exited with non-zero code {retcode}, skipping analysis.')
|
||||
else:
|
||||
|
|
@ -499,7 +504,8 @@ if 'bluetooth_mac' in config['audio']:
|
|||
utils.verbose_logging = config['log']['verbose']
|
||||
|
||||
if config['log']['path']:
|
||||
utils.open_log_file(config['log']['path'], 'at')
|
||||
LOG_FILEPATH = config['log']['path']
|
||||
utils.open_log_file(LOG_FILEPATH, 'at')
|
||||
|
||||
# Use native ALSA utilities on RPi
|
||||
if utils.is_raspberrypi():
|
||||
|
|
|
|||
|
|
@ -96,11 +96,11 @@ class Phone(Observable):
|
|||
|
||||
def __init__(self):
|
||||
super(Phone,self).__init__()
|
||||
|
||||
utils.log('Ataching to DBus...')
|
||||
# Attach to DBus
|
||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||
|
||||
utils.log('Phone set up')
|
||||
utils.log('Going to setup phone...')
|
||||
self.bus = dbus.SystemBus()
|
||||
|
||||
# Get ofono manager
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import typing
|
||||
import datetime
|
||||
import traceback
|
||||
|
|
|
|||
Loading…
Reference in New Issue