aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-11-04 00:23:48 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-11-04 02:16:39 +0530
commit9af98e17bd2b761d304e88a359b0f7a40e6c0a67 (patch)
tree17a3b4eb68848edb985fe01a6a5060682ab72b12 /yt_dlp/utils.py
parent31c49255bf647373734c2c7f917e0d24ab81ac95 (diff)
downloadhypervideo-pre-9af98e17bd2b761d304e88a359b0f7a40e6c0a67.tar.lz
hypervideo-pre-9af98e17bd2b761d304e88a359b0f7a40e6c0a67.tar.xz
hypervideo-pre-9af98e17bd2b761d304e88a359b0f7a40e6c0a67.zip
[ffmpeg] Framework for feature detection
Related: #1502, #1237, https://github.com/ytdl-org/youtube-dl/pull/29581
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r--yt_dlp/utils.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 62f83c9ce..55e452a15 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -4007,10 +4007,7 @@ def check_executable(exe, args=[]):
return exe
-def get_exe_version(exe, args=['--version'],
- version_re=None, unrecognized='present'):
- """ Returns the version of the specified executable,
- or False if the executable is not present """
+def _get_exe_version_output(exe, args):
try:
# STDIN should be redirected too. On UNIX-like systems, ffmpeg triggers
# SIGTTOU if yt-dlp is run in the background.
@@ -4022,7 +4019,7 @@ def get_exe_version(exe, args=['--version'],
return False
if isinstance(out, bytes): # Python 2.x
out = out.decode('ascii', 'ignore')
- return detect_exe_version(out, version_re, unrecognized)
+ return out
def detect_exe_version(output, version_re=None, unrecognized='present'):
@@ -4036,6 +4033,14 @@ def detect_exe_version(output, version_re=None, unrecognized='present'):
return unrecognized
+def get_exe_version(exe, args=['--version'],
+ version_re=None, unrecognized='present'):
+ """ Returns the version of the specified executable,
+ or False if the executable is not present """
+ out = _get_exe_version_output(exe, args)
+ return detect_exe_version(out, version_re, unrecognized) if out else False
+
+
class LazyList(collections.abc.Sequence):
''' Lazy immutable list from an iterable
Note that slices of a LazyList are lists and not LazyList'''