Skip to content

Commit

Permalink
Merge pull request #13 from rosskouk/feature-shuffle-9
Browse files Browse the repository at this point in the history
Feature shuffle 9
  • Loading branch information
rosskouk authored Oct 22, 2022
2 parents 672ce84 + 3f7cdab commit a316b7b
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
__pycache__
env
sphinx/_build
sphinx/_build/*
!sphinx/_build/.gitkeep
sphinx/resources/*.bkp
sphinx/resources/*.dtmp
asknavidrome.log
Expand Down
10 changes: 10 additions & 0 deletions alexa.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@
"Play random music",
"Play random songs"
]
},
{
"name": "NaviSonicRandomiseQueue",
"slots": [],
"samples": [
"randomise the queue",
"randomise",
"shuffle",
"shuffle the queue"
]
}
],
"types": [
Expand Down
21 changes: 20 additions & 1 deletion skill/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
# Get service configuration
#

logger.info('AskNavidrome 0.6!')
logger.debug('Getting configutration from the environment...')

try:
Expand Down Expand Up @@ -572,6 +573,24 @@ def handle(self, handler_input: HandlerInput) -> Response:
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
Expand Down Expand Up @@ -630,7 +649,6 @@ def handle(self, handler_input: HandlerInput) -> Response:

return handler_input.response_builder.response


#
# AudioPlayer Handlers
#
Expand Down Expand Up @@ -899,6 +917,7 @@ def process(self, handler_input: HandlerInput, response: Response):
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())
Expand Down
Empty file added sphinx/_build/.gitkeep
Empty file.
4 changes: 3 additions & 1 deletion sphinx/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -413,7 +415,7 @@ Code Documentation
******************

.. toctree::
:maxdepth: 2
:maxdepth: 1
:caption: Contents:

AskNavidrome main
Expand Down

0 comments on commit a316b7b

Please sign in to comment.