Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MPRIS music scrobbler daemon

License

NotificationsYou must be signed in to change notification settings

InputUsername/rescrobbled

Repository files navigation

LicenseCrates.ioCI

Rescrobbled is a music scrobbler daemon. It detects active media players running on D-Bus usingMPRIS, automatically updates "now playing" status, and scrobbles songs toLast.fm orListenBrainz-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 binarieshere. The binary can be placed anywhere you like.

Rescrobbled is available oncrates.io:

cargo install rescrobbled

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

There is also anAUR package bybrycied00d, 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 =0player-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.

  • lastfm-key,lastfm-secret

    To use rescrobbled with Last.fm, you'll need a Last.fm API key and secret. These can be obtainedhere.

  • 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. Usingmin-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 likeplayerctl 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

    Thefilter-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 ofits 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 thefilter-script-examples directory.

  • use-track-start-timestamp

    By default, tracks are submitted with a timestamp of the submission time. By settinguse-track-start-timestamp totrue, tracks are instead submitted with the time the track originally started playing. This is currently Last.fm-only.

  • [[listenbrainz]]

    You can specify one or more ListenBrainz instances by repeating this option. Each definition needs at least atoken. You can seturl to use a custom API URL (eg. for use with custom ListenBrainz instances or services likeMaloja). If the URL is not provided, it defaults to the ListenBrainz.org instance.

    If you only want to use ListenBrainz.org, you can set thelistenbrainz-token option as a shorthand instead.

    For ListenBrainz.org, the user token can be foundhere. 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.

Options can also be overridden using environment variables. The following variables are supported:

OptionEnvironment variable
lastfm-key,lastfm-secretLASTFM_KEY,LASTFM_SECRET
listenbrainz-tokenLISTENBRAINZ_TOKEN
min-play-timeMIN_PLAY_TIME
filter-scriptFILTER_SCRIPT
use-track-start-timestampUSE_TRACK_START_TIMESTAMP

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 providedsystemd unit file in the~/.config/systemd/user/ directory.ChangeExecStart 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 thedevelopment branch, so please create pull requests against that.All contributions will be licensed under GPLv3.

License

GPL-3.0, seeLICENSE.

About

MPRIS music scrobbler daemon

Topics

Resources

License

Stars

Watchers

Forks

Contributors9


[8]ページ先頭

©2009-2026 Movatter.jp