Skip to content

Commit

Permalink
drop distutils.spawn in favor of shutil.which
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Oct 23, 2024
1 parent fd4e33b commit 8718e7e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ovos_dinkum_listener/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8718e7e

Please sign in to comment.