search is still very complicated … most because we’re missing a card that one could use to enter the search string and select from the results
You can call the service “ytube_music_player.search” and enter your keywords there (no nice UI).
Your results will be presented in the media_browser. You can also use some sort of background service like Appdeamon, e.g.
#wait for results
self.listen_state(self.ytsearch,"sensor.ytube_music_player_keller_extra",attribute="search")
# call the search
self.call_service("ytube_music_player/search", entity_id="media_player.ytube_music_player_keller", query="Pink", limit="20")
# play first track from results
def ytsearch(self, entity="", attribute="", old="", new="", kwargs=""):
for result in new:
if(result['type']=='song'):
self.call_service("media_player/play_media",entity_id='media_player.ytube_music_player_keller', media_content_type="track", media_content_id=result['id'])
break
But again … there is no nice way to do this in the UI of homeassistant (currently)
the command above was for appdaemon … you have to define the two field media_content_type=“playlist”, media_content_id=“abcdefg your id goes here” directly …
edit: bascially click “load sample data” in nodered and fill those fields …
Can I ask how you got your background on that Media view to match the current playing entity_picture? I’m trying to figure that out but can’t nail it down.
Also, did you customise the mmp accent colour to have the progress bar, active source and volume controls that colour?
Do you know why the tracks and lyrics markdown would stop working? Mine used to work but hasn’t been working for a month or 2 now. I copy and pasted your markdown.yaml from the vertical stack line 45 down and the tracks and lyrics are still showing up blank. I’ve tried updating the cookie and clearing the cache and storage.
I know you have recently updated this yaml and I’ve tried it with the update and the tracks and lyrics markdown still show up blank.
One thing I did notice in that yaml irrelevant to this issue is line 74 {{state_attr("media_player.ytube_music_player","_player_id")}}
The correct state attribute that works for me in that line is {{state_attr("media_player.ytube_music_player","remote_player_id")}}
Jep the reason for the none working stuff is that some attributes moved to the “_extra” sensor … Ive updated the Markdown template (didn’t I?) … please check the latest version online
This is a screenshot of mine … working fine … sorry for no formating, I’m on my phone
The only difference I see is a typo in line 120 in the github markdown.yaml file. {% if i == state_attr("media_player.ytube_music_player"current_track")
It is missing ", between media_player.ytube_music_player and current_track. Should be: {% if i == state_attr("media_player.ytube_music_player","current_track")
But even fixing that the tracks are still blank.
I also am finally getting around to updating my lyrics and track and everything works with 1 minor issue.
I think the ytube_music_player is zero based and ytube_music_player_extra is 1 based?
It shows the correct artist and song highlighted but the numbers are off by one.
Playing Track is 8 but the list is 9.
Also minor typo in your markdown.yaml on git.
Shows state_attr("media_player.ytube_music_player"current_track")
should be
wondering if someone could help im getting errors where i didnt before so i uninstalled the integration restarted reinstalled restarted configured again and still have the same errors.
EDIT: just found the github issue seems like its waiting on a merge
Summary
2022-01-19 21:12:39 ERROR (MainThread) [custom_components.ytube_music_player.media_player] [S] async_get_cipher
2022-01-19 21:12:39 ERROR (MainThread) [custom_components.ytube_music_player.media_player] [S] play_media, media_type: playlist, media_id: PLvk72NjGMhzj1QMQEZDpNYr0AXaQZuVhb
2022-01-19 21:12:39 ERROR (MainThread) [custom_components.ytube_music_player.media_player] [S] async_prepare_play
2022-01-19 21:12:39 ERROR (MainThread) [custom_components.ytube_music_player.media_player] [S] async_check_api [E]
2022-01-19 21:12:39 ERROR (MainThread) [custom_components.ytube_music_player.media_player] [S] async_update_remote_player(Input / current media_player.living_room_speaker) [E]
2022-01-19 21:12:39 ERROR (MainThread) [custom_components.ytube_music_player.media_player] self._state is: (idle).
2022-01-19 21:12:42 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140613493093040] __init__: could not find match for ^\w+\W
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
await result
File "/config/custom_components/ytube_music_player/media_player.py", line 1428, in async_play_media
if(not(await self.async_prepare_play())):
File "/config/custom_components/ytube_music_player/media_player.py", line 555, in async_prepare_play
await self.async_get_cipher('BB2mjBuAtiQ')
File "/config/custom_components/ytube_music_player/media_player.py", line 672, in async_get_cipher
self._cipher = Cipher(js=self._js)
File "/usr/local/lib/python3.9/site-packages/pytube/cipher.py", line 39, in __init__
raise RegexMatchError(
pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W
Hey everyone … it might take some time until the real fix is implemented at PyTube and I didn’t want to wait
So I’ve published a hot fix, that will be removed once PyTube merged the real fix.