bug fixes and back to pprint for JSON output
This commit is contained in:
2
setup.py
2
setup.py
@@ -6,7 +6,7 @@ with open('README.md') as file:
|
||||
|
||||
setup(
|
||||
name="tatt",
|
||||
version="0.943",
|
||||
version="0.947",
|
||||
py_modules=['tatt'],
|
||||
url='https://github.com/zevaverbach/tatt',
|
||||
install_requires=[
|
||||
|
||||
@@ -25,17 +25,18 @@ def make_string_all_services(free_only=False):
|
||||
|
||||
|
||||
def get_job(job_name):
|
||||
job = helpers.get_transcription_jobs_dict().get(name)
|
||||
job = get_transcription_jobs_dict().get(job_name)
|
||||
if not job:
|
||||
raise exceptions.DoesntExistError
|
||||
if job['status'].lower() != 'completed':
|
||||
raise exceptions.NotAvailable(f'transcript status is {job["status"]}')
|
||||
return job
|
||||
|
||||
|
||||
def get_transcript(job_name):
|
||||
job = get_job(job_name)
|
||||
service = get_service(job['service_name'])
|
||||
return service.retrieve_transcript(name)
|
||||
return service.retrieve_transcript(job_name)
|
||||
|
||||
|
||||
def get_service(service_name):
|
||||
|
||||
@@ -19,14 +19,14 @@ def cli():
|
||||
def get(name, save):
|
||||
"""Downloads and/or saves completed transcript."""
|
||||
try:
|
||||
transcript = get_transcript(name)
|
||||
transcript = helpers.get_transcript(name)
|
||||
except exceptions.DoesntExistError:
|
||||
raise click.ClickException(f'no such transcript {name}')
|
||||
except exceptions.NotAvailable as e:
|
||||
raise click.ClickException(str(e))
|
||||
|
||||
if not save:
|
||||
click.echo(transcript)
|
||||
pprint(transcript)
|
||||
else:
|
||||
with open(f'{name}.json', 'w') as fout:
|
||||
fout.write(json.dumps(transcript))
|
||||
|
||||
Reference in New Issue
Block a user