Beispiel #1
0
    def test_init(self):
        fields = {
            'uuid': '8d40175d-274b-4885-8ad3-c256054cb024',
        }
        self.model = Transcript(fields=fields)

        assert hasattr(self.model, 'uuid')
        assert self.model.uuid == fields['uuid']
def download_transcript(media_uuid):
    media_item = Media.get(client=client, uuid=media_uuid)
    print media_item.current_transcript

    transcript = Transcript.get(client=client, uuid=media_item.current_transcript['uuid'], format='srt')
    if not os.path.exists(settings.get('base','path.local.scripts.output')):
        os.makedirs(settings.get('base','path.local.scripts.output'))
    f = open("%s/%s.srt" % (settings.get('base','path.local.scripts.output'), media_item.title), 'w')
    f.write(transcript.content)
Beispiel #3
0
    def test_get_json(self):
        self.model = Transcript.get_all(self.client)[0]
        transcript = Transcript.get(self.client, uuid=self.model.uuid)

        assert hasattr(transcript, 'segmentation')
        assert len(transcript.segmentation) > 0
        # TODO: from jsonschema import validate
        for segment in transcript.segmentation:
            assert 'start' in segment
            assert 'end' in segment
            #assert 'speaker' in segment
            assert 'labels' in segment
            assert len(segment['labels']) > 0
            for label in segment['labels']:
                assert 'start' in label
                assert 'end' in label
                assert 'confidence' in label
                #assert 'id' in label
                assert 'value' in label
def download_transcript(media_uuid):
    media_item = Media.get(client=client, uuid=media_uuid)
    print media_item.current_transcript

    transcript = Transcript.get(client=client,
                                uuid=media_item.current_transcript['uuid'],
                                format='srt')
    if not os.path.exists(settings.get('base', 'path.local.scripts.output')):
        os.makedirs(settings.get('base', 'path.local.scripts.output'))
    f = open(
        "%s/%s.srt" %
        (settings.get('base', 'path.local.scripts.output'), media_item.title),
        'w')
    f.write(transcript.content)
Beispiel #5
0
 def test_get_all(self):
     self.models = Transcript.get_all(client=self.client)
     assert len(self.models) > 0
     assert hasattr(self.models[0], 'uuid')
     assert hasattr(self.models[0], 'version')
Beispiel #6
0
 def test_get_srt(self):
     self.model = Transcript.get_all(self.client)[0]
     transcript = Transcript.get(self.client, uuid=self.model.uuid, format='srt')
     assert hasattr(transcript, 'content')
     assert '00:00:00,000 -->' in transcript.content