thx this looks perfect
Is there a way to change the ‘speakers’ value thru some code or something, instead of thru the interface?
I have gmusic currently running now (and it’s great, thanks!!!), but I’m used to the node red side of things, and am not sure if this is possible or not.
Perhaps some function or service call?
(I took a look for some previous answers, and didn’t see anything come up)
Hello @phreaq
Currently there is nothing built into the GM media player to select speakers but that is something I hope to add when I have time to continue work on this project.
Sorry I can not share anything off the top of my head but I would imagine any type of automation to select values from an input_select would work.
Thanks Troy,
I don’t have much experience in changing the entitie’s properties, I tried the below service node, but had no luck.
Anyone have any pointers? I’m sure it’s something simple.
tia
I don’t use Node Red so I’m not sure if this will help in any way but for example to select the speakers using the services in HA this should work.
Edit: Just a guess but in your Node Red screenshot, maybe try changing set_options
to select_option
perfect! that gave me what I needed (and yes, I needed the “select_option”, among other tweaks)
again, thanks for your help, and your work on this. I used gmusic many moons ago in Kodi, until the 2 step verification broke my build. I’m glad I’m reunited with it again.
for the benefit of others, below is what worked for me.
very welcome addition to my setup, thank you very much.
so far i got it up and running. but i understand how to refresh my stations? i have only 2 from which i can choose “feeling lukcy” and some random other one. If i call the service with a different station, the log only shows me that I could select from that two. any hints?
edit: nevermind, I didn’t get that these are the stations out of my musiclib and not the one the subsciption provides.
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.
cards:
- entities:
- artwork: cover
entity: media_player.gmusic_player
group: true
hide:
progress: true
replace_mute: stop
source: icon
type: 'custom:mini-media-player'
volume_stateless: true
- entity: input_boolean.gmusic_player_shuffle
- entity: input_select.gmusic_player_source
- entity: input_select.gmusic_player_speakers
- entity: input_select.gmusic_player_playlist
- entity: input_select.gmusic_player_station
type: entities
type: vertical-stack
Hi @mason
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…
For the last few days, my installation has been skipping tracks before they have finished, too. Unfortunately, I’m yet to find the culprit…
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.
How are you guys running homeassistant? I mean are you using hass.io or running in a virtualenv on Linux?
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
_url = "http://192.168.1.19:9999/get_song?id=" + uid
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
thanks guys