2 releases
Uses new Rust 2024
new 0.8.3 | May 2, 2025 |
---|---|
0.8.2 | May 2, 2025 |
#414 in Command line utilities
127 downloads per month
40KB
808 lines
rescrobbled
Rescrobbled-fork is a music scrobbler daemon. It was forked from https://github.com/InputUsername/rescrobbled as the original project was not being actively maintained. 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.
Installation
Rescrobbled-fork is available on crates.io:
cargo install rescrobbled-fork
Alternatively you can install from source using cargo install --path .
from the crate root.
I would appreciate if someone could do a AUR package btw.
Configuration
Rescrobbled-fork 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"
[[listenbrainz]]
url = "Custom API URL"
token = "User token"
All settings are optional.
If the config file doesn't exist, rescrobbled will generate an example config for you when you run it for the first time.
-
lastfm-key
,lastfm-secret
To use rescrobbled with Last.fm, you'll need a Last.fm API key and secret. These can be obtained here.
-
min-play-time
Minimum play time in seconds before a song is scrobbled.
By default, track submission respects Last.fm's recommended behavior: songs should only be scrobbled if they have been playing for at least half their duration, or for 4 minutes, whichever comes first. Using
min-play-time
you can override this. -
player-whitelist
If empty or ommitted, music from all players will be scrobbled; otherwise, rescrobbled will only listen to players in this list.
A CLI application like playerctl can be used to determine a player's name for the whitelist. To do so, start playing a song and run the following command:
playerctl --list-all
-
filter-script
The
filter-script
will be run before updating status and before submitting tracks. It receives the following properties on consecutive lines of its standard input (separated by\n
):- artist;
- song title;
- album name;
- zero or more comma-separated (
,
) genre(s)
The script should write the filtered artist, song title and album name on corresponding lines of its standard output. This can be used to clean up song names, for example removing "remastered" and similar suffixes. If the filter script does not return any output, the current track will be ignored.
A number of example scripts can be found in the
filter-script-examples
directory. -
[[listenbrainz]]
You can specify one or more ListenBrainz instances by repeating this option. Each definition needs at least a
token
. You can seturl
to use a custom API URL (eg. for use with custom ListenBrainz instances or services like Maloja). If the URL is not provided, it defaults to the ListenBrainz.org instance.If you only want to use ListenBrainz.org, you can set the
listenbrainz-token
option as a shorthand instead.For ListenBrainz.org, the user token can be found here. Other services might do this differently, refer to their documentation for more info.
[!NOTE] Due to the way TOML works, the
[[listenbrainz]]
definitions need to be the last thing in your config 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 rescrobbledfork.service
You can run it in the current session using:
systemctl --user start rescrobbledfork.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
.
A lot of the original README was preserved.
Dependencies
~11–19MB
~280K SLoC