INNER CODE UNIT · Python
get_next_from_audio_queue
shakedzy/companion · companion.py:119
def get_next_from_audio_queue():
try:
filename = app_cache.play_recordings_queue.get(timeout=1)
filename = url_for('static', filename=f'{TEMP_DIR_NAME}/{filename.split("/")[-1]}')
empty = False
except EmptyQueue:
filename = None
empty = True
return jsonify({'file_url': filename, 'empty': int(empty)})
@app.route("/clear_audio_queue", methods=['GET'])
def clear_audio_queue():
global audio_queue_reject_remaining_fragments
audio_queue_reject_remaining_fragments = True
app_cache.play_recordings_queue.queue.clear()
return jsonify({'message': 'Audio cache cleared'})