Minor fixes for OpenBSD
This commit is contained in:
parent
5959e6e35a
commit
bab99443b6
|
@ -20,7 +20,16 @@ import aiohttp
|
||||||
import nio
|
import nio
|
||||||
import plyer
|
import plyer
|
||||||
import pyotherside
|
import pyotherside
|
||||||
|
|
||||||
|
has_simpleaudio = True
|
||||||
|
try:
|
||||||
import simpleaudio
|
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 appdirs import AppDirs
|
||||||
from nio.client.async_client import client_session
|
from nio.client.async_client import client_session
|
||||||
|
|
||||||
|
@ -590,6 +599,13 @@ class Backend:
|
||||||
|
|
||||||
|
|
||||||
async def sound_notify(self) -> None:
|
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 = self.settings.Notifications.default_sound
|
||||||
path = str(Path(path).expanduser())
|
path = str(Path(path).expanduser())
|
||||||
|
|
||||||
|
|
|
@ -2922,8 +2922,8 @@ class MatrixClient(nio.AsyncClient):
|
||||||
)
|
)
|
||||||
|
|
||||||
sender = item.sender_name or item.sender_id
|
sender = item.sender_name or item.sender_id
|
||||||
is_linux = platform.system() == "Linux"
|
is_nix = platform.system() == "Linux" or "BSD" in platform.system()
|
||||||
use_html = is_linux and self.backend.settings.Notifications.use_html
|
use_html = is_nix and self.backend.settings.Notifications.use_html
|
||||||
content = item.inline_content if use_html else item.plain_content
|
content = item.inline_content if use_html else item.plain_content
|
||||||
|
|
||||||
if isinstance(ev, nio.RoomMessageEmote) and use_html:
|
if isinstance(ev, nio.RoomMessageEmote) and use_html:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user