def create_proxy()

in gnm_deliverables/models.py [0:0]


    def create_proxy(self, priority='MEDIUM'):
        """
        tells VS to start proxying the file.  This is done seperately to the ingest portion, so that we can use
        Vidispine's understanding of the file format in order to determine which is the appropriate transcoding
        to use.
        Can raise either a VSException or a vidispine_api.HttpError if the operation fails.
        This is normally called from the callback endpoint, so we have no user present suitable for "run-as"
        :return:
        """
        item_info = self.item(None)     # caller should catch exceptions from this
        if item_info is None:
            raise ValueError("Item is not imported")

        mime_type = item_info.get("mimeType")
        if mime_type is None:
            logger.error("{0} for deliverable asset {1} in {2}: Could not determine MIME type for transcode".format(item_info.name, self.id, self.deliverable.id))
            return None

        preset_name = transcode_preset_finder.match(mime_type)
        if preset_name is None:
            logger.error("{0} for deliverable asset {1} in {2}: Did not recognise MIME type {3}".format(item_info.name, self.id, self.deliverable.id, mime_type))
            raise ValueError("Did not recognise MIME type of item")

        try:
            # raises VSNotFound if the shape does not exist, which is what we expect.
            item_info.get_shape(preset_name)
            logger.info("Item {0} already has a shape {1}, not transcoding it".format(item_info.name, preset_name))
            self.status = DELIVERABLE_ASSET_STATUS_TRANSCODED
            self.save()
            return  #don't proceed to make a transcode if one already exists!
        except VSNotFound:
            pass

        logger.info("Requesting transcode to {0} of {1}".format(item_info.name, preset_name))
        job_id = item_info.transcode(preset_name, priority, wait=False, create_thumbnails=True,
                                     job_metadata={
                                        "import_source": "pluto-deliverables",
                                        "project_id": str(self.deliverable.pluto_core_project_id),
                                        "asset_id": str(self.id)
                                    })

        self.job_id = job_id
        self.status = DELIVERABLE_ASSET_STATUS_TRANSCODING
        self.save()
        return job_id