def encode(self, media):
        """
        Encode media into a temporary file for the current
        encoding profile.
        """
        temp_file, encode_path = mkstemp(suffix=".%s" % self.container,
                                         dir=settings.FILE_UPLOAD_TEMP_DIR)
        os.close(temp_file)
        command = self.shell_command(media.file.path, encode_path)
        try:
            subprocess.check_call(command, stdin=subprocess.PIPE,
                                  stdout=subprocess.PIPE)
        except subprocess.CalledProcessError as e:
            logger.error("Encoding command returned %d while executing '%s'" %
                         (e.returncode, ' '.join(e.cmd)))
            raise
        except __HOLE__:
            logger.error("Could not find encoding command '%s'" % command[0])
            raise
        return encode_path
dataset/ETHPy150Open jbittel/django-multimedia/multimedia/models.py/EncodeProfile.encode