rescrobbled 0.9.0

MPRIS music scrobbler daemon
rescrobbled-0.9.0 is not a library.

rescrobbled

License Crates.io CI

Rescrobbled is a music scrobbler daemon. It detects active media players running on D-Bus using MPRIS, automatically updates "now playing" status, and scrobbles songs to Last.fm or ListenBrainz-compatible services as they play.

Among other things, due to sharing a Spotify account (I know, I know), I needed a way to scrobble to Last.fm without connecting the Spotify account to my Last.fm account. Rescrobbled offers a simple solution for this.

Installation

You can download one of the prebuilt binaries here. The binary can be placed anywhere you like.

Rescrobbled is available on crates.io:

cargo install rescrobbled

Alternatively you can install from source using cargo install --path . from the crate root.

There is also an AUR package by brycied00d, which should always build the latest version of rescrobbled from this repository.

Configuration

Rescrobbled expects a configuration file at ~/.config/rescrobbled/config.toml with the following format:

lastfm-key = "Last.fm API key"
lastfm-secret = "Last.fm API secret"
min-play-time = 0
player-whitelist = [ "Player MPRIS identity or bus name" ]
filter-script = "path/to/script"
use-track-start-timestamp = false

[[listenbrainz]]
url = "Custom API URL"
token = "User token"

All settings are optional, although rescrobbled isn't very useful without Last.fm or ListenBrainz credentials. ;-)

If the config file doesn't exist, rescrobbled will generate an example config for you when you run it for the first time.

[!NOTE] Due to the way TOML works, the [[listenbrainz]] definitions need to be the last thing in your config file.

Environment variables

Some options can be set using environment variables. The following options are supported:

Option Environment variable
lastfm-key, lastfm-secret LASTFM_KEY, LASTFM_SECRET
listenbrainz-token LISTENBRAINZ_TOKEN
min-play-time MIN_PLAY_TIME
filter-script FILTER_SCRIPT
use-track-start-timestamp USE_TRACK_START_TIMESTAMP

Loading secrets from files

Secrets can alternatively be loaded from files. This is useful for secret managers like agenix. Use the following options for this:

  • lastfm-key-file
  • lastfm-secret-file
  • listenbrainz-token-file
  • [[listenbrainz]] token-file

Usage

To make sure that rescrobbled can scrobble to Last.fm, you need to run the program in a terminal. This will prompt you for your Last.fm username and password, and authenticate with Last.fm. A long-lasting session token is then obtained, which will be used on subsequent runs instead of your username/password. The session token is stored in ~/.config/rescrobbled/session.

If you want to run rescrobbled as a daemon, you can put the provided systemd unit file in the ~/.config/systemd/user/ directory. Change ExecStart to point to the location of the binary, as necessary. Then, to enable the program to run at startup, use:

systemctl --user enable rescrobbled.service

You can run it in the current session using:

systemctl --user start rescrobbled.service

Project resources

Issues and pull requests are more than welcome! Development happens on the development branch, so please create pull requests against that. All contributions will be licensed under GPLv3.

License

GPL-3.0, see LICENSE.