DEV Community

Cover image for Use Spotify made for Developers
Bogusdeck
Bogusdeck

Posted on • Updated on

Use Spotify made for Developers

Launch Spotify directly from your terminal for a streamlined experience without the need for a resource-intensive browser tab or desktop application. Just follow these straightforward steps, and you'll be enjoying your music in no time.

Installation

To install the spotify-tui client from Rigellute/spotify-tui
github repository or you can use different methods depending on your OS{macOS, Arch linux}

For MAC installation

brew install spotify-tui
brew install spotifyd
brew services start spotifyd

For arch linux

yay -S spotify-tui
yay -S spotifyd

we also need to install Spotifyd, a lightweight Unix daemon, you’ll get a fully-featured terminal application that connects to your Spotify Premium account.

Image description

Configuration

Create a configuration file

~/.config/spotifyd/spotifyd.conf:

[global]
# Your Spotify account name.
username = "{your spotify username}"

# Your Spotify account password.
password = "Launch Spotify directly from your terminal for a streamlined experience without the need for a resource-intensive browser tab or desktop application. Just follow these straightforward steps, and you'll be enjoying your music in no time.

## Installation
To install the spotify-tui client from Rigellute/spotify-tui
github repository or you can use different methods depending on your OS{macOS, Arch linux}

> For MAC installation
Enter fullscreen mode Exit fullscreen mode

brew install spotify-tui
brew install spotifyd
brew services start spotifyd

> For arch linux
Enter fullscreen mode Exit fullscreen mode

yay -S spotify-tui
yay -S spotifyd


we also need to install Spotifyd, a lightweight Unix daemon, you’ll get a fully-featured terminal application that connects to your Spotify Premium account.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zecf2s93n8fp3pot171w.png)

## Configuration
### Create a configuration file
`~/.config/spotifyd/spotifyd.conf:`

Enter fullscreen mode Exit fullscreen mode

[global]

Your Spotify account name.

username = "{your spotify username}"

Your Spotify account password.

password = "Launch Spotify directly from your terminal for a streamlined experience without the need for a resource-intensive browser tab or desktop application. Just follow these straightforward steps, and you'll be enjoying your music in no time.

Installation

To install the spotify-tui client from Rigellute/spotify-tui
github repository or you can use different methods depending on your OS{macOS, Arch linux}

For MAC installation

brew install spotify-tui
brew install spotifyd
brew services start spotifyd

For arch linux

yay -S spotify-tui
yay -S spotifyd

we also need to install Spotifyd, a lightweight Unix daemon, you’ll get a fully-featured terminal application that connects to your Spotify Premium account.

Image description

Configuration

Create a configuration file

~/.config/spotifyd/spotifyd.conf:

[global]
# Your Spotify account name.
username = "{your spotify username}"

# Your Spotify account password.
password = "Launch Spotify directly from your terminal for a streamlined experience without the need for a resource-intensive browser tab or desktop application. Just follow these straightforward steps, and you'll be enjoying your music in no time.

## Installation
To install the spotify-tui client from Rigellute/spotify-tui
github repository or you can use different methods depending on your OS{macOS, Arch linux}

> For MAC installation
Enter fullscreen mode Exit fullscreen mode

brew install spotify-tui
brew install spotifyd
brew services start spotifyd

> For arch linux
Enter fullscreen mode Exit fullscreen mode

yay -S spotify-tui
yay -S spotifyd


we also need to install Spotifyd, a lightweight Unix daemon, you’ll get a fully-featured terminal application that connects to your Spotify Premium account.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zecf2s93n8fp3pot171w.png)

## Configuration
### Create a configuration file 
`~/.config/spotifyd/spotifyd.conf:`

Enter fullscreen mode Exit fullscreen mode

[global]

Your Spotify account name.

username = "{your spotify username}"

Your Spotify account password.

password = "Launch Spotify directly from your terminal for a streamlined experience without the need for a resource-intensive browser tab or desktop application. Just follow these straightforward steps, and you'll be enjoying your music in no time.

Installation

To install the spotify-tui client from Rigellute/spotify-tui
github repository or you can use different methods depending on your OS{macOS, Arch linux}

For MAC installation

brew install spotify-tui
brew install spotifyd
brew services start spotifyd

For arch linux

yay -S spotify-tui
yay -S spotifyd

we also need to install Spotifyd, a lightweight Unix daemon, you’ll get a fully-featured terminal application that connects to your Spotify Premium account.

