From c34d70b3cb4f661c73e9a27b3219521ff2082621 Mon Sep 17 00:00:00 2001 From: lanvent Date: Sat, 10 Jun 2023 11:22:12 +0800 Subject: [PATCH] fix: add warning log when pysilk module is not installed --- voice/audio_convert.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/voice/audio_convert.py b/voice/audio_convert.py index 9c9515a28..18fe3c2f3 100644 --- a/voice/audio_convert.py +++ b/voice/audio_convert.py @@ -1,7 +1,13 @@ import shutil import wave -import pysilk +from common.log import logger + +try: + import pysilk +except ImportError: + logger.warn("import pysilk failed, wechaty voice message will not be supported.") + from pydub import AudioSegment sil_supports = [8000, 12000, 16000, 24000, 32000, 44100, 48000] # slk转wav时,支持的采样率