[CLI] Audio playback error handling - #204
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the audio streaming logic in the CLI to allow the application to continue running even if audio playback fails or is unavailable, rather than exiting immediately. It introduces the use of ExitStack to manage resources and adds a fallback state for when playback is disabled. I have included a suggestion to use the local console object for printing error panels to ensure better synchronization with the active Live display.
| rich.print( | ||
| Panel( | ||
| f"Audio playback unavailable on this machine ({e}); continuing without playback.", | ||
| style="yellow", | ||
| expand=False, | ||
| ) | ||
| ) |
There was a problem hiding this comment.
While rich.print is used throughout the file, it is generally safer to use live.console.print or the local console variable when a Live display is active. This ensures that the output is correctly synchronized with the live display and avoids potential layout issues in some terminal environments. Additionally, using the console object defined at line 625 would be more consistent with its usage at line 705.
| rich.print( | |
| Panel( | |
| f"Audio playback unavailable on this machine ({e}); continuing without playback.", | |
| style="yellow", | |
| expand=False, | |
| ) | |
| ) | |
| console.print( | |
| Panel( | |
| f"Audio playback unavailable on this machine ({e}); continuing without playback.", | |
| style="yellow", | |
| expand=False, | |
| ) | |
| ) |
No description provided.