I recently switched back to Arch Linux as my daily driver when I got my new Thinkpad, so I’ve been trying to replicate the setup that I used to have. Back then, I was using ncmpcpp, a beautiful MPD client as my music player. Now that I solely use Spotify as my music source, there are a few tweaks that need to be done for ncmpcpp to be able to stream your songs in Spotify.

There are 4 pieces of software you’ll need:

  1. ncmpcpp (of course!)
  2. Mopidy
  3. Mopidy-Spotify
  4. Mopidy-MPD

For ncmpcp, you have a choice to either install the official package using pacman or use the git version from AUR. Mopidy is also available in the official community repository but the extensions need to be installed from AUR.

Install all dependencies:

1
2
sudo pacman -S ncmpcpp mopidy
yay -S mopidy-mpd mopidy-spotify

The next step is to authenticate your Spotify account to be used with Mopidy. Follow this link to get your client_id and client_secret values. You’ll need this value later for your configuration. Once you got the keys, create your Mopidy configuration in $HOME/.config/mopidy/mopidy.conf. You can also run Mopidy as a service, which in that case, you’ll need to edit the main configuration file at /etc/mopidy/mopidy.conf but this guide will focus on running it under a user.

Towards the end of your configuration file, add these sections:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
[spotify]
username = <your Spotify username>
password = <your Spotify password>
client_id = <your client ID>
client_secret = <your client secret>

[mpd]
enabled = true
hostname = 127.0.0.1
port = 6600
max_connections = 20
connection_timeout = 60

The first part is the configuration for Spotify, while the second part will allow Mopidy to act like a MPD server so that ncmpcpp can connect to it. I uses 6600 for the standard MPD port, but if you change it to something else, you’ll also need to change it in the ncmpcpp’s config file.

The last thing you need to do is to actually run the service:

1
2
systemctl --user enable mopidy.service
systemctl --user start mopidy.service

Verify that the service is running by:

1
systemctl --user status mopidy.service

You’re good to go! Once you run ncmpcpp, you should be able to see your Spotify playlists and stream them normally. There are some limitations when using this extension, so please take a further look at the official documentation for Mopidy-Spotify.