From 5fc70e2e78a954021186a63810f4491c8a89b220 Mon Sep 17 00:00:00 2001 From: rerenoob Date: Sat, 16 Nov 2019 00:09:01 -0600 Subject: [PATCH] Making card_data optional for play_later --- SingleStream/lambda/py/alexa/util.py | 31 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/SingleStream/lambda/py/alexa/util.py b/SingleStream/lambda/py/alexa/util.py index c8252b4..d2f4ea2 100644 --- a/SingleStream/lambda/py/alexa/util.py +++ b/SingleStream/lambda/py/alexa/util.py @@ -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.