diff --git a/skill/app.py b/skill/app.py index 4194756..bafa026 100755 --- a/skill/app.py +++ b/skill/app.py @@ -364,7 +364,11 @@ class NaviSonicPlayMusicByCurrentArtist(AbstractRequestHandler): return is_intent_name('NaviSonicPlayMusicByCurrentArtist')(handler_input) def handle(self, handler_input: HandlerInput) -> Response: - logger.debug('In NaviSonicPlayMusicByCurrentArtist Handler') + global backgroundProcess + logger.debug('In NaviSonicPlayMusicByCurrentArtist Handler (custom)') + if backgroundProcess is not None: + backgroundProcess.terminate() + backgroundProcess.join() t = get_current_song_details() #current "T"rack @@ -373,11 +377,6 @@ class NaviSonicPlayMusicByCurrentArtist(AbstractRequestHandler): song_id_list = connection.build_song_list_from_albums(artist_album_lookup, min_song_count) play_queue.clea - global backgroundProcess - if backgroundProcess is not None: - backgroundProcess.terminate() - backgroundProcess.join() - controller.enqueue_songs(connection, play_queue, [song_id_list[0], song_id_list[1]]) # When generating the playlist return the first two tracks. backgroundProcess = Process(target=queue_worker_thread, args=(connection, play_queue, song_id_list[2:])) # Create a thread to enqueue the remaining tracks backgroundProcess.start() # Start the additional thread @@ -396,7 +395,11 @@ class NaviSonicPlayMusicByCurrentAlbum(AbstractRequestHandler): return is_intent_name('NaviSonicPlayMusicByCurrentAlbum')(handler_input) def handle(self, handler_input: HandlerInput) -> Response: - logger.debug('In NaviSonicPlayMusicByCurrentAlbum Handler') + global backgroundProcess + logger.debug('In NaviSonicPlayMusicByCurrentAlbum Handler (custom)') + if backgroundProcess is not None: + backgroundProcess.terminate() + backgroundProcess.join() t = get_current_song_details() #current "T"rack @@ -407,11 +410,6 @@ class NaviSonicPlayMusicByCurrentAlbum(AbstractRequestHandler): song_id_list = connection.build_song_list_from_albums(result, -1) play_queue.clear() - global backgroundProcess - if backgroundProcess is not None: - backgroundProcess.terminate() - backgroundProcess.join() - controller.enqueue_songs(connection, play_queue, [song_id_list[0], song_id_list[1]]) # When generating the playlist return the first two tracks. backgroundProcess = Process(target=queue_worker_thread, args=(connection, play_queue, song_id_list[2:])) # Create a thread to enqueue the remaining tracks backgroundProcess.start() # Start the additional thread