Google Music is one of the few mainstream paid music services to take Linux seriously, and it enjoys robust, first-class Linux support. When users turn on their Linux PC’s, they know that they can install the latest Google branded music tool, and download/upload all of their files to listen to wherever they please. Still, for as good as Google’s downloader tool is, there are some drawbacks. For starters, it isn’t possible to run it inside of a virtual machine, or on a terminal-based server because of some limitations by Google. To solve this problem, a developer on Github has created Gmpydl; a python based program that lets you log into Google and download your Google Music library in Linux via the command line.
Installing Git And Other Tools
Gmpydl requires a few programs, libraries and other things before anything will work. The first thing that you’ll need is Git. This tool is important because with it, it is possible download the required Gmpydl code. Open a terminal, and enter the following:
sudo apt install git
sudo pacman -S git
sudo dnf install git
sudo zypper install git
sudo apt-get install git
Next, some Python libraries, as well as some Python tools are required. The first is Python2. This one is a bit tricky, as most Linux distributions already make heavy use of Python, and should have it installed. If for some reason your PC doesn’t have Python 2, you’ll need to install it. Additionally, PIP and the Python-based Google Music library gmusicapi is required.
When it comes to installing Python 2, every operating system has a different name for it. This is why it is best to use the search function to find Python 2. Consider using the terminal, and your Linux distribution’s “search feature”.
Each mainstream Linux distribution is different when it comes to searching for packages. On Fedora the command is
dnf search, on Arch it’s
pacman -Ss, Ubuntu is
apt search, OpenSUSE is
zypper search, and Debian is
apt-cache search. Use one of these to find Python 2 and install it. Also install pip. Keep in mind that it could be called python2-pip, python-pip or pip, or something similar.
With both tools installed on the system, use PIP to install the Google Music API:
pip install gmusicapi
The Python installer tool will find, download, build, and install the Gmusicapi to get everything going on the system.
Gmpydl has everything it needs to run. Now, let’s grab the code. In a terminal, use git to download the necessary files.
git clone https://github.com/stevenewbs/gmpydl
Now enter the Gmpydl directory with the CD command.
Lastly, make the download folder where all the music files will go.
mkdir -p ~/Google-Music-Downloads
With this program, it’s easy to Download your Google Music library in Linux via command line . However, first, you’ll need to sign into your Google account. This is done by starting the program for the first time. In a terminal, run this command from the Gmpydl directory.
This will ask the user to enter their “Google Account Email Address”. In the terminal, type in the Google mail address connected to the account you’d like to download your Google Music files from, then press the enter key. This will generate a new configuration file, and generate a link to click on. This link generates a one-time token to log into Google, so that Gmpydl doesn’t use your password.
The next thing to tell the download tool is where it should place all downloaded music files. Enter the folder created earlier for downloads in this prompt:
With all this information filled out, the download process can begin.
Other Gmpydl Features
Running Gmpydl right out of the box after signing in is perfect. It starts the downloads to the directory that you tell it to. However, this isn’t the only way Gmpydl can be used. There are other features, such as the Nodl feature, search and overwrite functions.
To use the NoDL function in Gmpydl, execute the command like normal in the terminal, but add the -n switch. Doing this will effectively mark all music downloaded. This is useful if for some reason the downloader messes up. This allows you to tell the program everything is normal, otherwise stuff could re-download.
Sometimes when downloading, you just want to download a specific item, and not the entire library. Here’s how to do it with Gmpydl.
./gmpydl -s searchitem
Be sure to replace “searchitem” with the artist, song title, album or genre desired.
Since this Google Music download is unstable code, things can go wrong at times. You may be downloading something, only to find out that (for some reason) it stopped downloading. If Gmpydl stops mid-download, files can be corrupted. To fix this, it is possible to re-download everything, using the -o command.
The tool released by Google is great, but truth be told, when it comes to interacting with the service, its limiting. This is why Gmpydl is such a great find: it allows users to better interact with Google Music via the Linux command line. It’s true that at present the tool only supports downloading. Still, as the need for a solid command line tool for Google Music on Linux increases, there’s no question that more features will come along.