music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.32k stars 49 forks source link

Music Assistant Server Generates Error in the Web UI with Qobuz Provider #2583

Closed indomitableMan closed 1 month ago

indomitableMan commented 2 months ago

What version of Music Assistant has the issue?

2.0.7

What version of the Home Assistant Integration have you got installed?

2024.6.5

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

The problem

When attempting to add the Qobuz provider to Music Assistant through the MA web interface and if the Qobuz username is formatted as an email address (e.g. bugsbunny@warnerbros.com), the following error message is displayed:

192.168.86.9:8095 says: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('http://www.qobuz.com/api.json/0.2/user/login?username=greyzepher@yahoo.com&password=password&device_manufacturer_id=music_assistant')

The result is that the user is blocked and is unable to add the Qobuz provider to Music Assistant.

How to reproduce

  1. create a brand new container running Music Assistant in Docker
  2. add the Sonos player provider
  3. attempt to add the Qobuz set up provider using a username formatted as an email address

Music Providers

Qobuz

Player Providers

Sonos

Full log output

music-assistant-log-showing-issues.txt

Additional information

Running on a QNAP NAS running QTS v5.1.7.2770 using Container Station v3.0.7.891 (a Docker clone)

What version of Home Assistant Core are your running

2024.6.4

What type of installation are you running?

Home Assistant Container

On what type of hardware are you running?

Linux

OzGav commented 2 months ago

Please change your password. You just included it in the post above. I have removed it

indomitableMan commented 2 months ago

Wait - you pass the password in clear text as part of the call....? Probably not a good idea. Changed my password.

OzGav commented 2 months ago

Are you saying that is the Qobuz username is NOT formatted as an email address then it works ok?

marcelveldt commented 2 months ago

Qobuz works fine on my (test)account, also with email login. Its failing completely in your case, in the login stage and looks like the result is unexpected/unhandled.

I'll see if we can make the logging a bit more useful (and hide the password from logging).

indomitableMan commented 2 months ago

I have no idea if Qobuz works with a username not formatted as an email or not. The web UI simply fails with the error as stated in the bug report. Due to the nature of this error this makes it impossible for me to add Qobuz as a music provider to Music Assistant and is a blocker to my adopting Music Assistant.

indomitableMan commented 2 months ago

The following error appears in the MA log when attempting to configure the Qobuz provider:

2024-07-08 22:56:10.219 ERROR (MainThread) [music_assistant] Error loading provider(instance) Qobuz
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/server.py", line 416, in load_provider
    await self._load_provider(prov_conf)
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/server.py", line 547, in _load_provider
    provider = await prov_mod.setup(self, prov_manifest, conf)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/qobuz/__init__.py", line 88, in setup
    await prov.handle_async_init()
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/qobuz/__init__.py", line 136, in handle_async_init
    token = await self._auth_token()
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/qobuz/__init__.py", line 696, in _auth_token
    details = await self._get_data("user/login", **params)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/helpers/throttle_retry.py", line 72, in wrapper
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/music_assistant/server/providers/qobuz/__init__.py", line 768, in _get_data
    return await response.json(loads=json_loads)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1176, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('http://www.qobuz.com/api.json/0.2/user/login?username=aname@email.com&password=ZZZZZZZZZZZ&device_manufacturer_id=music_assistant')
OzGav commented 2 months ago

Have you tried a different browser?

indomitableMan commented 2 months ago

Yes, I tried Edge and then I tried Chrome.

marcelveldt commented 2 months ago

I have added some more logging to better understand this error. This fix will be available in 2.1.0b15 so you either need to wait until 2.1 stable drops next week or (temporary) switch to the beta.

OzGav commented 2 months ago

@indomitableMan were you able to try the beta?

OzGav commented 2 months ago

We will close this soon due to no follow up