Google Music Sync using Python

Those of you who are familiar with Google Music know that you can upload up to 20,000 songs free of charge, which you can them stream from your PC/Laptop/iPad/Phone, whatever. They provide a winky little UI driven client which will automatically upload files in a monitored directory for you.

I have a media server on my home network where my music files live. It's the central place that I use to stream music to various devices around my home. This particular server runs a headless version of Linux and therein lies the problem, I don't have a GUI to use the Google client, and I don't want to install one just for that purpose!

I tried several methods of running the client on a headless box and eventually gave up and decided to write my own Python based script do sync for me.


So before you go any further, you will a couple of things. This is because I didn't want to reinvent the wheel. There are a couple of Python packages out there that we can pull together to achieve this purpose, and can be installed through pip.

Google Music API

pip install git+git://


pip install eyeD3

So these two components do most of the work for us, Google Music API is a Python API wrapper for the Google Music service, and eyeD3 allows us to read MP3 tags from files.

Install the script

So to install the script the best thing to do is clone it from my GitHub account:

git clone

Then you need to make it executable:

sudo chmod 0755

Using the script

The script works by grabbing a list of all of your songs on Google Music, and then a list of all of your songs on the specified directory. Then it creates a hash based on the tracks ID3 details, and compares one list to the other. Any files that are not found on Google Music will then be pushed up.

Note: This is a one way sync at this point in time, from your computer to Google Music. Feel free to Fork my repository should you wish to improve this!
To actually execute the script, you use the following command:

./googlemusicsync -P LOCAL_PATH -s 'true/false'

Where -p is the path to your local music directory and -s is should the changes be synced, or just the differences reported.

The first time you run the script you will be asked to visit a URL at Google Play Music to authorise the application with your Google Music account, simply paste the authorisation token in at the command prompt.

And that's it, your files should be synced up to Google Music!