Skip to content

Commit

Permalink
Fix issue [agermanidis#120] with another solution
Browse files Browse the repository at this point in the history
Resolved issue [agermanidis#120] with same solution as pull request [agermanidis#110]
  • Loading branch information
JackieDo committed Dec 30, 2018
1 parent 355972a commit cff85be
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions autosub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,10 @@ def __call__(self, data):

for line in resp.content.decode('utf-8').split("\n"):
try:
if line:
line = json.loads(line)
line = line['result'][0]['alternative'][0]['transcript']
line = line[:1].upper() + line[1:]
else:
line = None

return line
except IndexError:
line = json.loads(line)
line = line['result'][0]['alternative'][0]['transcript']
return line[:1].upper() + line[1:]
except (IndexError, ValueError):
# no result
continue
except KeyboardInterrupt:
Expand Down

0 comments on commit cff85be

Please sign in to comment.