4 from .common import FileDownloader
10 class MplayerFD(FileDownloader):
11 def real_download(self, filename, info_dict):
12 url = info_dict['url']
13 self.report_destination(filename)
14 tmpfilename = self.temp_name(filename)
16 args = ['mplayer', '-really-quiet', '-vo', 'null', '-vc', 'dummy', '-dumpstream', '-dumpfile', tmpfilename, url]
17 # Check for mplayer first
19 subprocess.call(['mplayer', '-h'], stdout=(open(os.path.devnull, 'w')), stderr=subprocess.STDOUT)
20 except (OSError, IOError):
21 self.report_error(u'MMS or RTSP download detected but "%s" could not be run' % args[0])
24 # Download using mplayer.
25 retval = subprocess.call(args)
27 fsize = os.path.getsize(encodeFilename(tmpfilename))
28 self.to_screen(u'\r[%s] %s bytes' % (args[0], fsize))
29 self.try_rename(tmpfilename, filename)
31 'downloaded_bytes': fsize,
39 self.report_error(u'mplayer exited with code %d' % retval)