aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/PostProcessor.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2012-10-08 22:14:19 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2012-10-08 22:14:19 +0200
commit65f934dc930f7996e137d61dd80ef092f9075532 (patch)
tree53a135183a1fa18a42aa9a8a5546065784a72a12 /youtube_dl/PostProcessor.py
parentb7b4796bf263295616aa1f7c8d3b8e4104601838 (diff)
Correct detect_executables on Windows (Closes #447, #457)
Diffstat (limited to 'youtube_dl/PostProcessor.py')
-rw-r--r--youtube_dl/PostProcessor.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/youtube_dl/PostProcessor.py b/youtube_dl/PostProcessor.py
index 375da1aa3..f2e2aa1fa 100644
--- a/youtube_dl/PostProcessor.py
+++ b/youtube_dl/PostProcessor.py
@@ -71,13 +71,14 @@ class FFmpegExtractAudioPP(PostProcessor):
@staticmethod
def detect_executables():
- available = {'avprobe' : False, 'avconv' : False, 'ffmpeg' : False, 'ffprobe' : False}
- for path in os.environ["PATH"].split(os.pathsep):
- for program in available.keys():
- exe_file = os.path.join(path, program)
- if os.path.isfile(exe_file) and os.access(exe_file, os.X_OK):
- available[program] = exe_file
- return available
+ def executable(exe):
+ try:
+ subprocess.check_output([exe, '-version'])
+ except OSError:
+ return False
+ return exe
+ programs = ['avprobe', 'avconv', 'ffmpeg', 'ffprobe']
+ return dict((program, executable(program)) for program in programs)
def get_audio_codec(self, path):
if not self._exes['ffprobe'] and not self._exes['avprobe']: return None