Merge pull request #15 from rosskouk/enhancement-debugging
Enhancement debugging
This commit is contained in:
39
skill/app.py
39
skill/app.py
@@ -142,6 +142,36 @@ except NameError as err:
|
|||||||
|
|
||||||
logger.debug('Configuration has been successfully loaded')
|
logger.debug('Configuration has been successfully loaded')
|
||||||
|
|
||||||
|
# Set log level based on config value
|
||||||
|
if 'NAVI_DEBUG' in os.environ:
|
||||||
|
navidrome_log_level = int(os.getenv('NAVI_DEBUG'))
|
||||||
|
|
||||||
|
if navidrome_log_level == 0:
|
||||||
|
# Warnings and higher
|
||||||
|
logger.setLevel(logging.WARNING)
|
||||||
|
logger.warning('Log level set to WARNING')
|
||||||
|
|
||||||
|
elif navidrome_log_level == 1:
|
||||||
|
# Info messages and higher
|
||||||
|
logger.setLevel(logging.INFO)
|
||||||
|
logger.info('Log level set to INFO')
|
||||||
|
|
||||||
|
elif navidrome_log_level == 2:
|
||||||
|
# Debug with request and response interceptors
|
||||||
|
logger.setLevel(logging.DEBUG)
|
||||||
|
logger.debug('Log level set to DEBUG')
|
||||||
|
|
||||||
|
elif navidrome_log_level == 3:
|
||||||
|
# Debug with request / response interceptors and Web GUI
|
||||||
|
logger.setLevel(logging.DEBUG)
|
||||||
|
logger.debug('Log level set to DEBUG')
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Invalid value provided - set to WARNING
|
||||||
|
navidrome_log_level = 0
|
||||||
|
logger.setLevel(logging.WARNING)
|
||||||
|
logger.warning('Log level set to WARNING')
|
||||||
|
|
||||||
# Create a queue
|
# Create a queue
|
||||||
play_queue = queue.MediaQueue()
|
play_queue = queue.MediaQueue()
|
||||||
logger.debug('MediaQueue object created...')
|
logger.debug('MediaQueue object created...')
|
||||||
@@ -938,15 +968,16 @@ sb.add_request_handler(PlaybackFailedEventHandler())
|
|||||||
sb.add_exception_handler(SystemExceptionHandler())
|
sb.add_exception_handler(SystemExceptionHandler())
|
||||||
sb.add_exception_handler(GeneralExceptionHandler())
|
sb.add_exception_handler(GeneralExceptionHandler())
|
||||||
|
|
||||||
# Register Interceptors (log all requests)
|
if navidrome_log_level >= 2:
|
||||||
# sb.add_global_request_interceptor(LoggingRequestInterceptor())
|
# Register Interceptors (log all requests)
|
||||||
# sb.add_global_response_interceptor(LoggingResponseInterceptor())
|
sb.add_global_request_interceptor(LoggingRequestInterceptor())
|
||||||
|
sb.add_global_response_interceptor(LoggingResponseInterceptor())
|
||||||
|
|
||||||
sa = SkillAdapter(skill=sb.create(), skill_id='test', app=app)
|
sa = SkillAdapter(skill=sb.create(), skill_id='test', app=app)
|
||||||
sa.register(app=app, route='/')
|
sa.register(app=app, route='/')
|
||||||
|
|
||||||
# Enable queue and history diagnostics
|
# Enable queue and history diagnostics
|
||||||
if 'NAVI_DEBUG' in os.environ:
|
if navidrome_log_level == 3:
|
||||||
logger.warning('AskNavidrome debugging has been enabled, this should only be used when testing!')
|
logger.warning('AskNavidrome debugging has been enabled, this should only be used when testing!')
|
||||||
logger.warning('The /buffer, /queue and /history http endpoints are available publicly!')
|
logger.warning('The /buffer, /queue and /history http endpoints are available publicly!')
|
||||||
|
|
||||||
|
|||||||
@@ -304,8 +304,10 @@ accessible.
|
|||||||
Run inside a Docker container
|
Run inside a Docker container
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
A Dockerfile has been provided and a prebuilt container is hosted on github.com. You can configure the service by passing environment variables to
|
A Dockerfile has been provided and a prebuilt container is hosted on github.com. **Please note that the prebuilt container was created on an amd64 platform**. If you
|
||||||
the *docker run* command.
|
require a different architecture such as arm for a Raspberry Pi, you will need to build a new image using the Dockerfile provided with the repository.
|
||||||
|
|
||||||
|
You can configure the service by passing environment variables to the *docker run* command.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@@ -355,7 +357,7 @@ information to run:
|
|||||||
+----------------------+----------------------------------------------------------------+------------------------------------------------------+
|
+----------------------+----------------------------------------------------------------+------------------------------------------------------+
|
||||||
| NAVI_API_VER | The version of the Subsonic API in use | 1.16.1 |
|
| NAVI_API_VER | The version of the Subsonic API in use | 1.16.1 |
|
||||||
+----------------------+----------------------------------------------------------------+------------------------------------------------------+
|
+----------------------+----------------------------------------------------------------+------------------------------------------------------+
|
||||||
| NAVI_DEBUG | Enable debugging, to disable to not set this variable | 1 |
|
| NAVI_DEBUG | Enable debugging, by setting this variable to 1, or 3. | 1 |
|
||||||
+----------------------+----------------------------------------------------------------+------------------------------------------------------+
|
+----------------------+----------------------------------------------------------------+------------------------------------------------------+
|
||||||
|
|
||||||
|
|
||||||
@@ -376,7 +378,7 @@ Troubleshooting and debugging Alexa skills can be a little frustrating, here are
|
|||||||
|
|
||||||
#. Enable debugging and look at the logs generated by the web service.
|
#. Enable debugging and look at the logs generated by the web service.
|
||||||
|
|
||||||
#. When debugging is enabled the following web pages are available from the web service
|
#. When level 3 debugging is enabled the following web pages are available from the web service
|
||||||
|
|
||||||
* url-to-web-service/queue
|
* url-to-web-service/queue
|
||||||
|
|
||||||
@@ -410,6 +412,42 @@ Troubleshooting and debugging Alexa skills can be a little frustrating, here are
|
|||||||
* After you have entered a command you will get the Alexa response back, scroll down to the **Device Log** section and click through the entries
|
* After you have entered a command you will get the Alexa response back, scroll down to the **Device Log** section and click through the entries
|
||||||
the entries will contain any errors that were thrown.
|
the entries will contain any errors that were thrown.
|
||||||
|
|
||||||
|
Debug Options
|
||||||
|
-------------
|
||||||
|
|
||||||
|
You can enable the following debug options by setting the NAVI_DEBUG environment variable.
|
||||||
|
|
||||||
|
* 0 = Logging set to WARNING and higher.
|
||||||
|
* 1 = Logging set to INFO and higher.
|
||||||
|
* 2 = Logging set to DEBUG and higher and request / response
|
||||||
|
interceptors are enabled.
|
||||||
|
* 3 = All features of level 2 and the web ui. Note the UI
|
||||||
|
will be **publicly** available while this is enabled.
|
||||||
|
|
||||||
|
Known Issues
|
||||||
|
------------
|
||||||
|
|
||||||
|
#. The skill appears to work but no music is played. Errors similar to below appear in the web service log
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
2022-11-19 13:16:45,478 - root - DEBUG - In PlaybackFailedHandler
|
||||||
|
2022-11-19 13:16:45,479 - root - ERROR - Playback Failed: {'message': 'Device playback error', 'object_type': 'MEDIA_ERROR_UNKNOWN'}
|
||||||
|
2022-11-19 13:16:45,480 - werkzeug - INFO - 10.44.17.62 - - [19/Nov/2022 13:16:45] "POST / HTTP/1.1" 200 -
|
||||||
|
2022-11-19 13:16:48,599 - root - DEBUG - In PlaybackFailedHandler
|
||||||
|
2022-11-19 13:16:48,600 - root - ERROR - Playback Failed: {'message': 'Device playback error','object_type': 'MEDIA_ERROR_INTERNAL_DEVICE_ERROR'}
|
||||||
|
|
||||||
|
* I have not found a reason as to why this happens from time to time, however it can be resolved by doing a hard reboot of your Echo device.
|
||||||
|
Disconnect the power for a minute and plug it back in then try again and music should play
|
||||||
|
|
||||||
|
#. The following error is displayed when you try to run the Docker container
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
exec /opt/env/bin/python3: exec format error
|
||||||
|
|
||||||
|
* You are using the prebuilt container on a non amd64 based system. You will need to build your own Docker image using the Dockerfile included
|
||||||
|
with the repository.
|
||||||
|
|
||||||
Code Documentation
|
Code Documentation
|
||||||
******************
|
******************
|
||||||
|
|||||||
Reference in New Issue
Block a user