Skip to content
Minimalistic user daemon which submits the currently playing song to listenbrainz.org, libre.fm and compatible services.
Branch: master
Clone or download
mariusor Merge pull request #57 from jwflory/change/readme-article
README: Add link to Fedora Magazine article
Latest commit c05ae68 Apr 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.builds Try again for tests Apr 13, 2019
doc
src Use grrr strings in places Apr 13, 2019
tests Fix ini reader test Apr 13, 2019
units Add XDG_RUNTIME_DIR to Environment= for mpris-scrobbler.service May 25, 2018
.gitignore Added a basic manual ini parser to remove dependency on ragel May 12, 2018
.gitmodules Add unit tests for string array functions based on mortie/snow Apr 16, 2018
.travis.yml Revert "Update to meson version" Mar 4, 2019
LICENSE
README.md README: Add link to Fedora Magazine article Apr 22, 2019
meson.build
meson_options.txt

README.md

mpris-scrobbler

Wants to be a minimalistic user daemon which submits the currently playing song to libre.fm and compatible services. To retrieve song information it uses the MPRIS DBus interface, so it works with any media player that exposes this interface.

MIT Licensed Build status Coverity Scan status Latest build AUR package Codacy Badge

In order to compile the application you must have a valid development environment containing pkg-config, a compiler - known to work are clang>=5.0 or gcc>=7.0 - and the build system meson plus ninja.

The compile time dependencies are: libevent, dbus-1.0, libcurl, json-c and their development equivalent packages.

Getting the source

You can clone the git repository or download the latest release from here.

$ git clone git@github.com:mariusor/mpris-scrobbler.git
$ cd mpris-scrobbler

Installing

CentOS, RHEL

mpris-scrobbler is available for CentOS and RHEL 7 or later via the EPEL repository. Run the following commands to install it:

$ sudo yum install epel-release
$ sudo yum install mpris-scrobbler

Fedora

mpris-scrobbler is available since Fedora 28. Run the following command to install it:

$ sudo dnf install mpris-scrobbler

Mageia, openSUSE

mpris-scrobbler is available for Mageia, openSUSE, and other RPM distributions via the COPR repository. First, install the correct repository for your operating system from COPR. Then, install the mpris-scrobbler package with your package manager of choice.

Ubuntu 18.04

Install the dependencies:

sudo apt install libevent-2.1-6 libevent-dev libdbus-1-dev dbus dbus-user-session libcurl4 libcurl4-openssl-dev libjson-c-dev libjson-c3 meson

D-bus will need to be restarted:

systemctl --user restart dbus.service

Compile from source

To compile the scrobbler manually, you need to already have installed the dependencies mentioned above. By default the prefix for the installation is /usr.

$ meson build/

$ ninja -C build/

$ sudo ninja -C build/ install

Usage

The scrobbler is comprised of two binaries: the daemon and the signon helper.

The daemon is meant run as a user systemd service which listens for any signals coming from your MPRIS enabled media player. To have it start when you login, please execute the following command:

$ systemctl --user enable --now mpris-scrobbler.service

If the command above didn't start the service, you can do it manually:

$ systemctl --user start mpris-scrobbler.service

It can submit the tracks being played to the last.fm and libre.fm services, and to listenbrainz.org.

At first nothing will get submitted as you need to enable one or more of the available services and also generate a valid API session for your account.

The valid services that mpris-scrobbler knows are: librefm, lastfm and listenbrainz.

Enabling a service

Enabling a service is done automatically once you obtain a valid token/session for it. See the authentication section.

You can however disable submitting tracks to a service by invoking:

$ mpris-scrobbler-signon disable <service>

If you want to re-enable a service which you previously disabled you can call, without the need to re-authenticate:

$ mpris-scrobbler-signon enable <service>

Authenticate to the service

ListenBrainz

Because ListenBrainz doesn't have yet support for OAuth authentication, the credentials must be added manually using the signon binary. First you need to get the user token from your ListenBrainz profile page. Then you call the following command and type or paste the token, then press Enter:

$ mpris-scrobbler-signon token listenbrainz
Token for listenbrainz.org:
Audioscrobbler compatible

Libre.fm and Last.fm are using the same API for authentication and currently this is the mechanism:

Use the signon binary in the following sequence:

$ mpris-scrobbler-signon token <service>

$ mpris-scrobbler-signon session <service>

The valid service labels are: librefm and lastfm.

The first step opens a browser window -- for this to work your system requires xdg-open binary -- which asks you to login to last.fm or libre.fm and then approve access for the mpris-scrobbler application.

After granting permission to the application from the browser, you execute the second command to create a valid API session and complete the process.

The daemon loads the new generated credentials automatically and you don't need to do it manually.

The authentication for the libre.fm and listenbrainz.org services supports custom URLs that can be passed to the signon binary using the --url argument.

$ mpris-scrobbler-signon --url http://127.0.0.1:8080 token [listenbrainz|librefm]

For the moment we don't support multiple entries for the same API. Ex, have a local instance for the ListenBrainz API and use the official one at the same time.

Resources

Check out the following articles and resources about mpris-scrobbler:

You can’t perform that action at this time.