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.39k stars 51 forks source link

Jellyfin provider / Authentication failed since url with path is not supported anymore #2727

Closed eekamouze closed 2 months ago

eekamouze commented 3 months ago

What version of Music Assistant has the issue?

2.1.0

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

n/a

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

The problem

from 2.1.0 version, mass server refuses jellyfin provider url since it contains a path (http://192.168.1.201:8096/jellyfin) :

2024-08-05T19:40:47.186446487Z 2024-08-05 21:40:47.185 ERROR (MainThread) [music_assistant] Error loading provider(instance) Jellyfin Media Server Library: Authentication failed: Only absolute URLs without path part are supported 2024-08-05T19:40:47.187322260Z 2024-08-05 21:40:47.185 ERROR (MainThread) [music_assistant.webserver] Error handling message: config/providers/save: Authentication failed: Only absolute URLs without path part are supported

I tried to remove the path (/jellyfin) but then I get this error: 2024-08-05 21:44:12.179 ERROR (MainThread) [music_assistant] Error loading provider(instance) Jellyfin Media Server Library: Authentication failed: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('http://192.168.1.201:8096/jellyfin/web/') 2024-08-05T19:44:12.184161555Z 2024-08-05 21:44:12.180 ERROR (MainThread) [music_assistant.webserver] Error handling message: config/providers/save: Authentication failed: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('http://192.168.1.201:8096/jellyfin/web/')

How to reproduce

works without issue when rolling back to 2.0.7

Music Providers

jellyfin

Player Providers

n/a, server base configuration

Full log output

No response

Additional information

No response

What version of Home Assistant Core are your running

n/a

What type of installation are you running?

Home Assistant Container

On what type of hardware are you running?

Raspberry Pi

OzGav commented 3 months ago

Why can’t you fix it by doing what the errror message says?

eekamouze commented 3 months ago

that's my question actually !

OzGav commented 3 months ago

@Jc2k ?

Jc2k commented 3 months ago

Hey @eekamouze - I saw your message 2 hours ago but there has been a fibre cut over here so i've not been able to have a proper look at desktop yet. This is not a limitation that we've imposed. The gist of it is the old library just used to mush the strings together and pray. The new library (or rather its dependency aiohttp) actually parses the URL for correctness. Unfortunately in this case it's a bit overzealous, and doesn't really get that people might use subfolders.

Skimming the code, it looks like if we parse your URL ourselves we can bypass these extra checks. I'll try and get something in place soon.

Jc2k commented 2 months ago

Hopefully this will be fixed by https://github.com/music-assistant/server/pull/1601. The extra YARL validation should no longer be in play after this lands and is released. However I don't have an instance like yours to test again so we may hit other issues.