Skip to content

p-mng/goscrobble

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

178 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goscrobble 🎧💿

GitHub Actions Workflow Status GitHub Tag AUR Version Go Report Card

Description

A simple, cross-platform music scrobbler daemon. Inspired by audio software like PulseAudio and PipeWire, it can be configured to connect different sources (e.g., media players) and sinks (e.g., last.fm).

Warning

This project is still beta software. Features may break without warning, scrobbling may be unreliable, and the config file format is subject to change. Use at your own risk.

Note: This README refers to the main branch. To view the README for a specific version, check out the corresponding tagged commit.

Installation

Install script

curl https://raw.githubusercontent.com/p-mng/goscrobble/refs/heads/main/scripts/install.sh | bash

This will install the latest tagged version. Set GOSCROBBLE_VERSION to a branch or tag name to install a specific version (e.g., export GOSCROBBLE_VERSION=main).

On macOS, media-control and terminal-notifier are required:

brew install media-control terminal-notifier

Arch Linux

goscrobble is available on the Arch User Repository. The package also provides a systemd user service that can be enabled with systemctl --user enable goscrobble.service.

Configuration

A configuration file is created automatically in your config directory (usually $HOME/.config/goscrobble/config.toml). See https://toml.io/en/ for TOML syntax.

Example configuration file
# track position update frequency in seconds
poll_rate = 2
# minimum playback duration in seconds
min_playback_duration = 240
# minimum playback percentage
min_playback_percent = 50
# send a desktop notification when a scrobble is saved
notify_on_scrobble = false
# send a desktop notification when a scrobble cannot be saved
notify_on_error = true
# player blacklist
blacklist = ["chromium", "firefox"]

# regex match/replace
[[regexes]]
match = " - [0-9]+ Remaster(ed)?"
replace = ""
artist = false
track = true
album = true

[[regexes]]
match = " - Radio Edit"
replace = " (Radio Edit)"
track = true

# MPRIS2 dbus interface
# https://specifications.freedesktop.org/mpris/latest/
[sources.dbus]
# dbus address: if empty, connect to the session bus
address = ""

# ungive/media-control
# https://github.com/ungive/media-control
[sources.media-control]
# path to the "media-control" binary
command = "media-control"
# media-control arguments, if empty use the following default value
arguments = ["get", "--now"]

[sinks.lastfm.default]
# replace this for sites that support the Audioscrobbler v2.0 API
# if empty, use last.fm API
base_url = "https://ws.audioscrobbler.com/2.0/"
# last.fm API key
key = "replace with last.fm API key"
# last.fm API shared secret
secret = "replace with last.fm API secret"
# last.fm session key, automatically set by "goscrobble lastfm-auth"
session_key = ""
# last.fm username, automatically set by "goscrobble lastfm-auth"
username = ""

[sinks.csv.default]
# filename to write scrobbles to, defaults to $HOME/scrobbles.csv
filename = "/home/username/scrobbles.csv"

[sinks.csv.network]
# you can define sinks multiple times using different keys
# this example defines two CSV sinks: "default" and "network"
filename = "/network/data/scrobbles.csv"

You can blacklist players using Go regular expressions. Players are identified by their D-Bus service name on Linux or the bundle identifier on macOS.

The example above will block org.mpris.MediaPlayer2.chromium.instance10670 and org.mpris.MediaPlayer2.firefox.instance_1_84 on Linux and org.mozilla.firefox on macOS.

Connect last.fm account

  1. Create an API account. Description, callback URL, and application homepage are not required.
  2. Open the config file and insert the newly generated API key and shared secret.
  3. Run goscrobble lastfm-auth, and authenticate the application in your browser.
  4. Return to your terminal and confirm the prompt. The session key and last.fm username will be automatically written to your config file.

Known issues

Double scrobbles when using tidal-hifi

tidal-hifi exposes two MPRIS media players (tidal-hifi and chromium). You should add either tidal-hifi or chromium to your blacklist to prevent double scrobbling.

Similar projects

Packages

 
 
 

Contributors