From f4d4b8580dd5c1ebee1e9328c07a0b6a97a54c91 Mon Sep 17 00:00:00 2001 From: Ross Stewart Date: Sat, 22 Oct 2022 14:52:09 +0100 Subject: [PATCH 1/4] - Added placeholder for sphinx build dir --- .gitignore | 3 ++- sphinx/_build/.gitkeep | 0 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 sphinx/_build/.gitkeep diff --git a/.gitignore b/.gitignore index 85ec1aa..ba23e45 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ __pycache__ env -sphinx/_build +sphinx/_build/* +!sphinx/_build/.gitkeep sphinx/resources/*.bkp sphinx/resources/*.dtmp asknavidrome.log diff --git a/sphinx/_build/.gitkeep b/sphinx/_build/.gitkeep new file mode 100644 index 0000000..e69de29 From c8ac9a48842fab4ba455d5a4d86cfcab75263a75 Mon Sep 17 00:00:00 2001 From: Ross Stewart Date: Sat, 22 Oct 2022 14:53:10 +0100 Subject: [PATCH 2/4] - Added NaviSonicRandomiseQueue - Resolves #9 --- alexa.json | 10 ++++++++++ skill/app.py | 18 ++++++++++++++++++ sphinx/index.rst | 4 +++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/alexa.json b/alexa.json index 80ab313..f7aebad 100644 --- a/alexa.json +++ b/alexa.json @@ -176,6 +176,16 @@ "Play random music", "Play random songs" ] + }, + { + "name": "NaviSonicRandomiseQueue", + "slots": [], + "samples": [ + "randomise the queue", + "randomise", + "shuffle", + "shuffle the queue" + ] } ], "types": [ diff --git a/skill/app.py b/skill/app.py index 6d3f375..5c70f66 100755 --- a/skill/app.py +++ b/skill/app.py @@ -631,6 +631,24 @@ class NaviSonicUnstarSong(AbstractRequestHandler): return handler_input.response_builder.response +class NaviSonicRandomiseQueue(AbstractRequestHandler): + """Handle NaviSonicRandomiseQueue Intent + + Shuffle the current play queue + """ + + def can_handle(self, handler_input: HandlerInput) -> bool: + return is_intent_name('NaviSonicRandomiseQueue')(handler_input) + + def handle(self, handler_input: HandlerInput) -> Response: + logger.debug('In NaviSonicRandomiseQueue Handler') + + play_queue.shuffle() + play_queue.sync() + + return handler_input.response_builder.response + + # # AudioPlayer Handlers # diff --git a/sphinx/index.rst b/sphinx/index.rst index 87f4d97..d066d40 100644 --- a/sphinx/index.rst +++ b/sphinx/index.rst @@ -98,6 +98,8 @@ Supported Intents +-------------------------------------------+--------------------------------------------+-------------------------------------+ | :class:`~app.NaviSonicPlayFavouriteSongs` | Play your starred / favourite songs | Play my favourite songs | +-------------------------------------------+--------------------------------------------+-------------------------------------+ +| :class:`~app.NaviSonicRandomiseQueue` | Shuffle / randomise the current play queue | Shuffle the queue | ++-------------------------------------------+--------------------------------------------+-------------------------------------+ | :class:`~app.NaviSonicSongDetails` | Give details on the playing track | What is playing | +-------------------------------------------+--------------------------------------------+-------------------------------------+ | :class:`~app.NaviSonicStarSong` | Star / favourite a song | Star this song | @@ -413,7 +415,7 @@ Code Documentation ****************** .. toctree:: - :maxdepth: 2 + :maxdepth: 1 :caption: Contents: AskNavidrome main From e6660bb06079e1f52c845c3c48242b4a484e4a40 Mon Sep 17 00:00:00 2001 From: Ross Stewart Date: Sat, 22 Oct 2022 15:06:02 +0100 Subject: [PATCH 3/4] - Loaded NaviSonicRandomiseQueue handler --- skill/app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/skill/app.py b/skill/app.py index 5c70f66..2e88fda 100755 --- a/skill/app.py +++ b/skill/app.py @@ -917,6 +917,7 @@ sb.add_request_handler(NaviSonicPlayPlaylist()) sb.add_request_handler(NaviSonicPlayFavouriteSongs()) sb.add_request_handler(NaviSonicPlayMusicByGenre()) sb.add_request_handler(NaviSonicPlayMusicRandom()) +sb.add_request_handler(NaviSonicRandomiseQueue()) sb.add_request_handler(NaviSonicSongDetails()) sb.add_request_handler(NaviSonicStarSong()) sb.add_request_handler(NaviSonicUnstarSong()) From 3f7cdabd285eec2e7a2977c1779a1269356fcc6d Mon Sep 17 00:00:00 2001 From: Ross Stewart Date: Sat, 22 Oct 2022 15:50:38 +0100 Subject: [PATCH 4/4] - Reordered classes --- skill/app.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/skill/app.py b/skill/app.py index 2e88fda..d58e317 100755 --- a/skill/app.py +++ b/skill/app.py @@ -39,6 +39,7 @@ logger.addHandler(handler) # Get service configuration # +logger.info('AskNavidrome 0.6!') logger.debug('Getting configutration from the environment...') try: @@ -572,6 +573,24 @@ class NaviSonicPlayFavouriteSongs(AbstractRequestHandler): return controller.start_playback('play', speech, card, track_details, handler_input) +class NaviSonicRandomiseQueue(AbstractRequestHandler): + """Handle NaviSonicRandomiseQueue Intent + + Shuffle the current play queue + """ + + def can_handle(self, handler_input: HandlerInput) -> bool: + return is_intent_name('NaviSonicRandomiseQueue')(handler_input) + + def handle(self, handler_input: HandlerInput) -> Response: + logger.debug('In NaviSonicRandomiseQueue Handler') + + play_queue.shuffle() + play_queue.sync() + + return handler_input.response_builder.response + + class NaviSonicSongDetails(AbstractRequestHandler): """Handle NaviSonicSongDetails Intent @@ -630,25 +649,6 @@ class NaviSonicUnstarSong(AbstractRequestHandler): return handler_input.response_builder.response - -class NaviSonicRandomiseQueue(AbstractRequestHandler): - """Handle NaviSonicRandomiseQueue Intent - - Shuffle the current play queue - """ - - def can_handle(self, handler_input: HandlerInput) -> bool: - return is_intent_name('NaviSonicRandomiseQueue')(handler_input) - - def handle(self, handler_input: HandlerInput) -> Response: - logger.debug('In NaviSonicRandomiseQueue Handler') - - play_queue.shuffle() - play_queue.sync() - - return handler_input.response_builder.response - - # # AudioPlayer Handlers #