diff --git a/src/backend/backend.py b/src/backend/backend.py index f02ebeb1..5e6db08f 100644 --- a/src/backend/backend.py +++ b/src/backend/backend.py @@ -20,7 +20,16 @@ import aiohttp import nio import plyer import pyotherside -import simpleaudio + +has_simpleaudio = True +try: + import simpleaudio +except ImportError as e: + trace = traceback.format_exc().rstrip() + log.error("Importing simpleaudio failed\n%s", trace) + has_simpleaudio = False + + from appdirs import AppDirs from nio.client.async_client import client_session @@ -590,6 +599,13 @@ class Backend: async def sound_notify(self) -> None: + + if not has_simpleaudio: + if self.audio_working: + log.error("Playing audio not supported as python-simpleaudio is not installed") + self.audio_working = False + return + path = self.settings.Notifications.default_sound path = str(Path(path).expanduser()) diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index 9831d6eb..fc9e5966 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -2922,8 +2922,8 @@ class MatrixClient(nio.AsyncClient): ) sender = item.sender_name or item.sender_id - is_linux = platform.system() == "Linux" - use_html = is_linux and self.backend.settings.Notifications.use_html + is_nix = platform.system() == "Linux" or "BSD" in platform.system() + use_html = is_nix and self.backend.settings.Notifications.use_html content = item.inline_content if use_html else item.plain_content if isinstance(ev, nio.RoomMessageEmote) and use_html: