- handle uploading of non-existent recorded audio file

This commit is contained in:
Dmytro Bogovych 2023-09-05 17:15:39 +03:00
parent c4aead0300
commit b3f87c97f0
1 changed files with 9 additions and 7 deletions

View File

@ -106,15 +106,17 @@ def upload_results():
# path_audio_fixed = CACHE.dir / f'{upload_id}.wav'
# path_audio = path_audio.rename(path_audio_fixed)
if path_audio.exists():
utils.log(f'Uploading {path_audio.name} file...')
# Upload recorded audio
upload_result = BACKEND.upload_audio(upload_id, path_audio)
if upload_result:
utils.log(f' Recorded audio {upload_id}.wav is uploaded ok.')
os.remove(path_report)
os.remove(path_audio)
else:
break
utils.log(f'No recorded audio file found, skipping audio upload.')
os.remove(path_report)
else:
utils.log(f'Failed to upload report {path_report.name}')
break