Open iCanHazSkillz opened 7 months ago
If anyone runs into this issue, I fixed it by modifying the build_song_list_from_playlist() method from subsonic_api.py
def build_song_list_from_playlist(self, id: str) -> list:
"""Build a list of songs from a given playlist
:param str id: The playlist ID
:return: A list of song IDs
:rtype: list
"""
self.logger.debug('In function build_song_list_from_playlist()')
song_id_list = []
playlist_details = self.conn.getPlaylist(id)
song_id_list = [song_detail.get('id') for song_detail in playlist_details.get('playlist').get('entry')]
if len(song_id_list) > 80:
song_id_list = random.sample(song_id_list, k=80)
return song_id_list
The modification lies within this specific if statement:
if len(song_id_list) > 80:
song_id_list = random.sample(song_id_list, k=80)
What does it do: If the playlist is larger than a predetermined amount (80 in my case to be safe) then a random sample of 80 songs is selected from the whole playlist - the rest is dropped. Using this modified method, asknavidrome can now process very large playlists and the random sample ensures you're given a different sample of songs each time it's invoked. Works for me - yay!
I'll leave this issue open in case the author wants to incorporate my changes - otherwise feel free to implement them yourselves. =)
Thanks for posting your solution, I'll see how this can be integrated into the skill at the next release
I faced this issue but found a workaround. So basically it is able to build the queue but not able to play it even though the queue is huge. Then in second voice command you ask alexa to launch the ask navidrome and when it's ready you say resume.
Describe the issue Attempting to play playlist with a large number of songs (>110 from my test) causes alexa to respond with "The requested skill did not provide a valid response.". Decreasing the amount of songs to less than 110 tracks seems to resolve the issue.
Operating System Ubuntu x64
To Reproduce Add over 110 tracks to a playlist in navidrome. Attempt to play the playlist using asknavidrome
Logs 2024-04-10 21:08:46,132 - root - DEBUG - Request received: {'dialog_state': None, 'intent': {'confirmation_status': 'NONE', 'name': 'NaviSonicPlayPlaylist', 'slots': {'playlist': {'confirmation_status': 'NONE', 'name': 'playlist', 'resolutions': {'resolutions_per_authority': [{'authority': 'amzn1.er-authority.echo-sdk.amzn1.ask.skill.8e07a780-22a1-4959-8591-61548821b8ea.playlist_names', 'status': {'code': 'ER_SUCCESS_MATCH'}, 'values': [{'value': {'id': '4733a44073c81970cccbca6e1ede188b', 'name': 'Sara'}}]}]}, 'slot_value': {'object_type': 'Simple', 'resolutions': {'resolutions_per_authority': [{'authority': 'amzn1.er-authority.echo-sdk.amzn1.ask.skill.8e07a780-22a1-4959-8591-61548821b8ea.playlist_names', 'status': {'code': 'ER_SUCCESS_MATCH'}, 'values': [{'value': {'id': '4733a44073c81970cccbca6e1ede188b', 'name': 'Sara'}}]}]}, 'value': 'Sara'}, 'value': 'Sara'}}}, 'locale': 'en-CA', 'object_type': 'IntentRequest', 'request_id': 'amzn1.echo-api.request.4eb5df70-97c2-4feb-98fc-2715d90cecc0', 'timestamp': datetime.datetime(2024, 4, 10, 21, 8, 45, tzinfo=tzlocal())} 2024-04-10 21:08:46,132 - root - DEBUG - In NaviSonicPlayPlaylist 2024-04-10 21:08:46,132 - asknavidrome.subsonic_api - DEBUG - In function search_playlist() 2024-04-10 21:08:46,191 - asknavidrome.subsonic_api - DEBUG - Found playlist 8bd66b50-fb72-4451-965e-6245196f6f51 2024-04-10 21:08:46,191 - asknavidrome.subsonic_api - DEBUG - In function build_song_list_from_playlist() 2024-04-10 21:08:46,257 - asknavidrome.media_queue - DEBUG - In clear() 2024-04-10 21:08:46,257 - asknavidrome.subsonic_api - DEBUG - In function get_song_details() 2024-04-10 21:08:46,309 - asknavidrome.subsonic_api - DEBUG - In function get_song_uri() 2024-04-10 21:08:46,309 - asknavidrome.media_queue - DEBUG - In add_track() 2024-04-10 21:08:46,309 - asknavidrome.media_queue - DEBUG - In add_track() - there are 1 tracks in the queue 2024-04-10 21:08:46,309 - asknavidrome.subsonic_api - DEBUG - In function get_song_details() 2024-04-10 21:08:46,362 - asknavidrome.subsonic_api - DEBUG - In function get_song_uri() 2024-04-10 21:08:46,362 - asknavidrome.media_queue - DEBUG - In add_track() 2024-04-10 21:08:46,362 - asknavidrome.media_queue - DEBUG - In add_track() - there are 2 tracks in the queue 2024-04-10 21:08:46,362 - asknavidrome.subsonic_api - DEBUG - In function get_song_details() 2024-04-10 21:08:46,417 - asknavidrome.subsonic_api - DEBUG - In function get_song_uri() 2024-04-10 21:08:46,417 - asknavidrome.media_queue - DEBUG - In add_track() 2024-04-10 21:08:46,417 - asknavidrome.media_queue - DEBUG - In add_track() - there are 3 tracks in the queue 2024-04-10 21:08:46,417 - asknavidrome.subsonic_api - DEBUG - In function get_song_details() 2024-04-10 21:08:46,472 - asknavidrome.subsonic_api - DEBUG - In function get_song_uri() 2024-04-10 21:08:46,472 - asknavidrome.media_queue - DEBUG - In add_track() 2024-04-10 21:08:46,472 - asknavidrome.media_queue - DEBUG - In add_track() - there are 4 tracks in the queue 2024-04-10 21:08:46,472 - asknavidrome.subsonic_api - DEBUG - In function get_song_details() 2024-04-10 21:08:46,532 - asknavidrome.subsonic_api - DEBUG - In function get_song_uri() 2024-04-10 21:08:46,532 - asknavidrome.media_queue - DEBUG - In add_track() 2024-04-10 21:08:46,532 - asknavidrome.media_queue - DEBUG - In add_track() - there are 5 tracks in the queue ... 2024-04-10 21:08:56,912 - asknavidrome.media_queue - DEBUG - In add_track() - there are 162 tracks in the queue 2024-04-10 21:08:56,912 - asknavidrome.media_queue - DEBUG - In shuffle() 2024-04-10 21:08:56,919 - root - INFO - Playing playlist Sara on home mix. 2024-04-10 21:08:56,919 - asknavidrome.media_queue - DEBUG - In get_next_track() 2024-04-10 21:08:56,927 - asknavidrome.controller - DEBUG - In start_playback() - play mode 2024-04-10 21:08:56,927 - asknavidrome.controller - DEBUG - In add_screen_background() 2024-04-10 21:08:56,927 - asknavidrome.controller - DEBUG - Track ID: 53f615c638f2f8a794d6d220c5da5bf3 2024-04-10 21:08:56,927 - asknavidrome.controller - DEBUG - Track Previous ID: bb027c320bff8ed94d24f0e284fb9998 2024-04-10 21:08:56,927 - asknavidrome.controller - INFO - Playing track: Walla Walla by: The Offspring 2024-04-10 21:08:56,929 - root - DEBUG - Response sent: {'api_response': None, 'can_fulfill_intent': None, 'card': {'image': None, 'object_type': 'Standard', 'text': 'Playing playlist Sara on home mix.', 'title': 'AskNavidrome'}, 'directives': [{'audio_item': {'metadata': {'art': {'content_description': 'AskNavidrome', 'sources': [{'height_pixels': None, 'size': None, 'url': 'https://github.com/navidrome/navidrome/raw/master/resources/logo-192x192.png', 'width_pixels': None}]}, 'background_image': {'content_description': 'AskNavidrome', 'sources': [{'height_pixels': None, 'size': None, 'url': 'https://github.com/navidrome/navidrome/raw/master/resources/logo-192x192.png', 'width_pixels': None}]}, 'subtitle': 'Playing playlist ' 'Sara on home mix.', 'title': 'AskNavidrome'}, 'stream': {'caption_data': None, 'expected_previous_token': None, 'offset_in_milliseconds': 0, 'token': '53f615c638f2f8a794d6d220c5da5bf3', 'url': 'https://homemix.duckdns.org:443/rest/stream.view?f=json&v=1.16.1&c=AskNavidrome&u=michel&s=93782897be156e6555b9e9de36281a44&t=f78a6a83206c9015f3298a5394f84b1c&id=53f615c638f2f8a794d6d220c5da5bf3'}}, 'object_type': 'AudioPlayer.Play', 'play_behavior': 'REPLACE_ALL'}], 'experimentation': None, 'output_speech': {'object_type': 'SSML', 'play_behavior': None, 'ssml': 'Playing playlist Sara on home mix. '},
'reprompt': None,
'should_end_session': True}
2024-04-10 21:08:56,930 - werkzeug - INFO - 192.168.0.163 - - [10/Apr/2024 21:08:56] "POST / HTTP/1.0" 200 -
2024-04-10 21:08:57,100 - root - DEBUG - Request received: {'error': {'message': 'An exception occurred while dispatching the request to '
'the skill.',
'object_type': 'INVALID_RESPONSE'},
'locale': 'en-CA',
'object_type': 'SessionEndedRequest',
'reason': 'ERROR',
'request_id': 'amzn1.echo-api.request.ec86dfc8-89a5-43e1-8f77-dfe4c5bc0cfe',
'timestamp': datetime.datetime(2024, 4, 10, 21, 8, 56, tzinfo=tzlocal())}
2024-04-10 21:08:57,100 - root - DEBUG - In SkillEventHandler
2024-04-10 21:08:57,100 - root - DEBUG - Response sent: {'api_response': None,
'can_fulfill_intent': None,
'card': None,
'directives': None,
'experimentation': None,
'output_speech': None,
'reprompt': None,
'should_end_session': None}
2024-04-10 21:08:57,101 - werkzeug - INFO - 192.168.0.163 - - [10/Apr/2024 21:08:57] "POST / HTTP/1.0" 200 -
michel@homeflix:~$ ^C
michel@homeflix:~$
Comments I've attempted to play around with a small (50) and large (200) NAVI_SONG_COUNT variable but this did not change the behavior. I would honestly be happy if only a limited number of random songs were queue'd from the playlist and not the full playlist if this is a limitation from amazon, but being limited to a small playlist is a major inconvenience.