1 from __future__ import unicode_literals
6 from .common import FileDownloader
13 class RtspFD(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)
19 if check_executable('mplayer', ['-h']):
21 'mplayer', '-really-quiet', '-vo', 'null', '-vc', 'dummy',
22 '-dumpstream', '-dumpfile', tmpfilename, url]
23 elif check_executable('mpv', ['-h']):
25 'mpv', '-really-quiet', '--vo=null', '--stream-dump=' + tmpfilename, url]
27 self.report_error('MMS or RTSP download detected but neither "mplayer" nor "mpv" could be run. Please install any.')
32 retval = subprocess.call(args)
34 fsize = os.path.getsize(encodeFilename(tmpfilename))
35 self.to_screen('\r[%s] %s bytes' % (args[0], fsize))
36 self.try_rename(tmpfilename, filename)
38 'downloaded_bytes': fsize,
46 self.report_error('%s exited with code %d' % (args[0], retval))