Browse and stream Google Play Music from the comfort and familiarity of your favourite terminal.
- Python 3
- mpv
- gmusicapi:
pip install gmusicapi
- Note: If you have both Python 2 and Python 3 installed, specify Python 3 with
pip3 install gmusicapi
.
- Note: If you have both Python 2 and Python 3 installed, specify Python 3 with
Use the .sh
scripts in script
to install, update or remove the program. Note that they require root access; while I assure you they're safe, it's good practice to read the scripts so that you know what they do before running them.
Once installed, the program can be run from the terminal with gpymusic
. While the program is running, don't resize your terminal.
Google Py Music works similiarly to the web interface in that users with free accounts can only arbitrarily access music that they've purchased or uploaded, whereas users with free accounts can search for and stream anything. When playing music with a free account, the entire song is downloaded and played locally rather than streamed.
Notes for free users:
- A one-time OAuth sign-in is required for free users, run
script/oauth_login.py
and follow the prompts to authorize. - If you don't want to wait for songs to download on the fly, you can download them all in one go with
script/download_all.py
. Songs are stored in~/.local/share/gpymusic/songs
. - The
e/expand
command does not work for free users because artists and albums cannot be generated, so there is nothing for it to do. - I don't have enough music uploaded to my free account to properly test it, so please open issues about any crashes or other problems.
s/search search-term
: Search for 'search-term'e/expand 123
: Expand item number 123p/play
: Play current queuep/play s
: Shuffle and play current queuep/play 123
: Play item number 123q/queue
: Show current queueq/queue 123
: Add item number 123 to queueq/queue 1 2 3
: Add items 1, 2, 3 to queueq/queue c
: Clear current queuew/write file-name
: Write current queue to file file-namer/restore file-name
: Replace current queue with playlist from file-nameh/help
: Show help messageCtrl-C
: Exit Google Py Music
When playing music:
spc
: Play/pause9/0
: Volume down/up (Note: volume changes are not persistent across songs, so I recommend you adjust your system volume instead)n
: Next trackq
: Stop↑/↓/←/→
: Seek
Colour themes are defined in the colour
section of your config file. To enable colour, make sure enable
is set to yes
and set the fields to hex colours as desired. highlight
affects the section headers and 'now playing' output, content{1|2}
affect the main window, and background
and foreground
are self-explanatory.
Note: Upon exiting the program, your terminal colours will likely be modified. Just open a new terminal session and your colours will be back to normal.
If you don't know your device ID, run script/get_dev_id.py
and answer the prompts to generate a list of valid device IDs.
You can choose to leave the password field empty as it is in config.example
, and you will be prompted for it upon starting the program. Otherwise, you can supply it for automatic logins.
If you store your password in plain text, be aware the potential consequences.
If your account has 2FA set up, you will need to use an app password to log in. If you're storing your password in your config file, replace it with the app password.
If gpymusic
crashes, your terminal settings will likely be messed up, in which case stty sane
will restore order. Don't forget to open an issue!
Expect bugs, and please report them! I hope you enjoy using Google Py Music, and if you don't, that's okay too because I enjoy working on it.