Skip to content

Commit a316b7b

Browse files
authored
Merge pull request #13 from rosskouk/feature-shuffle-9
Feature shuffle 9
2 parents 672ce84 + 3f7cdab commit a316b7b

File tree

5 files changed

+35
-3
lines changed

5 files changed

+35
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
__pycache__
22
env
3-
sphinx/_build
3+
sphinx/_build/*
4+
!sphinx/_build/.gitkeep
45
sphinx/resources/*.bkp
56
sphinx/resources/*.dtmp
67
asknavidrome.log

alexa.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@
176176
"Play random music",
177177
"Play random songs"
178178
]
179+
},
180+
{
181+
"name": "NaviSonicRandomiseQueue",
182+
"slots": [],
183+
"samples": [
184+
"randomise the queue",
185+
"randomise",
186+
"shuffle",
187+
"shuffle the queue"
188+
]
179189
}
180190
],
181191
"types": [

skill/app.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# Get service configuration
4040
#
4141

42+
logger.info('AskNavidrome 0.6!')
4243
logger.debug('Getting configutration from the environment...')
4344

4445
try:
@@ -572,6 +573,24 @@ def handle(self, handler_input: HandlerInput) -> Response:
572573
return controller.start_playback('play', speech, card, track_details, handler_input)
573574

574575

576+
class NaviSonicRandomiseQueue(AbstractRequestHandler):
577+
"""Handle NaviSonicRandomiseQueue Intent
578+
579+
Shuffle the current play queue
580+
"""
581+
582+
def can_handle(self, handler_input: HandlerInput) -> bool:
583+
return is_intent_name('NaviSonicRandomiseQueue')(handler_input)
584+
585+
def handle(self, handler_input: HandlerInput) -> Response:
586+
logger.debug('In NaviSonicRandomiseQueue Handler')
587+
588+
play_queue.shuffle()
589+
play_queue.sync()
590+
591+
return handler_input.response_builder.response
592+
593+
575594
class NaviSonicSongDetails(AbstractRequestHandler):
576595
"""Handle NaviSonicSongDetails Intent
577596
@@ -630,7 +649,6 @@ def handle(self, handler_input: HandlerInput) -> Response:
630649

631650
return handler_input.response_builder.response
632651

633-
634652
#
635653
# AudioPlayer Handlers
636654
#
@@ -899,6 +917,7 @@ def process(self, handler_input: HandlerInput, response: Response):
899917
sb.add_request_handler(NaviSonicPlayFavouriteSongs())
900918
sb.add_request_handler(NaviSonicPlayMusicByGenre())
901919
sb.add_request_handler(NaviSonicPlayMusicRandom())
920+
sb.add_request_handler(NaviSonicRandomiseQueue())
902921
sb.add_request_handler(NaviSonicSongDetails())
903922
sb.add_request_handler(NaviSonicStarSong())
904923
sb.add_request_handler(NaviSonicUnstarSong())

sphinx/_build/.gitkeep

Whitespace-only changes.

sphinx/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ Supported Intents
9898
+-------------------------------------------+--------------------------------------------+-------------------------------------+
9999
| :class:`~app.NaviSonicPlayFavouriteSongs` | Play your starred / favourite songs | Play my favourite songs |
100100
+-------------------------------------------+--------------------------------------------+-------------------------------------+
101+
| :class:`~app.NaviSonicRandomiseQueue` | Shuffle / randomise the current play queue | Shuffle the queue |
102+
+-------------------------------------------+--------------------------------------------+-------------------------------------+
101103
| :class:`~app.NaviSonicSongDetails` | Give details on the playing track | What is playing |
102104
+-------------------------------------------+--------------------------------------------+-------------------------------------+
103105
| :class:`~app.NaviSonicStarSong` | Star / favourite a song | Star this song |
@@ -413,7 +415,7 @@ Code Documentation
413415
******************
414416

415417
.. toctree::
416-
:maxdepth: 2
418+
:maxdepth: 1
417419
:caption: Contents:
418420

419421
AskNavidrome main

0 commit comments

Comments
 (0)