Skip to content

Commit 46574e5

Browse files
committed
refactor: ffprobe is now toggled with an attribute
1 parent eccd10b commit 46574e5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

interactions/api/voice/audio.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ class Audio(BaseAudio):
107107
"""How many seconds of audio should be buffered"""
108108
read_ahead_task: threading.Thread
109109
"""A thread that reads ahead to create the buffer"""
110+
probe: bool
111+
"""Should ffprobe be used to detect audio data?"""
110112
ffmpeg_args: str | list[str]
111113
"""Args to pass to ffmpeg"""
112114
ffmpeg_before_args: str | list[str]
@@ -116,6 +118,7 @@ def __init__(self, src: Union[str, Path]) -> None:
116118
self.source = src
117119
self.needs_encode = True
118120
self.locked_stream = False
121+
self.probe: False
119122
self.process: Optional[subprocess.Popen] = None
120123

121124
self.buffer = AudioBuffer()
@@ -142,7 +145,7 @@ def audio_complete(self) -> bool:
142145
return False
143146
return True
144147

145-
def _create_process(self, *, block: bool = True, probe: bool = True) -> None:
148+
def _create_process(self, *, block: bool = True) -> None:
146149
before = (
147150
self.ffmpeg_before_args if isinstance(self.ffmpeg_before_args, list) else self.ffmpeg_before_args.split()
148151
)
@@ -152,7 +155,7 @@ def _create_process(self, *, block: bool = True, probe: bool = True) -> None:
152155
"bitrate": None,
153156
}
154157

155-
if shutil.which("ffprobe") is not None and probe:
158+
if shutil.which("ffprobe") is not None and self.probe:
156159
ffprobe_cmd = [
157160
"ffprobe",
158161
"-loglevel",

0 commit comments

Comments
 (0)