- fix old problems
This commit is contained in:
parent
aa45c87846
commit
2d8d95f3c3
|
|
@ -38,7 +38,7 @@ BackendServer : utils_qualtest.QualtestBackend = None
|
||||||
REFERENCE_AUDIO = "/dev/shm/reference.wav"
|
REFERENCE_AUDIO = "/dev/shm/reference.wav"
|
||||||
|
|
||||||
# Loaded refernce audio (from backend)
|
# Loaded refernce audio (from backend)
|
||||||
LOADED_AUDIO = "/dev/shm/loaded_audio.wav"
|
LOADED_AUDIO = Path("/dev/shm/loaded_audio.wav")
|
||||||
|
|
||||||
# Script to exec after mobile call answering
|
# Script to exec after mobile call answering
|
||||||
EXEC_SCRIPT = None
|
EXEC_SCRIPT = None
|
||||||
|
|
@ -278,12 +278,15 @@ def run_caller_task(t):
|
||||||
task_name = t['name'].strip()
|
task_name = t['name'].strip()
|
||||||
|
|
||||||
# Load reference audio
|
# Load reference audio
|
||||||
|
if LOADED_AUDIO.exists():
|
||||||
|
os.remove(LOADED_AUDIO)
|
||||||
|
|
||||||
if not BackendServer.load_audio(t["audio_id"], LOADED_AUDIO):
|
if not BackendServer.load_audio(t["audio_id"], LOADED_AUDIO):
|
||||||
utils.log_error('No audio is available, exiting.')
|
utils.log_error('No audio is available, exiting.')
|
||||||
sys.exit(EXIT_ERROR)
|
sys.exit(EXIT_ERROR)
|
||||||
|
|
||||||
# Use loaded audio as reference
|
# Use loaded audio as reference
|
||||||
REFERENCE_AUDIO = LOADED_AUDIO
|
REFERENCE_AUDIO = str(LOADED_AUDIO)
|
||||||
|
|
||||||
CURRENT_TASK = task_name
|
CURRENT_TASK = task_name
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import requests
|
||||||
|
|
||||||
from socket import timeout
|
from socket import timeout
|
||||||
from crontab import CronTab
|
from crontab import CronTab
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
start_system_time = time.time()
|
start_system_time = time.time()
|
||||||
start_monotonic_time = time.monotonic()
|
start_monotonic_time = time.monotonic()
|
||||||
|
|
@ -171,7 +171,7 @@ class QualtestBackend:
|
||||||
|
|
||||||
def upload_report(self, report, files) -> str:
|
def upload_report(self, report, files) -> str:
|
||||||
# UUID string as result
|
# UUID string as result
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
# Log about upload attempt
|
# Log about upload attempt
|
||||||
utils.log_verbose(f"Uploading to {self.address} files {files} and report: {json.dumps(report, indent=4)}")
|
utils.log_verbose(f"Uploading to {self.address} files {files} and report: {json.dumps(report, indent=4)}")
|
||||||
|
|
@ -303,7 +303,7 @@ class QualtestBackend:
|
||||||
return dict()
|
return dict()
|
||||||
|
|
||||||
|
|
||||||
def load_audio(self, audio_id: int, output_path: str):
|
def load_audio(self, audio_id: int, output_path: Path):
|
||||||
utils.log(f'Loading audio with ID: {audio_id}')
|
utils.log(f'Loading audio with ID: {audio_id}')
|
||||||
try:
|
try:
|
||||||
# Build query for both V1 & V2 API
|
# Build query for both V1 & V2 API
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue