darn … that one is really on me … https://github.com/KoljaWindeler/ytube_music_player/releases/tag/20210409b4
aaaaaaand thanks a lot for the ‘buy me a beer’, here in germany it’s already beer-drinking-time anyway.
darn … that one is really on me … https://github.com/KoljaWindeler/ytube_music_player/releases/tag/20210409b4
aaaaaaand thanks a lot for the ‘buy me a beer’, here in germany it’s already beer-drinking-time anyway.
Enjoy your beers! It worked but the tracks don’t play continuously. However, manually skipping to the next track does work. No errors in the logs but I did notice that the playing
state in dev tools doesn’t change in between tracks in either case, just perpetually in playing
state unless pausing which shows as expected (paused
) and the off
state is accurately shown when evoked.
Edit: Screenshot
It worked, great job!
I found an other issue, multiple accounts don’t work anymore, can only media browse the latest configured media_player/account. If I refresh my wife’s YTM cookie, on my media_player I get an ‘Unknown Error’ message:
Similarly, if I then refresh my cookie, her media_player gets the same error.
Here’s the error:
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/ytube_music_player/browse_media.py:69
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 9:27:26 AM (1 occurrences)
Last logged: 9:27:26 AM
[139721836312368] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 18, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 1107, in websocket_browse_media
payload = await player.async_browse_media(media_content_type, media_content_id)
File "/config/custom_components/ytube_music_player/media_player.py", line 1423, in async_browse_media
response = await build_item_response(self.hass, self._api, payload)
File "/config/custom_components/ytube_music_player/browse_media.py", line 69, in build_item_response
media = await hass.async_add_executor_job(media_library.get_library_albums, BROWSER_LIMIT)
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/library.py", line 126, in get_library_albums
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 403: Forbidden.
The caller does not have permission
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!
So no further observations? I’d like to release a new non-beta version. Jkw
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:
… 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
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.
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