]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/downloader/mplayer.py
72cef30eaf3718ad8932814a627042cc0bdff361
1 from __future__
import unicode_literals
6 from .common
import FileDownloader
13 class MplayerFD(FileDownloader
):
14 def real_download(self
, filename
, info_dict
):
15 url
= info_dict
['url']
16 self
.report_destination(filename
)
17 tmpfilename
= self
.temp_name(filename
)
20 'mplayer', '-really-quiet', '-vo', 'null', '-vc', 'dummy',
21 '-dumpstream', '-dumpfile', tmpfilename
, url
]
22 # Check for mplayer first
23 if not check_executable('mplayer', ['-h']):
24 self
.report_error('MMS or RTSP download detected but "%s" could not be run' % args
[0])
27 # Download using mplayer.
28 retval
= subprocess
.call(args
)
30 fsize
= os
.path
.getsize(encodeFilename(tmpfilename
))
31 self
.to_screen('\r[%s] %s bytes' % (args
[0], fsize
))
32 self
.try_rename(tmpfilename
, filename
)
34 'downloaded_bytes': fsize
,
42 self
.report_error('mplayer exited with code %d' % retval
)