Image description

Configuration

Create a configuration file

~/.config/spotifyd/spotifyd.conf:

[global]
# Your Spotify account name.
username = "{your spotify username}"

# Your Spotify account password.
password = "pass spotify/spotifyd"

use_keyring = true
use_mpris = true
dbus_type = "session"
backend = "alsa" # use portaudio for macOS [homebrew]
device = "alsa_audio_device"  # omit for macOS
audio_format = "S16"
control = "alsa_audio_device"  # omit for macOS
mixer = "PCM"  # omit for macOS
volume_controller = "alsa"  # use softvol for macOS
on_song_change_hook = "command_to_run_on_playback_events"
device_name = "spotifyd"
bitrate = 320
cache_path = ""/Users/<your Username>/.cache/spotifyd"
max_cache_size = 1000000000
no_audio_cache = true
initial_volume = "90"
volume_normalisation = true
normalisation_pregain = -10
autoplay = true
zeroconf_port = 1234
proxy = "http://proxy.example.org:8080"
audio_dongle.
device_type = "computer"
Enter fullscreen mode Exit fullscreen mode

fill your username, password and your system username in username, password and cache_path respectively

Create a systemd user script

~/.config/systemd/user/spotifyd.service:
Enter fullscreen mode Exit fullscreen mode
[Unit]
Description=A spotify playing daemon
Documentation=https://github.com/Spotifyd/spotifyd
Wants=sound.target
After=sound.target
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/bin/spotifyd --no-daemon
Restart=always
RestartSec=12

[Install]
WantedBy=default.target

Enter fullscreen mode Exit fullscreen mode




Then enable and start the script

systemctl --user enable spotifyd --now

Connecting to Spotify API

To connect Spotify-tui to Spotify's API for music playback and track searching, follow these steps:

  • Visit the Spotify dashboard.
  • Create a new app to obtain your Client ID and Client Secret.
  • Edit app settings and add http://localhost:8888/callback as a Redirect URI.
  • Save settings and return to the terminal.
  • Run "spt" and enter your Client ID and Client Secret when prompted.
  • Confirm the default port (8888) or input a custom port.
  • You'll be redirected to Spotify for permission.
  • After approval, the redirect URL is automatically parsed.
  • If the local web server fails, copy the URL from the blank page and paste it into the terminal prompt.
  • You're now ready to use spotify-tui! 🎉

After you’ve run spt for the first time, you’ll find a configuration file under ~/.config/spotify-tui/client.yml

Connect with spotifyd

Make sure that spotifyd.service is running:

systemctl --user status spotifyd.service

Now, run spt in terminal and select any song
and press ENTER

If Spotify TUI indicates it can't find a device, press 'd', and the CLI will display the available Spotifyd clients. Select the appropriate one by pressing 'Enter'.

Now it should Work.

Image description

Enjoy Listening

use_keyring = true
use_mpris = true
dbus_type = "session"
backend = "alsa" # use portaudio for macOS [homebrew]
device = "alsa_audio_device" # omit for macOS
audio_format = "S16"
control = "alsa_audio_device" # omit for macOS
mixer = "PCM" # omit for macOS
volume_controller = "alsa" # use softvol for macOS
on_song_change_hook = "command_to_run_on_playback_events"
device_name = "spotifyd"
bitrate = 320
cache_path = ""/Users/<your Username>/.cache/spotifyd"
max_cache_size = 1000000000
no_audio_cache = true
initial_volume = "90"
volume_normalisation = true
normalisation_pregain = -10
autoplay = true
zeroconf_port = 1234
proxy = "http://proxy.example.org:8080"
audio_dongle.
device_type = "computer"
Enter fullscreen mode Exit fullscreen mode




Create a systemd user script


~/.config/systemd/user/spotifyd.service:
Enter fullscreen mode Exit fullscreen mode
[Unit]
Description=A spotify playing daemon
Documentation=https://github.com/Spotifyd/spotifyd
Wants=sound.target
After=sound.target
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/bin/spotifyd --no-daemon
Restart=always
RestartSec=12

[Install]
WantedBy=default.target

Enter fullscreen mode Exit fullscreen mode




Then enable and start the script

systemctl --user enable spotifyd --now

Connecting to Spotify API

