Spotify Player

Spotify Player is a fast, easy-to-use, and highly configurable terminal music player written in Rust. It aims to provide feature parity with the official Spotify application, offering a minimalist UI with intuitive paging and a popup system.

Features

  • Minimalist UI: Intuitive paging and popup system.
  • Highly configurable: Customize to your needs.
  • Spotify Connect: Control playback remotely.
  • Streaming: Stream songs directly from the terminal.
  • Lyrics: Display lyrics for most songs.
  • Media Control: Cross-platform media control.
  • Image Rendering: Display album art.
  • Notifications: Desktop notifications.
  • Daemon: Run the application as a daemon.
  • CLI Commands: A wide range of commands for controlling Spotify.

Examples

Check out the demo of spotify_player v0.5.0-pre-release on YouTube or on asciicast.

Installation

Requirements

  • A Spotify Premium account is required.

Dependencies

  • Windows and macOS: Requires Rust and cargo.
  • Linux: Requires Rust, cargo, and additional libraries such as openssl, alsa-lib, and libdbus. For Debian-based systems, run:
sudo apt install libssl-dev libasound2-dev libdbus-1-dev

Binaries

Prebuilt binaries can be found on the Releases Page.

Homebrew

Install using Homebrew:

brew install spotify_player

Scoop

Install using Scoop:

scoop install spotify-player

Cargo

Install from crates.io:

cargo install spotify_player

AUR

Install as an AUR package:

yay -S spotify-player

Or install with full feature support:

yay -S spotify-player-full-pipe

Void Linux

Install using xbps:

xbps-install -S spotify-player

FreeBSD

Install from FreeBSD ports:

pkg install spotify-player

Docker

Note: Streaming feature is disabled when using the Docker image. Download the latest build:

docker pull aome510/spotify_player:latest

Run the application

docker run --rm -it aome510/spotify_player:latest

Use local config and cache folders:

docker run --rm -v $APP_CONFIG_FOLDER:/app/config/ -v $APP_CACHE_FOLDER:/app/cache/ -it aome510/spotify_player:latest

Spotify Connect

Enable full Spotify Connect support by registering a Spotify application and specifying the client_id in the general configuration file. Refer to the official Spotify documentation for more details.

Streaming

spotify_player supports streaming using the librespot library. The default audio backend is rodio, but other backends like alsa, pulseaudio, portaudio, jackaudio, sdl, and gstreamer are supported. To install with a specific backend:

cargo install spotify_player --no-default-features --features pulseaudio-backend

Lyrics

Enable lyric support by installing with the lyric-finder feature:

cargo install spotify_player --features lyric-finder

View lyrics of the currently playing track by using the LyricPage command.

Media Control

Enable media control support by setting enable_media_control to true in the configuration file. Media control uses MPRIS DBus on Linux and OS window event listener on Windows and macOS.

Image Rendering

Enable image rendering support by installing with the image feature:

cargo install spotify_player --features image

Supports full resolution images in Kitty or iTerm2 terminals. Sixel rendering is also supported:

cargo install spotify_player --features sixel

Notifications

Enable desktop notification support by installing with the notify feature:

cargo install spotify_player --features notify

Note: Notification support is limited on macOS and Windows compared to Linux.

Mouse Support

Supports seeking to a position of the current playback by left-clicking on the progress bar.

Daemon

Enable daemon support by installing with the daemon feature:

cargo install spotify_player --features daemon

Run the application as a daemon:

spotify_player -d

Note: Daemon feature is not supported on Windows and requires the streaming feature and an audio backend.

CLI Commands

spotify_player offers several CLI commands for interacting with Spotify, such as get, playback, connect, like, authenticate, and playlist. For more details:

spotify_player -h

or

spotify_player {command} -h

Commands

Access the shortcut help page by pressing ? or C-h. Some useful commands include:

  • NextTrack: n
  • PreviousTrack: p
  • ResumePause: space
  • VolumeUp: +
  • VolumeDown: -
  • Mute: _
  • Search: /
  • ShowActionsOnSelectedItem: g a, C-space
  • AddSelectedItemToQueue: Z, C-z
  • SwitchTheme: T
  • SwitchDevice: D

Refer to the configuration documentation for details on adding new shortcuts or modifying the default ones.

Configurations

By default, spotify_player looks for configuration files in $HOME/.config/spotify-player. This can be changed using the -c or --config-folder option.

Caches

spotify_player stores cache files in $HOME/.cache/spotify-player. This can be changed using the -C or --cache-folder option.

Logging

Logs are stored in $APP_CACHE_FOLDER/spotify-player-*.log. Use the RUST_LOG environment variable to define the logging level, defaulting to spotify_player=INFO.

Similar Projects

Rustfinity.com

Links

  1. Home
  2. Learn Rust
  3. Get Started
  4. Practice Rust
  5. Challenges
  6. Tutorials
  7. Blog
  8. Open source
  9. Learn Gleam

Socials

  1. GitHub
  2. X

Legal

  1. Privacy Policy
  2. Terms of Service