From 2ee1abd813cf830d7befe217acd9372d176cde46 Mon Sep 17 00:00:00 2001 From: nunks Date: Sat, 8 Nov 2025 12:50:08 -0300 Subject: [PATCH] customizadas em portugues: interaction model e respostas da skill --- alexa.json | 91 +++++++++++++++++++++++----------------------------- skill/app.py | 53 ++++++++++++++++++------------ 2 files changed, 73 insertions(+), 71 deletions(-) diff --git a/alexa.json b/alexa.json index f7aebad..ddffae6 100644 --- a/alexa.json +++ b/alexa.json @@ -1,7 +1,7 @@ { "interactionModel": { "languageModel": { - "invocationName": "navisonic", + "invocationName": "cafofo music", "intents": [ { "name": "AMAZON.CancelIntent", @@ -40,8 +40,8 @@ } ], "samples": [ - "play songs by {artist}", - "play music by {artist}" + "tocar músicas da {artist}", + "tocar músicas do {artist}" ] }, { @@ -65,8 +65,12 @@ } ], "samples": [ - "Play the album {album}", - "Play the album {album} by {artist}" + "Tocar o album {album}", + "Tocar o album {album} do {artist}", + "Tocar o album {album} da {artist}", + "Tocar o disco {album}", + "Tocar o disco {album} do {artist}", + "Tocar o disco {album} da {artist}" ] }, { @@ -78,49 +82,42 @@ } ], "samples": [ - "Play the {playlist} playlist", - "Start the {playlist} playlist" + "Tocar a playlist {playlist}" ] }, { "name": "NaviSonicSongDetails", "slots": [], "samples": [ - "What is playing", - "Who is singing", - "Who's singing", - "What album is this song on", - "What album is this on", - "Which album", - "Which album is this song from", - "Which artist is this", - "What band is this", - "Who sings this song", - "Who sings this", - "What song is this", - "What's playing" + "O que está tocando", + "Quem está tocando", + "Quem está cantando", + "Qual o album dessa música", + "Que banda é essa", + "Que musica é essa", + "Que banda é essa" ] }, { "name": "NaviSonicStarSong", "slots": [], "samples": [ - "Add this song to my favourites", - "Favourite this song", - "Like this song", - "Add this song to my liked songs", - "Star this song" + "Adicionar música aos favoritos", + "Adicionar aos favoritos", + "Favoritar essa musica", + "Lembrar dessa música", + "Eu gosto dessa música" ] }, { "name": "NaviSonicUnstarSong", "slots": [], "samples": [ - "Remove this song from favourites", - "I don't like this song", - "Remove the star from this song", - "Delete this song from my favourites", - "Unstar this song" + "Tirar a música dos favoritos", + "Tirar dos favoritos", + "Desfavoritar a música", + "Esquecer essa música", + "Eu não gosto dessa música" ] }, { @@ -136,21 +133,18 @@ } ], "samples": [ - "Play the song {song} by the band {artist}", - "Play {song} by the band {artist}", - "Play {song} by {artist}", - "Play the song {song} by the artist {artist}" + "Tocar a música {song} da banda {artist}", + "Tocar {song} da banda {artist}", + "Tocar {song} da {artist}" ] }, { "name": "NaviSonicPlayFavouriteSongs", "slots": [], "samples": [ - "Play my starred tracks", - "Play starred tracks", - "Play starred songs", - "Play my starred songs", - "Play my favourite songs" + "Tocar favoritos", + "Tocar meus favoritos", + "Tocar minhas músicas favoritas" ] }, { @@ -162,29 +156,26 @@ } ], "samples": [ - "Play {genre} songs", - "Play {genre} music" + "Tocar {genre}" ] }, { "name": "NaviSonicPlayMusicRandom", "slots": [], "samples": [ - "Play a selection of music", - "Play a mix of tracks", - "Play a mix of songs", - "Play random music", - "Play random songs" + "Tocar seleção aleatória", + "Tocar qualquer coisa", + "Tocar mix", + "Tocar músicas aleatórias" ] }, { "name": "NaviSonicRandomiseQueue", "slots": [], "samples": [ - "randomise the queue", - "randomise", "shuffle", - "shuffle the queue" + "shuffle na lista", + "mistura tudo" ] } ], @@ -212,4 +203,4 @@ ] } } -} \ No newline at end of file +} diff --git a/skill/app.py b/skill/app.py index 5eda679..fafa667 100755 --- a/skill/app.py +++ b/skill/app.py @@ -222,7 +222,7 @@ class LaunchRequestHandler(AbstractRequestHandler): logger.debug('In LaunchRequestHandler') connection.ping() - speech = sanitise_speech_output('Ready!') + speech = sanitise_speech_output('Simbora!') handler_input.response_builder.speak(speech).ask(speech) return handler_input.response_builder.response @@ -311,7 +311,8 @@ class NaviSonicPlayMusicByArtist(AbstractRequestHandler): artist_lookup = connection.search_artist(artist.value) if artist_lookup is None: - text = sanitise_speech_output(f"I couldn't find the artist {artist.value} in the collection.") + #text = sanitise_speech_output(f"I couldn't find the artist {artist.value} in the collection.") + text = sanitise_speech_output(f"Não achei o artista {artist.value} na nossa coleção.") handler_input.response_builder.speak(text).ask(text) return handler_input.response_builder.response @@ -328,7 +329,8 @@ class NaviSonicPlayMusicByArtist(AbstractRequestHandler): 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 - speech = sanitise_speech_output(f'Playing music by: {artist.value}') + #speech = sanitise_speech_output(f'Playing music by: {artist.value}') + speech = sanitise_speech_output(f'Tocando músicas de: {artist.value}') logger.info(speech) card = {'title': 'AskNavidrome', @@ -371,7 +373,8 @@ class NaviSonicPlayAlbumByArtist(AbstractRequestHandler): artist_lookup = connection.search_artist(artist.value) if artist_lookup is None: - text = sanitise_speech_output(f"I couldn't find the artist {artist.value} in the collection.") + #text = sanitise_speech_output(f"I couldn't find the artist {artist.value} in the collection.") + text = sanitise_speech_output(f"Não achei o artista {artist.value} na nossa coleção.") handler_input.response_builder.speak(text).ask(text) return handler_input.response_builder.response @@ -384,7 +387,8 @@ class NaviSonicPlayAlbumByArtist(AbstractRequestHandler): result = [album_result for album_result in artist_album_lookup if album_result.get('name').lower() == album.value.lower()] if not result: - text = sanitise_speech_output(f"I couldn't find an album called {album.value} by {artist.value} in the collection.") + #text = sanitise_speech_output(f"I couldn't find an album called {album.value} by {artist.value} in the collection.") + text = sanitise_speech_output(f"Não achei na nossa coleção um disco chamado {album.value} de {artist.value}.") handler_input.response_builder.speak(text).ask(text) return handler_input.response_builder.response @@ -398,7 +402,8 @@ class NaviSonicPlayAlbumByArtist(AbstractRequestHandler): 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 - speech = sanitise_speech_output(f'Playing {album.value} by: {artist.value}') + #speech = sanitise_speech_output(f'Playing {album.value} by: {artist.value}') + speech = sanitise_speech_output(f'Tocando o álbum {album.value} de: {artist.value}') logger.info(speech) card = {'title': 'AskNavidrome', 'text': speech @@ -414,7 +419,8 @@ class NaviSonicPlayAlbumByArtist(AbstractRequestHandler): result = connection.search_album(album.value) if result is None: - text = sanitise_speech_output(f"I couldn't find the album {album.value} in the collection.") + #text = sanitise_speech_output(f"I couldn't find the album {album.value} in the collection.") + text = sanitise_speech_output(f"Não achei o disco {album.value} na nossa coleção.") handler_input.response_builder.speak(text).ask(text) return handler_input.response_builder.response @@ -428,7 +434,7 @@ class NaviSonicPlayAlbumByArtist(AbstractRequestHandler): 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 - speech = sanitise_speech_output(f'Playing {album.value}') + speech = sanitise_speech_output(f'Tocando o disco {album.value}') logger.info(speech) card = {'title': 'AskNavidrome', 'text': speech @@ -461,7 +467,8 @@ class NaviSonicPlaySongByArtist(AbstractRequestHandler): artist_lookup = connection.search_artist(artist.value) if artist_lookup is None: - text = sanitise_speech_output(f"I couldn't find the artist {artist.value} in the collection.") + #text = sanitise_speech_output(f"I couldn't find the artist {artist.value} in the collection.") + text = sanitise_speech_output(f"Não achei o artista {artist.value} na nossa coleção.") handler_input.response_builder.speak(text).ask(text) return handler_input.response_builder.response @@ -476,7 +483,8 @@ class NaviSonicPlaySongByArtist(AbstractRequestHandler): song_dets = [item.get('id') for item in song_list if item.get('artistId') == artist_id] if not song_dets: - text = sanitise_speech_output(f"I couldn't find a song called {song.value} by {artist.value} in the collection.") + #text = sanitise_speech_output(f"I couldn't find a song called {song.value} by {artist.value} in the collection.") + text = sanitise_speech_output(f"Não achei uma música chamada {song.value} de {artist.value} na nossa coleção.") handler_input.response_builder.speak(text).ask(text) return handler_input.response_builder.response @@ -484,7 +492,7 @@ class NaviSonicPlaySongByArtist(AbstractRequestHandler): play_queue.clear() controller.enqueue_songs(connection, play_queue, song_dets) - speech = sanitise_speech_output(f'Playing {song.value} by {artist.value}') + speech = sanitise_speech_output(f'Tocando {song.value} de {artist.value}') logger.info(speech) card = {'title': 'AskNavidrome', 'text': speech @@ -520,7 +528,7 @@ class NaviSonicPlayPlaylist(AbstractRequestHandler): playlist_id = connection.search_playlist(playlist.value) if playlist_id is None: - text = sanitise_speech_output("I couldn't find the playlist " + str(playlist.value) + ' in the collection.') + text = sanitise_speech_output("Não achei a playlist " + str(playlist.value) + ' na nossa coleção.') handler_input.response_builder.speak(text).ask(text) return handler_input.response_builder.response @@ -534,7 +542,7 @@ class NaviSonicPlayPlaylist(AbstractRequestHandler): 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 - speech = sanitise_speech_output('Playing playlist ' + str(playlist.value)) + speech = sanitise_speech_output('Tocando a playlist ' + str(playlist.value)) logger.info(speech) card = {'title': 'AskNavidrome', 'text': speech @@ -569,7 +577,7 @@ class NaviSonicPlayMusicByGenre(AbstractRequestHandler): song_id_list = connection.build_song_list_from_genre(genre.value, min_song_count) if song_id_list is None: - text = sanitise_speech_output(f"I couldn't find any {genre.value} songs in the collection.") + text = sanitise_speech_output(f"Não achei nada do estilo {genre.value} na nossa coleção.") handler_input.response_builder.speak(text).ask(text) return handler_input.response_builder.response @@ -583,7 +591,7 @@ class NaviSonicPlayMusicByGenre(AbstractRequestHandler): 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 - speech = sanitise_speech_output(f'Playing {genre.value} music') + speech = sanitise_speech_output(f'Tocando músicas do estilo {genre.value}') logger.info(speech) card = {'title': 'AskNavidrome', 'text': speech @@ -615,7 +623,8 @@ class NaviSonicPlayMusicRandom(AbstractRequestHandler): song_id_list = connection.build_random_song_list(min_song_count) if song_id_list is None: - text = sanitise_speech_output("I couldn't find any songs in the collection.") + #text = sanitise_speech_output("I couldn't find any songs in the collection.") + text = sanitise_speech_output("Não achei nenhuma música na nossa coleção. Estranho.") handler_input.response_builder.speak(text).ask(text) return handler_input.response_builder.response @@ -629,7 +638,7 @@ class NaviSonicPlayMusicRandom(AbstractRequestHandler): 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 - speech = sanitise_speech_output('Playing random music') + speech = sanitise_speech_output('Tocando qualquer coisa aleatória') logger.info(speech) card = {'title': 'AskNavidrome', 'text': speech @@ -661,7 +670,7 @@ class NaviSonicPlayFavouriteSongs(AbstractRequestHandler): song_id_list = connection.build_song_list_from_favourites() if song_id_list is None: - text = sanitise_speech_output("You don't have any favourite songs in the collection.") + text = sanitise_speech_output("Você não tem nada nos favoritos.") handler_input.response_builder.speak(text).ask(text) return handler_input.response_builder.response @@ -675,7 +684,7 @@ class NaviSonicPlayFavouriteSongs(AbstractRequestHandler): 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 - speech = sanitise_speech_output('Playing your favourite tracks.') + speech = sanitise_speech_output('Tocando suas músicas favoritas.') logger.info(speech) card = {'title': 'AskNavidrome', 'text': speech @@ -987,7 +996,8 @@ class SystemExceptionHandler(AbstractExceptionHandler): if get_request_type(handler_input) == 'IntentRequest': logger.error(f'Intent Name Was: {get_intent_name(handler_input)}') - speech = sanitise_speech_output("Sorry, I didn't get that. Can you please say it again!!") + #speech = sanitise_speech_output("Sorry, I didn't get that. Can you please say it again!!") + speech = sanitise_speech_output("Foi mal, não entendi. Pode repetir!!") handler_input.response_builder.speak(speech).ask(speech) return handler_input.response_builder.response @@ -1013,7 +1023,8 @@ class GeneralExceptionHandler(AbstractExceptionHandler): if get_request_type(handler_input) == 'IntentRequest': logger.error(f'Intent Name Was: {get_intent_name(handler_input)}') - speech = sanitise_speech_output("Sorry, I didn't get that. Can you please say it again!!") + #speech = sanitise_speech_output("Sorry, I didn't get that. Can you please say it again!!") + speech = sanitise_speech_output("Foi mal, não entendi. Pode repetir!!") handler_input.response_builder.speak(speech).ask(speech) return handler_input.response_builder.response