]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/downloader/rtsp.py
3eb29526cbc90cb3351c75876698a1b238c07ef8
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.')
30 retval
= subprocess
.call(args
)
32 fsize
= os
.path
.getsize(encodeFilename(tmpfilename
))
33 self
.to_screen('\r[%s] %s bytes' % (args
[0], fsize
))
34 self
.try_rename(tmpfilename
, filename
)
36 'downloaded_bytes': fsize
,
44 self
.report_error('%s exited with code %d' % (args
[0], retval
))