Skip to content

A simple music scrobbler daemon for MPRIS-based music players.

License

Notifications You must be signed in to change notification settings

p-mng/goscrobble

Repository files navigation

goscrobble 🎧💿

GitHub Actions Workflow Status GitHub Tag AUR Version

Description

goscrobble is a simple music scrobbler daemon for MPRIS-based music players (e.g. Spotify or tidal-hifi).

Features

  • simple: human-readable config file using TOML
  • lightweight: command line interface, no GUI, minimal dependencies, fewer lines of code than the alternatives listed below
  • privacy-friendly: no external services required, everything stays on your device (unless you use last.fm)
  • multi-player support: supports scrobbling from multiple players (e.g. YouTube Music and Spotify) at the same time

Configuration

The following configuration file (created automatically in ~/.config/goscrobble/config.toml) can be used to scrobble to last.fm and a local file:

# minimum playback duration in seconds
min_playback_duration = 240
# minimum playback percentage
min_playback_percent = 50
# MPRIS player blacklist
blacklist = [ "chromium", "firefox" ]

# last.fm configuration
[lastfm]
username = "<username>"
password = "<password>"
key = "<API key>"
secret = "<shared secret>"

# local file configuration
[file]
filename = "<file to write scrobbles to>"

You can blacklist one or multiple players using regular expressions. The example above will block both org.mpris.MediaPlayer2.chromium.instance10670 and org.mpris.MediaPlayer2.firefox.instance_1_84.

If you don't want to use one of the two supported providers (lastfm or file), just remove the section from the config file.

Installation

Install using the go toolchain:

go install github.com/p-mng/goscrobble@latest

Install from the Arch User Repository:

git clone https://aur.archlinux.org/goscrobble.git
cd goscrobble
makepkg -crsi

After creating the config file, start the systemd user service using systemctl --user enable --now goscrobble.service. If you installed the package using go directly from git, you might need to update the .service file with your correct binary location (likely ~/go/bin/goscrobble) and copy the service file to ~/.config/systemd/user.

Known issues

Double scrobbles when using tidal-hifi

tidal-hifi exposes two MPRIS media players (tidal-hifi and chromium). Right now, you should add tidal-hifi to your blacklist, as the playlist name is incorrectly reported as the album name (see tidal-hifi issue 505).

Similar projects

I found all of the above to have different issues (e.g. pausing breaks scrobbling or updates to the page layout preventing track detection), so I decided to write my own scrobbler.