Skip to content

Commit

Permalink
check content_type for mp3 stream
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryyip authored May 21, 2018
1 parent f350ad6 commit 098df77
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions avs/alexa.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def iter_lines(response, delimiter=None):
logger.debug(json_payload)
if 'directive' in json_payload:
directives.append(json_payload['directive'])
else:
elif content_type == "application/octet-stream":
logger.info("Finished downloading {} which is {}".format(
content_type, content_id))
payload.seek(0)
Expand All @@ -331,9 +331,9 @@ def iter_lines(response, delimiter=None):
filename = hashlib.md5(filename).hexdigest()
with open(os.path.join(tempfile.gettempdir(), '{}.mp3'.format(filename)), 'wb') as f:
f.write(payload.read())

logger.info('write audio to {}.mp3'.format(content_id))

else:
logger.info("Finished downloading {} which is {} abandon it".format(content_type, content_id))
continue
elif on_boundary:
# logger.debug("Now in header")
Expand Down

0 comments on commit 098df77

Please sign in to comment.