From 8718e7ee4f700025f8c0075d65ca3d1eeca4f8be Mon Sep 17 00:00:00 2001 From: miro Date: Wed, 23 Oct 2024 15:50:12 +0100 Subject: [PATCH] drop distutils.spawn in favor of shutil.which --- ovos_dinkum_listener/service.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ovos_dinkum_listener/service.py b/ovos_dinkum_listener/service.py index 0619615..2d165df 100644 --- a/ovos_dinkum_listener/service.py +++ b/ovos_dinkum_listener/service.py @@ -13,7 +13,7 @@ import json import subprocess import wave -from distutils.spawn import find_executable +from shutil import which from enum import Enum from hashlib import md5 from os.path import dirname @@ -67,11 +67,11 @@ def bytes2audiodata(data): recognizer = sr.Recognizer() with NamedTemporaryFile() as fp: fp.write(data) - - if find_executable("ffmpeg"): + ffmpeg = which("ffmpeg") + if ffmpeg: p = fp.name + "converted.wav" # ensure file format - cmd = ["ffmpeg", "-i", fp.name, "-acodec", "pcm_s16le", "-ar", + cmd = [ffmpeg, "-i", fp.name, "-acodec", "pcm_s16le", "-ar", "16000", "-ac", "1", "-f", "wav", p, "-y"] subprocess.call(cmd) else: