Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making card_data optional for play_later #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions SingleStream/lambda/py/alexa/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,22 @@ def play_later(url, card_data, response_builder):
REPLACE_ENQUEUED: Replace all streams in the queue. This does not impact the currently playing stream.
"""
# type: (str, Dict, ResponseFactory) -> Response
if card_data:
# Using URL as token as they are all unique
response_builder.add_directive(
PlayDirective(
play_behavior=PlayBehavior.REPLACE_ENQUEUED,
audio_item=AudioItem(
stream=Stream(
token=url,
url=url,
offset_in_milliseconds=0,
expected_previous_token=None),
metadata=add_screen_background(card_data)))
).set_should_end_session(True)

return response_builder.response
# Using URL as token as they are all unique
response_builder.add_directive(
PlayDirective(
play_behavior=PlayBehavior.REPLACE_ENQUEUED,
audio_item=AudioItem(
stream=Stream(
token=url,
url=url,
offset_in_milliseconds=0,
expected_previous_token=None),
metadata=add_screen_background(card_data) if card_data else None
)
)
).set_should_end_session(True)

return response_builder.response

def stop(text, response_builder):
"""Issue stop directive to stop the audio.
Expand Down