Info

Last Change
Last Editor thebigmunch

Index

gmusicapi

Intro

gmusicapi is an unofficial Python API for Google Play Music. It allows you to control Google Music from Python scripts. It is not supported nor endorsed by Google.

If you have any questions or comments about it, you can visit #gmusicapi on irc.freenode.net or ask thebigmunch in the Whatbox IRC channel.

Installation

Connect to your server through SSH.

avconv

The avconv tool used by gmusicapi to transcode non-mp3 files is not installed on Whatbox. You will have to download a static binary and add it to your PATH to use.

  1. Download the avconv static binary and give it executable permissions.

    mkdir -p ~/bin && wget -O ~/bin/avconv https://dl.dropbox.com/u/20787713/Whatbox/gmusicapi/avconv && chmod +x ~/bin/avconv
    
  2. Add the bin directory to your PATH (if you've done this previously, you do not need to do it again)

    echo "PATH=\$PATH:\$HOME/bin" >> ~/.bashrc && source ~/.bashrc
    

virtualenv

Follow the instructions in the virtualenv article to install and activate a Python virtual environment. If you have previously set up virtualenv, you may choose to re-use it or create a new one with a different name.

gmusicapi

With your virtualenv activated, install gmusicapi and its dependencies with the pip package installer.

pip install gmusicapi

gmusicapi-scripts

Scripts for uploading with gmusicapi can be found here.

  • Clone the repository

    git clone https://github.com/thebigmunch/gmusicapi-scripts ~/gmusicapi-scripts
    

Cleanup

To clean up the files no longer needed from this process, use the following command.

rm -rf virtualenv-*

Updating

gmusicapi

  1. Activate your virtualenv
  2. Run the following command

    pip install --upgrade gmusicapi
    

gmusicapi-scripts

  1. Navigate to your gmusicapi-scripts directory

    cd ~/gmusicapi-scripts
    
  2. Pull in any changes with git. If you get a message about having modified files, run git reset --hard beforehand.

    git pull
    

Usage

  • Activate your virtualenv
  • For options and instructions, see the gmusicapi-scripts wiki
  • You will need to use the full path to the scripts like ~/gmusicapi-scripts/gmsync.py unless you add the directory to your PATH or create an alias.

Creating Scripts

The documentation for the API can be found here. The API itself is hosted on Github where you'll find more information about its capabilities.