I’ve made a little addition to the player component. It will let you add an input_boolean to your card to switch easy between shuffle on and off. just add the entitiy to your card. Be aware i have no idea what I’m doing, but it’s working fine so far.
It’s not hard if you want to show all stations that are not in your library. But for now you have to make this change in custom_components/gmusic_player/media_player.py
On line 389 you should find: library = station.get('inLibrary')
Simply change this to library = True
And don’t forget you’ll need to restart HA for changes to take effect.
thanks for the info, I guess I have to dig a little bit deepter into this…
strange thing though. It looks like the component is skipping tracks. The auto_advanced automation is fireing even though the tracks isn’t finished. Not sure why this is happening…
I’m having this issue myself. I’m not sure what’s changed. I think it’s something with GM servers. I’ve seen this reported in various issues with other things. Basically if the client takes too long to reach the end of a long song or if the download speed is too slow the connection is often reset during playback. The solution I think would be to download the entire song at once to/and play it from ram. That’s a lot over my head though.
The best I could do, would be to try using gmusicproxy for playback instead.
[gmusicproxy] project is based on the great Unofficial Google Play Music API of Simon Weber: it already permits to create URLs to stream the tracks as regular MP3 but they expire in 1 minute! Keeping this proxy running, it can generate persistent local URLs that never expire and that can be used in any media-player.
would be sad, that integration was lean and slick… with some gmusicproxy i need a lot more moving parts. well we see…
currently im moving from an old virtualenv homeassistant installation to a dockerised supervisor install of hassio on my linux box. to minimise the maintanance and my old install was stuck at some 0.8x pre lovelace release since i feared the switch.
So I run HA using a virtualenv (in an iocage jail on FreeNAS) I agree it is another moving part but I don’t think it has to change much. Really gmusic proxy can just be installed and running separately. For example I have just installed gmusicproxy in a virtualenv on my laptop to quickly test.
I have made one change in custom_components/gmusic_player/media_player.py
On line 521 is where it gets the stream url:
_url = self._api.get_stream_url(uid)
I have just changed this to get the stream from gmusicproxy instead.
192.168.1.19 is the ip of my laptop running gmusicproxy
I do realize this may be less than ideal but I have not had a song skip since I started to test this. It can at least be a temporary workaround until this can be solved properly. I found this commit where this is handled in gmproxy but I’m too much a python noob to understand how to implement something similar here.
I am running dockerized hassio on an Ubuntu box here. I will throw gmusicproxy on a system tonight to test. Even though it is one more piece, it is a pretty simple workaround to get music working again.
I think I can just add an option so you can switch between direct gmusicapi url or gmusicproxy url.
Sorry I can’t just fix this properly yet, this is just my first attempt at learning both python and how to make custom components. I really wish I was just a bit smarter, it’s slow going for me trying to learn python from the internet ( and I took the summer off ) - I have a lot of ideas for this and at the same time sooo many questions even regarding just the basics of python programming. I haven’t had that “Oh, I get it!” moment where it it all starts to just make sense.
Well, Gmusicproxy fixed the problem! For anybody running Docker, there is a Gmusicproxy Docker package available here: https://hub.docker.com/r/digitallyseamless/gmusicproxy that works great. Just create a config file, change the compose to point to your config and go. I did have to use the IP of my host instead of localhost to get it connected, but it is working great.
An option would be handy, but it is not a big deal to manually edit the file, either. I just commented out the original line so I can switch back without too much hassle.
No need to apologize! I’m still trying to ‘get’ Python, too. I’m just excited to have music working again and I can’t wait to see what else you will dream up!
@troy@smccoy thanks for the input, I’ll have a look when I find the time. still have a lot other stuff t setup and restructure. and as said, every little bit is welcome, no need to apologize.
edit: okay i was to curious and just added another container, looking good so far
Now, if I only could find a way to scrobble the music to last.fm this would be the cherry on top. Or a like dislike button for your player if you need some more challenges learning python
@smccoy@mason and I have noticed songs cutting off before they should end. You can use gmusicproxy as a workaround until this is fixed more correctly. If set gmusic_player can stream from your local gmusicproxy server. Enable this by entering the proxy url as shown the below.
Would love to see this set as the default option or to be able to toggle from the front end.
Hi @troy, thanks for the welcome! While it’d be nice if there was a simple copy/paste solution, I wasn’t expecting there to be. I only just got this up and running, and haven’t had time to dig into the internals too much due to life being life. I was hoping you’d at least be able to point me in a direction to look, which you have, so thank you! I will look into setting up an automation that writes the data from the gmusic_player when it’s active to the default media receiver instance. Even if it’s not easily possible, thanks for work on this plugin. It’s super handy (and fun to watch people’s reactions when you say “Alexa, it’s time to chill” and the mood lighting sets while some background music starts automatically)
I have the same issue. Did you manage to find a solution? It seems that the media player component Is the problem. Set image in media player
Cannot get legacy app password login to work. Tried with deviceid 00 to get a list of valid ones. Reconfigured with valid id but then I get this permission error. Installed using HACS.
ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform gmusic_player
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/gmusic_player/media_player.py", line 87, in setup_platform
add_devices([GmusicComponent(hass, config)])
File "/home/homeassistant/.homeassistant/custom_components/gmusic_player/media_player.py", line 141, in __init__
with open(_authtoken, 'wb') as f:
PermissionError: [Errno 13] Permission denied: './.gmusic_authtoken'
I’ll add an option to set this in the config. I think from that you can use an input_boolean to trigger an automation that changes the setting.
There is a way to do this but it’s a bit of a hack. I’ll try to get together a working example but it’s not perfect. Basically you set up some kind of automation to sync the gmusic_player attributes to the Default Media Receiver.
Hi, I have set up everything, the card shows what it should ok, but when I try to play anything, anywhere it gives me an error:
Failed to get URL for track: (Tn2r6kg5wvhfbfdtiuis47hcbua)
Any ideas? tks