Adicionando skills para tocar mais musicas do artista/album que esta sendo tocado no momento
Some checks failed
Documentation Generator / Build Sphinx documentation (push) Has been cancelled
Some checks failed
Documentation Generator / Build Sphinx documentation (push) Has been cancelled
This commit is contained in:
28
skill/app.py
28
skill/app.py
@@ -375,15 +375,22 @@ class NaviSonicPlayMusicByCurrentArtist(AbstractRequestHandler):
|
|||||||
artist_lookup = connection.search_artist(t["artist"])
|
artist_lookup = connection.search_artist(t["artist"])
|
||||||
artist_album_lookup = connection.albums_by_artist(artist_lookup[0].get('id'))
|
artist_album_lookup = connection.albums_by_artist(artist_lookup[0].get('id'))
|
||||||
song_id_list = connection.build_song_list_from_albums(artist_album_lookup, min_song_count)
|
song_id_list = connection.build_song_list_from_albums(artist_album_lookup, min_song_count)
|
||||||
play_queue.clea
|
play_queue.clear()
|
||||||
|
|
||||||
controller.enqueue_songs(connection, play_queue, [song_id_list[0], song_id_list[1]]) # When generating the playlist return the first two tracks.
|
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 = 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
|
backgroundProcess.start() # Start the additional thread
|
||||||
|
|
||||||
text = f'Tocando mais músicas de {t["_sanitized"]["artist"]}'
|
speech = sanitise_speech_output(f'Tocando mais músicas de {t["artist"]}')
|
||||||
handler_input.response_builder.speak(text)
|
logger.info(speech)
|
||||||
return handler_input.response_builder.response
|
|
||||||
|
card = {'title': 'AskNavidrome',
|
||||||
|
'text': speech
|
||||||
|
}
|
||||||
|
|
||||||
|
play_queue.shuffle()
|
||||||
|
track_details = play_queue.get_next_track()
|
||||||
|
return controller.start_playback('play', speech, card, track_details, handler_input)
|
||||||
|
|
||||||
class NaviSonicPlayMusicByCurrentAlbum(AbstractRequestHandler):
|
class NaviSonicPlayMusicByCurrentAlbum(AbstractRequestHandler):
|
||||||
"""Handle NaviSonicPlayMusicByCurrentAlbum Intent
|
"""Handle NaviSonicPlayMusicByCurrentAlbum Intent
|
||||||
@@ -414,9 +421,16 @@ class NaviSonicPlayMusicByCurrentAlbum(AbstractRequestHandler):
|
|||||||
backgroundProcess = Process(target=queue_worker_thread, args=(connection, play_queue, song_id_list[2:])) # Create a thread to enqueue the remaining 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
|
backgroundProcess.start() # Start the additional thread
|
||||||
|
|
||||||
text = f'Tocando mais músicas de do album {t["_sanitized"]["album"]}'
|
speech = sanitise_speech_output(f'Tocando mais músicas do album {t["album"]}, de {t["artist"]}')
|
||||||
handler_input.response_builder.speak(text)
|
logger.info(speech)
|
||||||
return handler_input.response_builder.response
|
|
||||||
|
card = {'title': 'AskNavidrome',
|
||||||
|
'text': speech
|
||||||
|
}
|
||||||
|
|
||||||
|
play_queue.shuffle()
|
||||||
|
track_details = play_queue.get_next_track()
|
||||||
|
return controller.start_playback('play', speech, card, track_details, handler_input)
|
||||||
|
|
||||||
class NaviSonicPlayAlbumByArtist(AbstractRequestHandler):
|
class NaviSonicPlayAlbumByArtist(AbstractRequestHandler):
|
||||||
"""Handle NaviSonicPlayAlbumByArtist
|
"""Handle NaviSonicPlayAlbumByArtist
|
||||||
|
|||||||
Reference in New Issue
Block a user