fix(utils/discord): properly find .so for libopus
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
|
import ctypes
|
||||||
import time
|
import time
|
||||||
from logging import error, info
|
from logging import debug, error
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import disnake
|
import disnake
|
||||||
@@ -63,16 +64,13 @@ async def channel_send(message, *args, **kwargs):
|
|||||||
|
|
||||||
|
|
||||||
def load_opus():
|
def load_opus():
|
||||||
for path in filter(
|
path = ctypes.util._findLib_ld("opus")
|
||||||
lambda p: Path(p).exists(),
|
try:
|
||||||
["/usr/lib64/libopus.so.0", "/usr/lib/libopus.so.0"],
|
disnake.opus.load_opus(path)
|
||||||
):
|
debug(f"successfully loaded opus from {path}")
|
||||||
try:
|
return
|
||||||
disnake.opus.load_opus(path)
|
except Exception as e:
|
||||||
info(f"successfully loaded opus from {path}")
|
error(f"failed to load opus from {path}: {e}")
|
||||||
return
|
|
||||||
except Exception as e:
|
|
||||||
error(f"failed to load opus from {path}: {e}")
|
|
||||||
raise Exception("could not locate working opus library")
|
raise Exception("could not locate working opus library")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user