To connect Spotify-tui to Spotify's API for music playback and track searching, follow these steps:

  • Visit the Spotify dashboard.
  • Create a new app to obtain your Client ID and Client Secret.
  • Edit app settings and add http://localhost:8888/callback as a Redirect URI.
  • Save settings and return to the terminal.
  • Run "spt" and enter your Client ID and Client Secret when prompted.
  • Confirm the default port (8888) or input a custom port.
  • You'll be redirected to Spotify for permission.
  • After approval, the redirect URL is automatically parsed.
  • If the local web server fails, copy the URL from the blank page and paste it into the terminal prompt.
  • You're now ready to use spotify-tui! 🎉

After you’ve run spt for the first time, you’ll find a configuration file under ~/.config/spotify-tui/client.yml

Connect with spotifyd

Make sure that spotifyd.service is running:

systemctl --user status spotifyd.service

Now, run spt in terminal and select any song
and press ENTER

If Spotify TUI indicates it can't find a device, press 'd', and the CLI will display the available Spotifyd clients. Select the appropriate one by pressing 'Enter'.

Now it should Work.

Image description

Enjoy Listening

use_keyring = true
use_mpris = true
dbus_type = "session"
backend = "alsa" # use portaudio for macOS [homebrew]
device = "alsa_audio_device" # omit for macOS
audio_format = "S16"
control = "alsa_audio_device" # omit for macOS
mixer = "PCM" # omit for macOS
volume_controller = "alsa" # use softvol for macOS
on_song_change_hook = "command_to_run_on_playback_events"
device_name = "spotifyd"
bitrate = 320
cache_path = ""/Users/<your Username>/.cache/spotifyd"
max_cache_size = 1000000000
no_audio_cache = true
initial_volume = "90"
volume_normalisation = true
normalisation_pregain = -10
autoplay = true
zeroconf_port = 1234
proxy = "http://proxy.example.org:8080"
audio_dongle.
device_type = "computer"
Enter fullscreen mode Exit fullscreen mode




Create a systemd user script


~/.config/systemd/user/spotifyd.service:
Enter fullscreen mode Exit fullscreen mode
[Unit]
Description=A spotify playing daemon
Documentation=https://github.com/Spotifyd/spotifyd
Wants=sound.target
After=sound.target
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/bin/spotifyd --no-daemon
Restart=always
RestartSec=12

[Install]
WantedBy=default.target

Enter fullscreen mode Exit fullscreen mode




Then enable and start the script

systemctl --user enable spotifyd --now

Connecting to Spotify API

To connect Spotify-tui to Spotify's API for music playback and track searching, follow these steps:

  • Visit the Spotify dashboard.
  • Create a new app to obtain your Client ID and Client Secret.
  • Edit app settings and add http://localhost:8888/callback as a Redirect URI.
  • Save settings and return to the terminal.
  • Run "spt" and enter your Client ID and Client Secret when prompted.
  • Confirm the default port (8888) or input a custom port.
  • You'll be redirected to Spotify for permission.
  • After approval, the redirect URL is automatically parsed.
  • If the local web server fails, copy the URL from the blank page and paste it into the terminal prompt.
  • You're now ready to use spotify-tui! 🎉

After you’ve run spt for the first time, you’ll find a configuration file under ~/.config/spotify-tui/client.yml

Connect with spotifyd

Make sure that spotifyd.service is running:

systemctl --user status spotifyd.service

Now, run spt in terminal and select any song
and press ENTER

If Spotify TUI indicates it can't find a device, press 'd', and the CLI will display the available Spotifyd clients. Select the appropriate one by pressing 'Enter'.

Now it should Work.

Image description

Enjoy Listening

use_keyring = true
use_mpris = true
dbus_type = "session"
backend = "alsa" # use portaudio for macOS [homebrew]
device = "alsa_audio_device" # omit for macOS
audio_format = "S16"
control = "alsa_audio_device" # omit for macOS
mixer = "PCM" # omit for macOS
volume_controller = "alsa" # use softvol for macOS
on_song_change_hook = "command_to_run_on_playback_events"
device_name = "spotifyd"
bitrate = 320
cache_path = ""/Users/<your Username>/.cache/spotifyd"
max_cache_size = 1000000000
no_audio_cache = true
initial_volume = "90"
volume_normalisation = true
normalisation_pregain = -10
autoplay = true
zeroconf_port = 1234
proxy = "http://proxy.example.org:8080"
audio_dongle.
device_type = "computer"
Enter fullscreen mode Exit fullscreen mode




