aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-08-30 18:10:48 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-08-30 18:13:38 +0530
commite1eabd7beb4cc83338a7422546ae1c9ae8b2097f (patch)
treefc87d7de8a72edda9f4e70bfa2f4b5e3adb848c4
parentd81ba7d491bf2c89246d8817438db48a5a4e4ae9 (diff)
downloadhypervideo-pre-e1eabd7beb4cc83338a7422546ae1c9ae8b2097f.tar.lz
hypervideo-pre-e1eabd7beb4cc83338a7422546ae1c9ae8b2097f.tar.xz
hypervideo-pre-e1eabd7beb4cc83338a7422546ae1c9ae8b2097f.zip
[downloader/external] Smarter detection of executable
Closes #4778
-rw-r--r--yt_dlp/downloader/external.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/yt_dlp/downloader/external.py b/yt_dlp/downloader/external.py
index 9859a7b33..d117c06e0 100644
--- a/yt_dlp/downloader/external.py
+++ b/yt_dlp/downloader/external.py
@@ -515,16 +515,14 @@ _BY_NAME = {
if name.endswith('FD') and name not in ('ExternalFD', 'FragmentFD')
}
-_BY_EXE = {klass.EXE_NAME: klass for klass in _BY_NAME.values()}
-
def list_external_downloaders():
return sorted(_BY_NAME.keys())
def get_external_downloader(external_downloader):
- """ Given the name of the executable, see whether we support the given
- downloader . """
- # Drop .exe extension on Windows
+ """ Given the name of the executable, see whether we support the given downloader """
bn = os.path.splitext(os.path.basename(external_downloader))[0]
- return _BY_NAME.get(bn, _BY_EXE.get(bn))
+ return _BY_NAME.get(bn) or next((
+ klass for klass in _BY_NAME.values() if klass.EXE_NAME in bn
+ ), None)