Skip to content

iamdb/hifi.rs

Repository files navigation

hifi.rs

A terminal-based (tui), high resolution audio player backed by Qobuz

Powered by Qobuz. Requires a paid subscription. This does not allow you to listen for free.

Qobuz only supports Linux through the browser and has no officially supported API. There are ways of accessing Qobuz in Linux outside of the browser through third-party applications like Squeezelite and Roon. These apps are great, but I wanted something simpler that just focused on being able to quickly find and play an album inside the console.

TUI Screenshot

Player Features

  • Low resource usage
  • GStreamer-backed player, SQLite database
  • High resolution audio: Supports up to 24bit/192Khz (max quality Qobuz offers)
  • MPRIS support (control via playerctl or other D-Bus client)
  • Gapless playback
  • Resume last session
  • Optional Web UI with WebSocket API

In addition to the player, there is a Spotify to Qobuz playlist sync tool and an incomplete Rust library for the Qobuz API.

Requirements

  • GStreamer v1.18+ (comes with most/all current Linux and MacOS versions)
  • Just (optional, useful for building and development)

Installation

Download Release

Download the tar.gz file for your supported OS from the releases page, extract the file and execute hifi-rs or copy it to the your $PATH.

Build from source

To make building Linux versions from source simpler, there is a Dockerfile.x86_64 and Dockerfile.aarch64 to compile the project for Linux x86 and arm64 into a container. After building the image, the file can be extracted to the local disk.

Run just docker-build-linux <x86_64 or aarch64> to automate this.

On MacOS, Debian, Arch and Fedora, just build-player should make a reasonable effort to install the necessary dependencies needed to build the app and then build it.

Get started

Run hifi-rs --help or hifi-rs <subcommand> --help to see all available options.

To get started:

hifi-rs config username # enter username at prompt
hifi-rs config password # enter password at prompt
hifi-rs config default-quality <quality> # mp3, cd, hifi96 or hifi192

# play from the command line
hifi-rs play --url <Qobuz Album, Playlist or Track URL>

# open player
hifi-rs open

# open player with web ui
hifi-rs --web open

TUI Controls

The TUI has full mouse support.

Keyboard Shortcuts

Command Key(s)
Now Playing 1
My Playlists 2
Search 3
Enter URL 3
Cycle elements tab
Play/Pause space
Next track N
Previous track P
Jump forward l
Jump backward h
Quit ctrl + c
Move up in list up arrow
Move down in list down arrow
Select item in list enter
Dismiss popup esc

Web UI and WebSocket API

"WebUI Desktop Screenshot"

The player can start an embedded web interface along with a websocket API. As this is a potential attack vector, the server is disabled by default and must be started with the --web argument. It also listens on 0.0.0.0:9888 by default, but an inteface can be specified with the --interface argument.

Go to http://<ip>:9888 to view the UI. The WebSocket API can be found at ws://<ip>:9888/ws.

There is no security on the WebSocket API, however it will reject any messages that cannot be parsed into a player action and it only interacts with the player. There is no reading or writing to the file system by the serve. All files are served from within the binary.

For any new clients, the server will send a stream of messages that bootstrap the active state of the player.

API Controls

To control the player through the WebSocket API, send it a message with the required action.

Example payloads:

Play:

{ "play": null }

Pause:

{ "pause": null }

Skip To Track:

{ "skipTo": { "num": "<track index>"} }

For more options, see the Action enum.