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.3k stars 47 forks source link

Cannot play youtube music playlist: "'async for' requires an object with __aiter__ method, got coroutine" #2208

Closed hundredfire closed 4 months ago

hundredfire commented 4 months ago

What version of Music Assistant has the issue?

2.0.0b146

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

2024.5.0

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

The problem

Following the A/B testing of new playlists display in YT music, the parser for the library ytmusic-api was broken. This recently got fixed with version 1.7.0 of said library. Now, I can actually browse my playlists using Music assistant server on home assistant. However, when I try to play any playlist, the following error is displayed: 'async for' requires an object with __aiter__ method, got coroutine and nothing happens.

Here are the relevant log entries:

2024-05-07 23:35:25.510 INFO (MainThread) [music_assistant] Loaded music provider YouTube Music
2024-05-07 23:37:24.585 WARNING (MainThread) [music_assistant.music] Sync task for YouTube Music completed with errors
2024-05-07 23:40:54.545 WARNING (MainThread) [py.warnings] /usr/local/lib/python3.12/site-packages/music_assistant/server/controllers/player_queues.py:345: RuntimeWarning: coroutine 'PlaylistController.tracks' was never awaited
  async for playlist_track in ctrl.tracks(

2024-05-07 23:40:54.546 ERROR (MainThread) [music_assistant.webserver] Error handling message: player_queues/play_media: 'async for' requires an object with __aiter__ method, got coroutine

This is quite troublesome as playlists can't work at all neither in the front-end, nor in automations. (Again, albums and single tracks can be played without any issues)

How to reproduce

Browse a YT music playlist, press play

Music Providers

Youtube Music

Player Providers

Chromecast audio group

Full log output

log.txt

Additional information

No response

What version of Home Assistant Core are your running

2024.0.2

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Raspberry Pi

senderbell commented 4 months ago

I have exactly the same issue on Spotify. TuneIn works well

OzGav commented 4 months ago

Please try again with b147

hundredfire commented 4 months ago

Please try again with b147

Works perfectly! Great job, thank you for your work