Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

193 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goscrobble 🎧💿

GitHub Actions Workflow Status GitHub Tag AUR Version

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).

goscrobble diagram

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

Manual Installation

  1. Install the binary using go install github.com/p-mng/goscrobble@latest.
  2. Install the service file (goscrobble.service if on Linux1, io.github.p-mng.goscrobble.plist if on macOS2); replace $GOSCROBBLE_PATH with the binary location from the previous step.
  3. If on macOS, install media-control and terminal-notifier.
  4. Enable and start the service/launch agent.

1) Documentation for systemd/Linux: https://wiki.archlinux.org/title/Systemd/User#Basic_setup

2) Documentation for launchd/macOS: https://support.apple.com/guide/terminal/script-management-with-launchd-apdc6c1077b-5d5d-4d35-9c19-60f2397b2369/mac

Arch Linux

goscrobble is available on the Arch User Repository. The package also provides the 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 = ""

# 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"]

# https://github.com/Mastermindzh/tidal-hifi
# TIDAL Hi-Fi JSON API
[sources.tidal-hifi]
# endpoint to fetch data from
endpoint = "http://localhost:47836/current"

[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

About

A simple, cross-platform music scrobbler daemon.

Topics

Resources

Contributing

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages