]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
Added support for mpv if mplayer is not available
authormrkrossxdx <mrkrossxdx@libero.it>
Fri, 24 Apr 2015 18:50:34 +0000 (20:50 +0200)
committermrkrossxdx <mrkrossxdx@libero.it>
Fri, 24 Apr 2015 18:50:34 +0000 (20:50 +0200)
youtube_dl/downloader/mplayer.py

index 72cef30eaf3718ad8932814a627042cc0bdff361..551c4ae9423dc143a77b28378162c843ae7b110d 100644 (file)
@@ -16,12 +16,19 @@ class MplayerFD(FileDownloader):
         self.report_destination(filename)
         tmpfilename = self.temp_name(filename)
 
-        args = [
-            'mplayer', '-really-quiet', '-vo', 'null', '-vc', 'dummy',
-            '-dumpstream', '-dumpfile', tmpfilename, url]
+        args = []
         # Check for mplayer first
-        if not check_executable('mplayer', ['-h']):
-            self.report_error('MMS or RTSP download detected but "%s" could not be run' % args[0])
+        if check_executable('mplayer', ['-h']):
+            args = [
+                'mplayer', '-really-quiet', '-vo', 'null', '-vc', 'dummy',
+                '-dumpstream', '-dumpfile', tmpfilename, url]
+                        
+        # Check for mpv
+        elif check_executable('mpv', ['-h']):
+            args = [
+                'mpv', '-really-quiet', '--vo=null', '--stream-dump=' + tmpfilename, url]
+        else:
+            self.report_error('MMS or RTSP download detected but neither "mplayer" nor "mpv" could be run')
             return False
 
         # Download using mplayer.