mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-18 01:44:13 -05:00
[ffmpeg] Smarter detection of ffprobe filename
This commit is contained in:
parent
b5e9a641f5
commit
8420a4d063
1 changed files with 8 additions and 3 deletions
|
@ -113,15 +113,20 @@ def _determine_executables(self):
|
||||||
f'ffmpeg-location {location} does not exist! Continuing without ffmpeg', only_once=True)
|
f'ffmpeg-location {location} does not exist! Continuing without ffmpeg', only_once=True)
|
||||||
return {}
|
return {}
|
||||||
elif os.path.isdir(location):
|
elif os.path.isdir(location):
|
||||||
dirname, basename = location, None
|
dirname, basename, filename = location, None, None
|
||||||
else:
|
else:
|
||||||
basename = os.path.splitext(os.path.basename(location))[0]
|
filename = os.path.basename(location)
|
||||||
basename = next((p for p in programs if basename.startswith(p)), 'ffmpeg')
|
basename = next((p for p in programs if p in filename), 'ffmpeg')
|
||||||
dirname = os.path.dirname(os.path.abspath(location))
|
dirname = os.path.dirname(os.path.abspath(location))
|
||||||
if basename in self._ffmpeg_to_avconv.keys():
|
if basename in self._ffmpeg_to_avconv.keys():
|
||||||
self._prefer_ffmpeg = True
|
self._prefer_ffmpeg = True
|
||||||
|
|
||||||
paths = {p: os.path.join(dirname, p) for p in programs}
|
paths = {p: os.path.join(dirname, p) for p in programs}
|
||||||
|
if basename and basename in filename:
|
||||||
|
for p in programs:
|
||||||
|
path = os.path.join(dirname, filename.replace(basename, p))
|
||||||
|
if os.path.exists(path):
|
||||||
|
paths[p] = path
|
||||||
if basename:
|
if basename:
|
||||||
paths[basename] = location
|
paths[basename] = location
|
||||||
return paths
|
return paths
|
||||||
|
|
Loading…
Reference in a new issue