def dump_video(self, filename, meta_data):
        """
        Dump a video from videolectures.net
        """
        if os.path.exists(filename):
            if self.opts.overwrite is True and self.opts.resume is False:
                os.remove(filename)
            elif self.opts.overwrite is False and self.opts.resume is False:
                self.error(DownloadError,
                           ("ERROR: file already exists. " +
                            "remove it or use `overwrite`"))

        try:
            stdout = open(os.path.devnull, 'w')
            subprocess.call(
                ['rtmpdump', '-h'],
                stdout=stdout,
                stderr=subprocess.STDOUT)
        except (OSError, __HOLE__):
            print('ERROR: rtmpdump could not be run. check the binary path.')
            sys.exit(1)
        finally:
            stdout.close()

        basic_args = [
            'rtmpdump', '-q', '-r', meta_data['streamer'],
            '-y', meta_data['source'],
            '-a', 'vod', '-o', filename,
        ]
        if self.opts.resume is True:
            basic_args.append('-e')

        retval = subprocess.Popen(basic_args)

        while True:
            if retval.poll() is not None:
                break
            if not os.path.exists(filename):
                continue

            previous_size = os.path.getsize(filename)
            display_size = _convert_display_size(previous_size)
            self._to_stdout(self._CLEAR_STDOUT, skip_eol=True)
            self._to_stdout('\r[rtmpdump] {0}'.format(
                display_size),
                skip_eol=True)
            time.sleep(2.0)

        if retval.wait() == 0:
            current_size = os.path.getsize(filename)
            display_size = _convert_display_size(current_size)
            self._to_stdout(self._CLEAR_STDOUT, skip_eol=True)
            self._to_stdout('\r[rtmpdump] {0}'.format(
                display_size))
            return True
        else:
            self.error(DownloadError,
                       ('ERROR: download may be incomplete.' +
                        ' rtmpdump exited with code 1 or 2'))
            return False
dataset/ETHPy150Open smly/videolectures-dl/videolectures/util.py/VideoDownloader.dump_video