Youtube Music - Media Browser

hmm I can’t confirm that bug … I’ve used two accounts and can browse both without any issues.
You’ve used two different filenames to store the cookie, right?

Like two different config_flow? Yeah, both are distinct entities.

Well in the config Flow you define where the cookie is stored (filename, first Page, Last row). Did you use two different filenames?
Jkw

Finally got it to work, had to remove my wife’s account completely and recreate it in config_flow. Very strange, I tested it with a third account and it worked right away, that’s how I arrived to that conclusion. Thanks again for the help!

1 Like

So no further observations? I’d like to release a new non-beta version. Jkw

2 Likes

Seems stable, used it like normal today.

1 Like

Hi alexbell,

Do you have a new flow for NodeRed? I tried the old one you posted, but it wipes out all the settings for my ytube music player, and doesn’t set them correctly.

Hi, playlist radio doesn’t seem to work. For testing purposes I created a playlist with only one track and only this one track will be played. But shouldn’t an automatic playlist with similar tracks be played? At least that’s how it works on the YTM website.

Anyway, super integration. Thanks a lot for this.

Hmm works here … how do you start the radio?
What I’ve done was:

  1. on the ytube website: create a playlist with only one entry
  2. in homeassistant: use media_browser → playlists → start playlist
  3. open development settings: display attributes of the media_player.ytube_music_player
    3.1. copy playlist id from ‘_media_id’ attribute
  4. call media_player.play_media with
    • the same content_id from 3.1
    • media_content_type: channel,
    • entity_id: media_player.tube_music_player

… generates a radio based on that one track …

No, unfortunately it does not work. I had selected the playlist via the dropdown. As Source: Playlist Radio. Speaker selected and started. Only the single track is played repeatedly. Also your way over the Developer Settings delivers the same result.

strange … you’re running the latest version, right? (no updates in HACS available)
could you try again an activate debug before running GitHub - KoljaWindeler/ytube_music_player: YouTube music player for homeassistant and ideally open a github ticket with the content https://github.com/KoljaWindeler/ytube_music_player/issues/new/choose
Thanks

Yes, running latest Version 20210414. Here ist the ticket with debug log Playlist Radio doesn't work · Issue #88 · KoljaWindeler/ytube_music_player · GitHub

A small improvement for rating buttons. Maybe helpful for someone:

Button-Card cannot call multiple services, so you need a small script

Script to imitate YTM behavior “Thumb down and play next”:

thumb_down_and_next:
  alias: Thumb down and next
  sequence:
  - service: ytube_music_player.call_method
    data:
      entity_id: media_player.ytube_music_player
      command: rate_track
      parameters: thumb_down
  - service: media_player.media_next_track
    target:
      entity_id: media_player.ytube_music_player
  mode: single

Button-Cards Thumbs up/down

type: horizontal-stack
cards:
  - type: 'custom:button-card'
    state:
      - operator: template
        value: >
          [[[ return
          states['media_player.ytube_music_player'].attributes.likeStatus ==
          "LIKE"]]]
        icon: 'mdi:thumb-up'
      - operator: template
        value: >
          [[[ return
          states['media_player.ytube_music_player'].attributes.likeStatus ==
          "INDIFFERENT"]]]
        icon: 'mdi:thumb-up-outline'
      - operator: default
        icon: 'mdi:thumb-up-outline'
        value: false
    tap_action:
      action: call-service
      service: ytube_music_player.call_method
      service_data:
        entity_id: media_player.ytube_music_player
        command: rate_track
        parameters: thumb_toggle_up_middle
  - type: 'custom:button-card'
    state:
      - operator: template
        value: >
          [[[ return
          states['media_player.ytube_music_player'].attributes.likeStatus ==
          "DISLIKE"]]]
        icon: 'mdi:thumb-down'
      - operator: template
        value: >
          [[[ return
          states['media_player.ytube_music_player'].attributes.likeStatus ==
          "INDIFFERENT"]]]
        icon: 'mdi:thumb-down-outline'
      - operator: default
        icon: 'mdi:thumb-down-outline'
        value: false
    tap_action:
      action: call-service
      service: script.turn_on
      service_data:
        entity_id: script.thumb_down_and_next
4 Likes

