diff --git a/audio_player.py b/audio_player.py index 6893ccb..836bb03 100644 --- a/audio_player.py +++ b/audio_player.py @@ -45,15 +45,15 @@ def play_audio(self, file_path, sleep_during_playback=True, delete_file=False, p # Sleep until file is done playing time.sleep(file_length) - # Delete the file - if delete_file: - # Stop pygame so file can be deleted - # Note, this can cause issues if this function is being run on multiple threads, since it quit the mixer for the other threads too - pygame.mixer.music.stop() - pygame.mixer.quit() + # Delete the file + if delete_file: + # Stop pygame so file can be deleted + # Note, this can cause issues if this function is being run on multiple threads, since it quit the mixer for the other threads too + pygame.mixer.music.stop() + pygame.mixer.quit() - try: - os.remove(file_path) - print(f"Deleted the audio file.") - except PermissionError: - print(f"Couldn't remove {file_path} because it is being used by another process.") \ No newline at end of file + try: + os.remove(file_path) + print(f"Deleted the audio file.") + except PermissionError: + print(f"Couldn't remove {file_path} because it is being used by another process.")