Example #1
0
class RevClientTestCase(unittest.TestCase):

    def setUp(self):
        self.client = RevClient()

    def tearDown(self):
        self.client = None

    def test_get_orders_page(self):
        # Test first page
        first_page = self.client.get_orders_page(page=0)
        assert hasattr(first_page, 'page')
        assert first_page.page == 0

        if first_page.total_count > 0:
            assert len(first_page.orders) > 0

            # Test last page
            last_page_number = int(math.ceil(first_page.total_count/first_page.results_per_page))
            last_page = self.client.get_orders_page(page=last_page_number)
            assert last_page.page == last_page_number
            assert len(last_page.orders) > 0
            assert len(last_page.orders) == first_page.results_per_page - (first_page.results_per_page * (last_page_number+1)) + first_page.total_count

            # Test no more pages
            unexisting_page = self.client.get_orders_page(page=last_page_number+1)
            assert unexisting_page.page == last_page_number+1
            assert len(unexisting_page.orders) == 0

    #def test_get_order(self):
    #    response = self.client.get_order("blabla")

    #def test_cancel_order(self):
    #    response = self.client.cancel_order("blabla")

    def test_create_input_from_link(self):
        response = self.client.create_input_from_link(self.client.settings.get("test", "audio_test"))
        assert response.status_code == 201
Example #2
0
#!/usr/bin/env python

"""
This script shows how to download docx transcripts and transform them to plain text files.
Results will be stored in /examples/transcripts/
To run this script, make sure the settings.ini file at the root of the project is properly filled.
"""

import os
import pprint
from rev.client import RevClient
from rev.models.order import Order
pp = pprint.PrettyPrinter(indent=4)

client = RevClient()

order_client_ids = [
'babc64e8-7451-4898-9477-f2c8f2495fee',
]


print "%i orders to download" % len(order_client_ids)
nb_downloaded = 0

for client_ref in order_client_ids:
    # Get the path to the transcript
    transcript_id = Order.transcript_path(
        client=client,
        client_ref=client_ref
    )
    local_file_path = "%s%s.txt" % (
Example #3
0
 def setUp(self):
     self.client = RevClient()
Example #4
0
#!/usr/bin/env python
"""
This script shows how to download docx transcripts and transform them to plain text files.
Results will be stored in /examples/transcripts/
To run this script, make sure the settings.ini file at the root of the project is properly filled.
"""

import os
import pprint
from rev.client import RevClient
from rev.models.order import Order
pp = pprint.PrettyPrinter(indent=4)

client = RevClient()

order_client_ids = [
    'babc64e8-7451-4898-9477-f2c8f2495fee',
]

print "%i orders to download" % len(order_client_ids)
nb_downloaded = 0

for client_ref in order_client_ids:
    # Get the path to the transcript
    transcript_id = Order.transcript_path(client=client, client_ref=client_ref)
    local_file_path = "%s%s.txt" % (client.settings.get(
        "base", "local_path"), client_ref)

    print "Downloading match %s -- (%i of %i)" % (
        transcript_id, nb_downloaded + 1, len(order_client_ids))
    client.save_transcript(transcript_id=transcript_id, path=local_file_path)
"""
This script shows how to create a transcription order.
To run this script, make sure the settings.ini file at the root of the project is properly filled.
"""


import pprint
from rev.client import RevClient
from rev.models.order_request import Input
from rev.models.order_request import TranscriptionOptions
from rev.models.order_request import OrderRequest
from rev.models.order_request import Notification
pp = pprint.PrettyPrinter(indent=4)

client = RevClient()

# list of media items to transcribe
media = [
    # (<client_order_reference>, <path to the media file>, <duration of the media file>, <filename>)
    #(
    #    client.settings.get("test", "order_reference"),
    #    client.settings.get("test", "audio_test"),
    #    client.settings.get("test", "audio_test_duration"),
    #    client.settings.get("test", "filename"),
    #)
('babc64e8-7451-4898-9477-f2c8f2495fee','https://usermedia.koemei.com.s3.amazonaws.com/d5cf61db-cb7b-452b-b046-893c3e7efdc8/399de12f-bef7-41a7-b9fd-5b35c1bc4d9b/14-07-23/d2aeec07-1e7b-4309-8ff5-d9f9ff8411c5/babc64e8-7451-4898-9477-f2c8f2495fee.mp4?Signature=FIE7LSUASqNrqbvQb%2FviDicig9A%3D&Expires=1406550750&AWSAccessKeyId=AKIAI6JK3RXCKBQ54KXA',3, 'UNEX-X477.1/x477_1_m5_ s1.mp4'),
]

# convert the media list to an input list
for ref, url, length, filename in media:
#!/usr/bin/env python
"""
This script shows how to create a transcription order.
To run this script, make sure the ~/.rev_settings file is properly filled.
"""

import pprint
from rev.client import RevClient
from rev.models.order_request import Input
from rev.models.order_request import TranscriptionOptions
from rev.models.order_request import OrderRequest
from rev.models.order_request import Notification
pp = pprint.PrettyPrinter(indent=4)

client = RevClient()

# list of media items to transcribe
media = [
    # (<client_order_reference>, <path to the media file>, <duration of the media file>, <filename>)
    #(
    #    client.settings.get("test", "order_reference"),
    #    client.settings.get("test", "audio_test"),
    #    client.settings.get("test", "audio_test_duration"),
    #    client.settings.get("test", "filename"),
    #)
    ('babc64e8-7451-4898-9477-f2c8f2495fee',
     'https://usermedia.koemei.com.s3.amazonaws.com/d5cf61db-cb7b-452b-b046-893c3e7efdc8/399de12f-bef7-41a7-b9fd-5b35c1bc4d9b/14-07-23/d2aeec07-1e7b-4309-8ff5-d9f9ff8411c5/babc64e8-7451-4898-9477-f2c8f2495fee.mp4?Signature=FIE7LSUASqNrqbvQb%2FviDicig9A%3D&Expires=1406550750&AWSAccessKeyId=AKIAI6JK3RXCKBQ54KXA',
     3, 'UNEX-X477.1/x477_1_m5_ s1.mp4'),
]

# convert the media list to an input list