I never found a way to integrate such a button into the Mini-Media-Player … Sadly there is no template support for the icons …
Currently I use the “like in name” function to provide feedback if that song was already liked… Not ideal but the best I can think of

Yes, as icons directly in the player would be great. I put them in a vertical stack just below the player and set the height to 50px.

1 Like

I had partial success in creating a more streamlined look/functionality in context to up/down thumbs. Basically created switch entities and using the entities card, button row variables :


- platform: template
  switches:
    ytm_like:
        value_template: "{{ state_attr('media_player.ytm', 'likeStatus')}}"
        turn_on:
          service: ytube_music_player.call_method
          data:
            entity_id: media_player.ytm
            command: rate_track
            parameters: thumb_up
        turn_off:
          service: ytube_music_player.call_method
          data:
            entity_id: media_player.ytm
            command: rate_track
            parameters: thumb_middle
        icon_template: >-
          {% if is_state('media_player.ytm', 'INDIFFERENT') %}
            mdi:thumb-up-outline
          {% else %}
            mdi:thumb-up
          {% endif %}
- platform: template
  switches:
    ytm_dislike:
        value_template: "{{ state_attr('media_player.ytm', 'likeStatus')}}"
        turn_on:
          service: ytube_music_player.call_method
          data:
            entity_id: media_player.ytm
            command: rate_track
            parameters: thumb_down
        turn_off:
          service: ytube_music_player.call_method
          data:
            entity_id: media_player.ytm
            command: rate_track
            parameters: thumb_middle
        icon_template: >-
          {% if is_state('media_player.ytm', 'INDIFFERENT') %}
            mdi:thumb-down-outline
          {% else %}
            mdi:thumb-down
          {% endif %}

However, I’m not very adept at getting the icon template part to work to display the change in attr states, also tried but no luck:

  icon_template: >-
          {% if state_attr('media_player.ytm', 'INDIFFERENT') %}
            mdi:thumb-down-outline
          {% else %}
            mdi:thumb-down
          {% endif %}

Lastly, with the entities card, was able to display the switches in a row:

- type: buttons
    entities:
      - entity: switch.ytm_like
        name: null
      - entity: switch.ytm_dislike
        name: null
2 Likes

I am getting this when i open the list of my favourites:

Schermata 2021-04-23 alle 20.21.12

And these errors in log:

============= ytube_music_player Integration Error ================
2021-04-23 20:26:00 ERROR (MainThread) [custom_components.ytube_music_player.media_player] unfortunately we hit an error in the sub api, please open a ticket at
2021-04-23 20:26:00 ERROR (MainThread) [custom_components.ytube_music_player.media_player] https://github.com/sigma67/ytmusicapi/issues
2021-04-23 20:26:00 ERROR (MainThread) [custom_components.ytube_music_player.media_player] and paste the following output:

2021-04-23 20:26:00 ERROR (MainThread) [custom_components.ytube_music_player.media_player] Traceback (most recent call last):
  File "/config/custom_components/ytube_music_player/media_player.py", line 1132, in async_play_media
    crash_extra = ''
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/playlists.py", line 66, in get_playlist
    response = self._send_request(endpoint, body)
  File "/usr/local/lib/python3.8/site-packages/ytmusicapi/ytmusic.py", line 129, in _send_request
    raise Exception(message + error)
Exception: Server returned HTTP 404: Not Found.
Requested entity was not found.

2021-04-23 20:26:00 ERROR (MainThread) [custom_components.ytube_music_player.media_player] 
thanks, Kolja
2021-04-23 20:26:00 ERROR (MainThread) [custom_components.ytube_music_player.media_player] ============= ytube_music_player Integration Error ================

Using the latest version whatever I try to paste in for the cookie it just reports “user input malformed”… used to work

Good After noon
when i trying to play youtube music player Getting below error message

“Please select a player before start playing, e.g. via the ‘media_player.select_source’ method or in the settings/config_flow”

any one help me how can i fix this

Hello Dear
Kindly Help me

When i am trying to play ytmusic player getting below error message

yTubeMediaPlayer error

Please select a player before start playing, e.g. via the ‘media_player.select_source’ method or in the settings/config_flow

Kindly help me how can fix this error