rosskouk / asknavidrome

An Alexa skill to allow streaming of music from Subsonic API compatible media servers on Amazon Echo devices.
https://rosskouk.github.io/asknavidrome
MIT License
48 stars 7 forks source link

[ISSUE] Requesting a song title that contains an ampersand in the speech output causes SSML Error #41

Open iCanHazSkillz opened 2 months ago

iCanHazSkillz commented 2 months ago

Describe the issue Requesting a song title that contains an ampersand in the speech output causes SSML Error.

Operating System Ubuntu x64

To Reproduce Ask for the song title of a song that contains an ampersand (&) in either the song title, artist and/or album. This will an SSML error (Error: Unexpected character ' ' (code 32)) in the logs

Logs 2024-04-26 20:44:46,859 - root - DEBUG - Response sent: {'api_response': None, 'can_fulfill_intent': None, 'card': None, 'directives': None, 'experimentation': None, 'output_speech': {'object_type': 'SSML', 'play_behavior': None, 'ssml': 'This is Get Down On It by Kool & The Gang, ' 'from the album The 50 Greatest Songs'}, 'reprompt': None, 'should_end_session': None} 2024-04-26 20:44:46,860 - werkzeug - INFO - 192.168.0.163 - - [26/Apr/2024 20:44:46] "POST / HTTP/1.0" 200 - 2024-04-26 20:44:47,715 - root - DEBUG - Request received: {'error': {'message': 'Invalid SSML Output Speech for requestId ' 'amzn1.echo-api.request.21b06285-e5ee-4152-9943-1d95de4b429d. ' 'Error: Fatal error occurred when processing SSML ' 'content. This usually happens when the SSML is not well ' "formed. Error: Unexpected character ' ' (code 32) " '(missing name?)\n' ' at [row,col {unknown-source}]: [1,40]', 'object_type': 'INVALID_RESPONSE'}, 'locale': 'en-CA', 'object_type': 'SessionEndedRequest', 'reason': 'ERROR', 'request_id': 'redacted', 'timestamp': datetime.datetime(2024, 4, 26, 20, 44, 47, tzinfo=tzlocal())}

Comments I understand this is an SSML limitation, but I wonder if there would be any way to parse the speech output and replace any ampersand (&) with the word 'and'?