[downloader/mplayer] Use check_executable
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Fri, 2 Jan 2015 23:33:36 +0000 (00:33 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Fri, 2 Jan 2015 23:33:36 +0000 (00:33 +0100)
youtube_dl/downloader/mplayer.py

index c53195da0c9471d55a61b53b1041e05ee209697e..34b23b5c295e178df4892761e6afa62304b07704 100644 (file)
@@ -6,6 +6,7 @@ import subprocess
 from .common import FileDownloader
 from ..compat import compat_subprocess_get_DEVNULL
 from ..utils import (
+    check_executable,
     encodeFilename,
 )
 
@@ -20,11 +21,7 @@ class MplayerFD(FileDownloader):
             'mplayer', '-really-quiet', '-vo', 'null', '-vc', 'dummy',
             '-dumpstream', '-dumpfile', tmpfilename, url]
         # Check for mplayer first
-        try:
-            subprocess.call(
-                ['mplayer', '-h'],
-                stdout=compat_subprocess_get_DEVNULL(), stderr=subprocess.STDOUT)
-        except (OSError, IOError):
+        if not check_executable('mplayer', ['-h']):
             self.report_error('MMS or RTSP download detected but "%s" could not be run' % args[0])
             return False