4 from .common
import FileDownloader
5 from ..utils
import check_executable
8 class RtspFD(FileDownloader
):
9 def real_download(self
, filename
, info_dict
):
10 url
= info_dict
['url']
11 self
.report_destination(filename
)
12 tmpfilename
= self
.temp_name(filename
)
14 if check_executable('mplayer', ['-h']):
16 'mplayer', '-really-quiet', '-vo', 'null', '-vc', 'dummy',
17 '-dumpstream', '-dumpfile', tmpfilename
, url
]
18 elif check_executable('mpv', ['-h']):
20 'mpv', '-really-quiet', '--vo=null', '--stream-dump=' + tmpfilename
, url
]
22 self
.report_error('MMS or RTSP download detected but neither "mplayer" nor "mpv" could be run. Please install one')
27 retval
= subprocess
.call(args
)
29 fsize
= os
.path
.getsize(tmpfilename
)
30 self
.to_screen(f
'\r[{args[0]}] {fsize} bytes')
31 self
.try_rename(tmpfilename
, filename
)
33 'downloaded_bytes': fsize
,
41 self
.report_error('%s exited with code %d' % (args
[0], retval
))