Youtube Music - Media Browser

love the media library view with cover pitcures! :heart_eyes:
I was building a lovelace view with pictures of the playlists by manually adding the urls of the covers… not very comfortable.
I am wondering if it might be possible to get the cover grid with e.g the user playlists directly on to a lovelace view…

sounds amazing … but I have no clue how you’d do that … :slight_smile:
I’d hope that we’ll see some media browser cards popup up as soon as this get more popular with other media_players. Glad that it works for you now …
JKW

too many information? :smiley:
jkw

1 Like

Love it added the card info to the readme?

yup

1 Like

@JKW thank you! I am so happy to have it, works very nice and smooth! You are making my life easier! Good luck and I’ll check for new releases!!
dashboard|690x475

1 Like

Thanks for all your work.
I still can’t get it to continue playing. I noticed if I try to skip track that doesn’t work either.

139908142826016] object of type 'NoneType' has no len()
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1445, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 593, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 630, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 614, in async_media_next_track
    await self.hass.async_add_executor_job(self.media_next_track)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/ytube_music_player/media_player.py", line 972, in media_next_track
    self._get_track()
  File "/config/custom_components/ytube_music_player/media_player.py", line 713, in _get_track
    _LOGGER.debug("Playing track nr "+str(self._next_track_no)+" / "+str(len(self._tracks)))
TypeError: object of type 'NoneType' has no len()

I did add your recent view to see the play list and track number to make sure that was displayed correctly and it is.
I also deleted the integration and re-added that (still no beta check box) to make sure it was correct.

Please install today’s version. That will try right after the login if the connection to youtube works. It really feels like there is a problem with your cookie. Today’s version should also fix the bug you’ve just posted.

All together it’s fairly likely that the cookie is the root cause … at least my only way to explain why only you see those errors :stuck_out_tongue:

Could you (maybe on pastebin) upload more of your log?
Thanks jkw

I assume it’s probably my cookie also.
Where should I be pulling the log from? Supervisor > System > Core or Configuration > Logs

I am going to delete the component and the integration and try again.

Configuration - logs

Here you go.
FYI, after it stops, I can just click next and it will play the next track.

2020-12-21 10:37:34 DEBUG (MainThread) [custom_components.ytube_music_player.media_player] Config via Storage/UI currently not supported due to me not understanding asyncio
2020-12-21 10:37:45 DEBUG (MainThread) [custom_components.ytube_music_player.media_player] async_browse_media
2020-12-21 10:37:46 DEBUG (MainThread) [custom_components.ytube_music_player.media_player] async_browse_media
2020-12-21 10:37:52 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] play_media, media_type: playlist, media_id: RDTMAK5uy_nGQKSMIkpr4o9VI_2i56pkGliD6FQRo50
2020-12-21 10:37:52 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] _update_entity_ids
2020-12-21 10:37:52 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] playlist
2020-12-21 10:37:52 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] RDTMAK5uy_nGQKSMIkpr4o9VI_2i56pkGliD6FQRo50
2020-12-21 10:37:53 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] shuffle new tracklist
2020-12-21 10:37:53 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] _update_entity_ids
2020-12-21 10:37:53 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] _get_cipher
2020-12-21 10:37:53 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] _play
2020-12-21 10:37:53 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] _get_track
2020-12-21 10:37:53 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] Playing track nr 0 / 50
2020-12-21 10:37:53 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] get_url
2020-12-21 10:37:53 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] -- try to find URL on our own --
2020-12-21 10:37:53 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] -- self decoded URL via cipher --
2020-12-21 10:37:54 DEBUG (SyncWorker_6) [custom_components.ytube_music_player.media_player] Link status: audio/mp4 loading time: 0.067674 sec
2020-12-21 10:38:09 DEBUG (SyncWorker_11) [custom_components.ytube_music_player.media_player] _sync_player
2020-12-21 10:40:43 DEBUG (SyncWorker_5) [custom_components.ytube_music_player.media_player] _sync_player
2020-12-21 10:40:43 DEBUG (SyncWorker_5) [custom_components.ytube_music_player.media_player] media_player.worklaptop: idle -> idle

Hmm this might be due to your player. A couple questions:
You are using today’s version, correct?
What player are you using? A chromecast? Google home?
How did you start the playback, simple via clicking “turn on” on the player? Or via media browser?

Jkw

Edit: ok the log tells me that you’ve used the media browser
There was a bug yesterday that would cause the player to stop after one track if you use the browser

I cant get the new version working. I’ve uninstalled the component and deleted the header file but the integration wont run. I’ve logged an issue on github.

EDIT
Problem with my cookie file. Managed to fix it

1 Like

I’m using the new 20201221 build, and I’m getting a ‘Cant start the player, no header file.’ It was previously working.

When I look in the logs, I see the following:

* Traceback (most recent call last): File "/config/custom_components/ytube_music_player/media_player.py", line 554, in _update_playlists extra_info = self._api.get_playlist(playlistId=playlist['playlistId']) File "/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/playlists.py", line 91, in get_playlist song_count = to_int( File "/usr/local/lib/python3.8/site-packages/ytmusicapi/helpers.py", line 71, in to_int return locale.atoi(number) File "/usr/local/lib/python3.8/locale.py", line 330, in atoi return int(delocalize(string)) ValueError: invalid literal for int() with base 10: '1,151'
* Traceback (most recent call last): File "/config/custom_components/ytube_music_player/media_player.py", line 617, in _load_playlist my_radio = self._api.get_playlist(playlistId = self._playlists[idx]['playlistId'], limit = int(self._playlists[idx]['count']))['tracks'] File "/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/playlists.py", line 91, in get_playlist song_count = to_int( File "/usr/local/lib/python3.8/site-packages/ytmusicapi/helpers.py", line 71, in to_int return locale.atoi(number) File "/usr/local/lib/python3.8/locale.py", line 330, in atoi return int(delocalize(string)) ValueError: invalid literal for int() with base 10: '1,150

edit, it seems to only happen with the ‘your likes’ playlist.

Yep, that is an error inside the api. The strange thing is that it was fixed in 12.1 and … Oh wait … no! 12.2
And my requirements will still pull 12.1 … Hmm that could be an easy fix. Sorry for that.
Jkw
Edit: should be online
Edit2: by the way … this only happens if you have a Missmatch between your localizations … At least that was the response from the api author :wink:

Oh, crap sorry I missed your response.

Yes I am using todays version, playing with the media browser and I started play back via media browser.

@JKW thanks, the new build fixes my issue.

1 Like

And what is your remote player, a chromecast?

I am not using a remote player. I am playing it my PC.
The “speakers” are set to my laptop.
media_player.worklaptop
type: browser_mod

Ah! Browser mod … Never checked if that would work … I’ll have a look later on … so far the integration has only been tested on chromecast and google home … And to a certain degree on kodi …
Will have a look and get back to you …
Jkw