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

Music assistant plays the wrong songs (on Spotify) #2740

Closed simonhoffmann closed 3 months ago

simonhoffmann commented 3 months ago

What version of Music Assistant has the issue?

2.1.1

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

2024.6.2

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

The problem

I have a home assistant script that tells music assistant to play a certain Spotify playlist. This in itself is working perfectly. However, sometimes music assistant plays the wrong song, while the chromecast player card in HASS shows the correct song. This morning the card showed "ozean" by "Tommy blackout, Andre moghimi, fewjar" which is correct because this song is actually in my playlist. However, the sound coming out of my speakers was from the song "Ozean" by "Annenmaykantereit". This song is not in my playlist. I recognised the band by their singers voice and then searched Spotify if they have a song called Ozean. I have never heard that song before.

A few days ago this happened with another song. However "ocean" by "John butler" works fine. Maybe because in this song ocean is the English spelling while the other two songs have German spelling. That being said the issue a few days ago was with an English song, but they also had almost identical names. (I think it was "the outsider" by "a perfect system" which should have been played and was shown but was not actually played.)

How to reproduce

Unclear. It does not seem to happen every time.

Music Providers

Spotify is used as this is my main music source. I also have the tune in provider because every once in a while I listen to a radio station.

Player Providers

Chromecast to actually play the music. additionally I have the home assistant music players enabled because I wanted to test if I can stream music to the speaker of a unifi camera.

Full log output

Nothing during the time span I listened to music. The last log message was over an hour before me playing music. Log level is currently on info. I can switch to debug if required.

Additional information

No response

What version of Home Assistant Core are your running

2024.7.4

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Generic x86-64 (e.g. Intel NUC)

OzGav commented 3 months ago

Might be already fixed by https://github.com/music-assistant/server/pull/1549 but will confirm

simonhoffmann commented 3 months ago

Might be already fixed by music-assistant/server#1549 but will confirm

Sorry, I tried searches with patterns like "same name" but did not find this issue.

Also, it happened again :-)

What the card said and what is in my playlist: by nayya. What was played: by Pink. Screenshot_20240810_135258_Home Assistant Screenshot_20240810_135411_Shazam

I can also reproduce it with the Ozean title if I search for it within music assistant (that is searching for the version I want to hear). It shows the song I clicked on as playing, but plays the other one.

simonhoffmann commented 3 months ago

Might be already fixed by music-assistant/server#1549 but will confirm

I can install the latest dev version on my system and test this if you like?

OzGav commented 3 months ago

The fix isn’t rolled out yet. I was just pointing out it should be soon.

OzGav commented 3 months ago

@simonhoffmann please try the last stable or beta and advise if this is fixed.

simonhoffmann commented 3 months ago

@simonhoffmann please try the last stable or beta and advise if this is fixed.

I would like to, but I am currently not able to log in.

My morning routine consists of music assistant playing music on Spotify when my phone alarm rings. This didn't happen this morning, so I tried to start the music manually in HASS and this did not work either. I then opened my Spotify app on my phone and was immediately logged out and could not log back in with my credentials. I then used the magic link login, which worked, and changed my password. I could then log in on my other phone and tablet with this new password. However, music assistant cannot log me in with the new password.

This is in the log:

[music_assistant.providers.spotify] Error while retrieving Spotify token after 0.36 seconds, details: 2024-08-13 08:31:03.090 WARNING (MainThread) [music_assistant.providers.spotify] Error while retrieving Spotify token after 0.32 seconds, details: 2024-08-13 08:31:03.090 ERROR (MainThread) [music_assistant] Error loading provider(instance) Spotify: Login failed for user xxx 2024-08-13 08:31:03.090 ERROR (MainThread) [music_assistant.webserver] Error handling message: config/providers/save: Login failed for user xxx

I tried logging in with and without a client id. I used my password manager to generate a long and random password. Does the integration have some problems with too many characters or certain special ones?

OzGav commented 3 months ago

Update to beta 6 as Spotify has changed the login method

OzGav commented 3 months ago

I see you are on the stable so 2.1.4 has the fix for Spotify. If any tracks remain linked incorrectly just remove them from the library and then do a sync

simonhoffmann commented 3 months ago

I see you are on the stable so 2.1.4 has the fix for Spotify. If any tracks remain linked incorrectly just remove them from the library and then do a sync

yeah there was a stable update in the meantime. I have completely removed spotify so the library would clear, then updated music assistant and added spotify with the new method. The first tests with the same songs as the last days seem promising. I will keep this issue open for a day or to more and observe. Thanks for your help!

OzGav commented 3 months ago

Checking in again as to whether this has been resolved?

OzGav commented 3 months ago

Closing assuming fixed

simonhoffmann commented 3 months ago

Sorry for the late reply. I have not noticed a single track being wrong since the update. I’d say it’s fixed. Thank you very much!