Fixed simpleaudio exceptions
This commit is contained in:
		@@ -2,7 +2,7 @@ import simpleaudio
 | 
			
		||||
import random
 | 
			
		||||
import os
 | 
			
		||||
import os.path
 | 
			
		||||
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
class ShuffledFolderPlayer:
 | 
			
		||||
 | 
			
		||||
@@ -14,7 +14,12 @@ class ShuffledFolderPlayer:
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
    def play_one_random(self):
 | 
			
		||||
        random.choice(self._sounds).play()
 | 
			
		||||
        # noinspection PyBroadException
 | 
			
		||||
        try:
 | 
			
		||||
            random.choice(self._sounds).play()
 | 
			
		||||
        except Exception as e:  # simpleaudio seems like it does not expose the exceptions it may raise. So we just log it and call it a day
 | 
			
		||||
            logging.warning(f"Could not play sound file! {e}")
 | 
			
		||||
            pass
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BirbnetesIoTPlatformPlaybackDriver:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user