Use google music from the command line
I like google music its an inexpensive and reliable service with a fairly good collection of music and I can upload my collection too.
The biggest problem I saw with it is that I could only listen through a brower or my android device… until now..
I recently found ( | https://github.com/diraimondo/gmusicproxy)[gmusicproxy] .. this sounded too good to be true! |
After a fair bit of messing around trying to get it to work, I managed to get it working and am currently playing my collection from google music via ncmpcpp and mpd
I had a few bumps along the road, so here is what I did:
Install a local version of python
To not polute my system python and to install stuff without being root, install a local recent Python using pyenv.
See: (https://github.com/yyuu/pyenv)[https://github.com/yyuu/pyenv]
$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ source .bashrc
$ pyenv install 2.7.10
Checkout latest code
$ git clone https://github.com/diraimondo/gmusicproxy.git
$ cd ./gmusicproxy
Install it an depencys
$ pip install -r requirements.txt
Write config
$ cat << EOF > ~/.config/gmusicproxy/gmusicproxy.cfg
email=cto@gmail.com
password=mysupapassword
device-id=magicid
extended-m3u=true
EOF
Get Device ID’s
First off I just made up my device-id which was causing incorrect (403’s from Google). Does this for list of configured devices and use one of these.
$ python GMusicProxy --config ~/.config/gmusicproxy/gmusicproxy.cfg --list-devices
Run it
$ python GMusicProxy --config ~/.config/gmusicproxy/gmusicproxy.cfg
Use it
Use gmusicproxy to create playlists, which mpd can then read and play.. awesome!
$ curl -s 'http://localhost:9999/get_collection' > ~/.config/mpd/playlists/collection_201507.m3u