Introduction
This will walk you through getting Spotify working on your Archcraft installation so that it shows up in the mpd player at the top middle of your screen, if you are using the default theme on bspwm or openbox. This also lets you control the audio with your keyboard audio controls.
Installing required packages
First need some packages.
sudo pacman -S mopidy
yay -S mopidy-mpd mopidy-spotify
Spotify authentication with mopidy-spotify
Go to the mopidy website and click “Authenticate Mopidy with Spotify”. It will then create a pop-up asking for you to sign in and give permission to mopidy.
When that is done, keep the page up so that you can copy your client id and secret later.
Editing Mopidy
For this we will be running mopidy as a service, edit /etc/mopidy/mopidy.conf and paste the info below into the file. Then replace the username, password, and client id/secret that you obtained in the last step.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[audio]
output = pulsesink source=127.0.0.1
[spotify]
username = <your Spotify username>
password = <your Spotify password>
client_id = <your client ID>
client_secret = <your client secret>
bitrate = 320
[mpd]
enabled = true
hostname = 127.0.0.1
port = 6600
max_connections = 20
connection_timeout = 60
Changing mpd configuration
Now we need to change what port the default install of mpd uses since mopidy-mpd will be taking this role. You could just remove the package but incase you want to use it for something else, it will still be here.
edit ~/.mpd/mpd.conf port to 6601
Pulse Audio
Technically it will ,,work” when you start mopidy buuutttt you will not hear anything. Next, edit /etc/pulse/default.pa and look for the following network section. Make sure to uncomment the middle load-module line and add the auth-ip-acl=127.0.0.1
1
2
3
4
5
### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
#load-module module-zeroconf-publish
Getting everything started
These are the commands to get it all started. We need to kill all instances of mpd then restart pulseaudio and enable mopidy so that it starts when you boot.
1
2
3
4
5
6
killall mpd
pulseaudio --kill
start-pulseaudio-x11
sudo systemctl enable mopidy
sudo systemctl start mopidy
sudo reboot now
Once this is rebooted, you will have a working audio from Spotify!