コード例 #1
0
    def align(self,
              client,
              aligndata,
              success_callback_url='',
              error_callback_url='',
              **kwargs):
        """
        Align an existing media item.
        """
        log.info("aligning %s" % aligndata)
        data = {}
        headers = {}
        headers_ = {}

        url = [
            settings.get('base', 'paths.api.media'), self.uuid,
            settings.get('base', 'paths.api.media.align')
        ]

        data, headers_ = multipart_encode({
            'aligndata':
            read_file(aligndata),
            'success_callback_url':
            success_callback_url,
            'error_callback_url':
            error_callback_url
        })
        headers.update(headers_)
        response = client.request(url=url, data=data, headers=headers)
        response_json = json.loads(response)
        self.process_alignment = Process(fields=response_json['process'])
        return self.process_alignment
コード例 #2
0
    def transcribe(self,
                   client,
                   success_callback_url='',
                   error_callback_url='',
                   **kwargs):
        """
        Transcribe an existing media item.
        """
        headers = {}
        url = [
            settings.get('base', 'paths.api.media'), self.uuid,
            settings.get('base', 'paths.api.media.transcribe')
        ]

        data = urllib.urlencode({
            'success_callback_url': success_callback_url,
            'error_callback_url': error_callback_url
        })

        response = client.request(url=url, data="", headers=headers)
        response_json = json.loads(response)

        self.process_transcription = Process(fields=response_json['process'])

        return self.process_transcription
コード例 #3
0
 def test_get(self):
     fields = {
         'uuid': '81c7ed5a-0c21-4485-af81-56a46921dff9',
     }
     self.model = Process.get(client=self.client, uuid=fields['uuid'])
     assert hasattr(self.model, 'status') and self.model.status is not None
     assert self.model.uuid == fields['uuid']
     assert hasattr(self.model, 'status')
コード例 #4
0
    def test_init(self):
        fields = {
            'uuid': '81c7ed5a-0c21-4485-af81-56a46921dff9',
        }
        self.model = Process(fields=fields)

        assert hasattr(self.model, 'uuid')
        assert self.model.uuid == fields['uuid']
コード例 #5
0
 def test_get(self):
     fields = {
         'uuid': '81c7ed5a-0c21-4485-af81-56a46921dff9',
     }
     self.model = Process.get(client=self.client, uuid=fields['uuid'])
     assert hasattr(self.model, 'status') and self.model.status is not None
     assert self.model.uuid == fields['uuid']
     assert hasattr(self.model, 'status')
コード例 #6
0
 def test_get_all(self):
     self.models = Process.get_all(client=self.client)
     assert len(self.models) > 0
     assert hasattr(self.models[0], 'status')
コード例 #7
0
 def test_get_all(self):
     self.models = Process.get_all(client=self.client)
     assert len(self.models) > 0
     assert hasattr(self.models[0], 'status')