]> jfr.im git - yt-dlp.git/commitdiff
[downloader/external] Smarter detection of executable
authorpukkandan <redacted>
Tue, 30 Aug 2022 12:40:48 +0000 (18:10 +0530)
committerpukkandan <redacted>
Tue, 30 Aug 2022 12:43:38 +0000 (18:13 +0530)
Closes #4778

yt_dlp/downloader/external.py

index 9859a7b3337574ba19e4404c91d52d7232ad9f74..d117c06e0a5e923a90f549d1a79b74dfdbda20f5 100644 (file)
@@ -515,16 +515,14 @@ class AVconvFD(FFmpegFD):
     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)