Create a systemd user script


~/.config/systemd/user/spotifyd.service:
Enter fullscreen mode Exit fullscreen mode
[Unit]
Description=A spotify playing daemon
Documentation=https://github.com/Spotifyd/spotifyd
Wants=sound.target
After=sound.target
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/bin/spotifyd --no-daemon
Restart=always
RestartSec=12

[Install]
WantedBy=default.target

Enter fullscreen mode Exit fullscreen mode




Then enable and start the script

systemctl --user enable spotifyd --now

Connecting to Spotify API

To connect Spotify-tui to Spotify's API for music playback and track searching, follow these steps:

  • Visit the Spotify dashboard.
  • Create a new app to obtain your Client ID and Client Secret.
  • Edit app settings and add http://localhost:8888/callback as a Redirect URI.
  • Save settings and return to the terminal.
  • Run "spt" and enter your Client ID and Client Secret when prompted.
  • Confirm the default port (8888) or input a custom port.
  • You'll be redirected to Spotify for permission.
  • After approval, the redirect URL is automatically parsed.
  • If the local web server fails, copy the URL from the blank page and paste it into the terminal prompt.
  • You're now ready to use spotify-tui! 🎉

After you’ve run spt for the first time, you’ll find a configuration file under ~/.config/spotify-tui/client.yml

Connect with spotifyd

Make sure that spotifyd.service is running:

systemctl --user status spotifyd.service

Now, run spt in terminal and select any song
and press ENTER

If Spotify TUI indicates it can't find a device, press 'd', and the CLI will display the available Spotifyd clients. Select the appropriate one by pressing 'Enter'.

Now it should Work.

Image description

Enjoy Listening

use_keyring = true
use_mpris = true
dbus_type = "session"
backend = "alsa" # use portaudio for macOS [homebrew]
device = "alsa_audio_device" # omit for macOS
audio_format = "S16"
control = "alsa_audio_device" # omit for macOS
mixer = "PCM" # omit for macOS
volume_controller = "alsa" # use softvol for macOS
on_song_change_hook = "command_to_run_on_playback_events"
device_name = "spotifyd"
bitrate = 320
cache_path = ""/Users/<your Username>/.cache/spotifyd"
max_cache_size = 1000000000
no_audio_cache = true
initial_volume = "90"
volume_normalisation = true
normalisation_pregain = -10
autoplay = true
zeroconf_port = 1234
proxy = "http://proxy.example.org:8080"
audio_dongle.
device_type = "computer"
Enter fullscreen mode Exit fullscreen mode




Create a systemd user script


~/.config/systemd/user/spotifyd.service:
Enter fullscreen mode Exit fullscreen mode
[Unit]
Description=A spotify playing daemon
Documentation=https://github.com/Spotifyd/spotifyd
Wants=sound.target
After=sound.target
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/bin/spotifyd --no-daemon
Restart=always
RestartSec=12

[Install]
WantedBy=default.target

Enter fullscreen mode Exit fullscreen mode




Then enable and start the script

systemctl --user enable spotifyd --now

Connecting to Spotify API

To connect Spotify-tui to Spotify's API for music playback and track searching, follow these steps:

  • Visit the Spotify dashboard.
  • Create a new app to obtain your Client ID and Client Secret.
  • Edit app settings and add http://localhost:8888/callback as a Redirect URI.
  • Save settings and return to the terminal.
  • Run "spt" and enter your Client ID and Client Secret when prompted.
  • Confirm the default port (8888) or input a custom port.
  • You'll be redirected to Spotify for permission.
  • After approval, the redirect URL is automatically parsed.
  • If the local web server fails, copy the URL from the blank page and paste it into the terminal prompt.
  • You're now ready to use spotify-tui! 🎉

After you’ve run spt for the first time, you’ll find a configuration file under ~/.config/spotify-tui/client.yml

Connect with spotifyd

Make sure that spotifyd.service is running:

systemctl --user status spotifyd.service

Now, run spt in terminal and select any song
and press ENTER

If Spotify TUI indicates it can't find a device, press 'd', and the CLI will display the available Spotifyd clients. Select the appropriate one by pressing 'Enter'.

Now it should Work.

Image description

Enjoy Listening

Top comments (2)

Collapse
 
bekbrace profile image
Bek Brace

Great post, my friend !

Collapse
 
bogusdeck profile image
Bogusdeck

Thanks ✨