status is working
This commit is contained in:
2
setup.py
2
setup.py
@@ -6,7 +6,7 @@ with open('README.md') as file:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="tatt",
|
name="tatt",
|
||||||
version="0.958",
|
version="0.970",
|
||||||
py_modules=['tatt'],
|
py_modules=['tatt'],
|
||||||
url='https://github.com/zevaverbach/tatt',
|
url='https://github.com/zevaverbach/tatt',
|
||||||
install_requires=[
|
install_requires=[
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from typing import Dict, List
|
||||||
|
|
||||||
from tatt import config, exceptions, vendors
|
from tatt import config, exceptions, vendors
|
||||||
|
|
||||||
LB = '\n'
|
LB = '\n'
|
||||||
@@ -67,7 +69,11 @@ def print_transcription_jobs(jobs):
|
|||||||
print()
|
print()
|
||||||
|
|
||||||
|
|
||||||
def get_transcription_jobs(service_name=None, name=None, status=None):
|
def get_transcription_jobs(
|
||||||
|
service_name=None,
|
||||||
|
name=None,
|
||||||
|
status=None
|
||||||
|
) -> Dict[str, List[dict]]:
|
||||||
all_jobs = {}
|
all_jobs = {}
|
||||||
for stt_name in vendors.SERVICES:
|
for stt_name in vendors.SERVICES:
|
||||||
if service_name is None or service_name == stt_name:
|
if service_name is None or service_name == stt_name:
|
||||||
@@ -77,6 +83,10 @@ def get_transcription_jobs(service_name=None, name=None, status=None):
|
|||||||
status=status)
|
status=status)
|
||||||
if jobs:
|
if jobs:
|
||||||
all_jobs[stt_name] = jobs
|
all_jobs[stt_name] = jobs
|
||||||
|
|
||||||
|
if name and len(all_jobs) == 0:
|
||||||
|
raise exceptions.DoesntExistError
|
||||||
|
|
||||||
return all_jobs
|
return all_jobs
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ def get(name, save, pretty):
|
|||||||
|
|
||||||
file = None
|
file = None
|
||||||
if save:
|
if save:
|
||||||
filepath = f'{name}.json', 'w'
|
filepath = f'{name}.json'
|
||||||
file = open(filepath)
|
file = open(filepath)
|
||||||
|
|
||||||
click.echo(transcript, file=file)
|
click.echo(transcript, file=file)
|
||||||
@@ -72,10 +72,15 @@ def services(free_only):
|
|||||||
@cli.command()
|
@cli.command()
|
||||||
@click.argument('job_name', type=str)
|
@click.argument('job_name', type=str)
|
||||||
def status(job_name):
|
def status(job_name):
|
||||||
|
"""Check the status of a transcription job."""
|
||||||
|
try:
|
||||||
jobs = get_transcription_jobs(name=job_name)
|
jobs = get_transcription_jobs(name=job_name)
|
||||||
if not jobs or not list(jobs.values())[0]:
|
except exceptions.DoesntExistError:
|
||||||
raise click.ClickException('no job by that name')
|
raise click.ClickException('no job by that name')
|
||||||
click.echo(list(jobs.values())[0][0]['status'])
|
for job_list in jobs.values():
|
||||||
|
for job in job_list:
|
||||||
|
click.echo(job['status'])
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
|
|||||||
Reference in New Issue
Block a user