INNER CODE UNIT · Python
clear_audio_queue
shakedzy/companion · companion.py:131
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'})
def put_in_audio_queue(filename: str) -> bool:
"""
Helper function to put filename in audio queue
:param filename: filename to put in queue
"""
global audio_queue_reject_remaining_fragments
if audio_queue_reject_remaining_fragments:
fragment_index = int(filename.split('_')[-1].split('.')[0])
if fragment_index > 0:
return False