ffprobe disaster
This commit is contained in:
parent
8a97216d88
commit
550d937a39
@ -78,17 +78,20 @@ class YTAudio(discord.AudioSource):
|
|||||||
if url in self._durations:
|
if url in self._durations:
|
||||||
return
|
return
|
||||||
self._durations.setdefault(url, '')
|
self._durations.setdefault(url, '')
|
||||||
prompt = ''
|
|
||||||
if self.tor:
|
if self.tor:
|
||||||
prompt = 'torify '
|
args = ['torify']
|
||||||
prompt += (
|
else:
|
||||||
f'ffprobe -i {shlex.quote(url)}'
|
args = []
|
||||||
' -show_entries format=duration -v quiet -of csv="p=0" -sexagesimal'
|
args += [
|
||||||
)
|
'ffprobe', '-i', url,
|
||||||
|
'-show_entries', 'format=duration',
|
||||||
|
'-v', 'quiet',
|
||||||
|
'-of', 'default=noprint_wrappers=1:nokey=1',
|
||||||
|
'-sexagesimal'
|
||||||
|
]
|
||||||
p = subprocess.Popen(
|
p = subprocess.Popen(
|
||||||
prompt,
|
args,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE
|
||||||
shell=True
|
|
||||||
)
|
)
|
||||||
with Benchmark('FFP'):
|
with Benchmark('FFP'):
|
||||||
code = await self.loop.run_in_executor(None, p.wait)
|
code = await self.loop.run_in_executor(None, p.wait)
|
||||||
|
Loading…
Reference in New Issue
Block a user