Intermediary broker between ListenBrainz/MusicBrainz and Discord RPC
Go to file
Thord Johansson 832832c4d2 Refactor LbzRpcService and add HandleNewListenData method
Refactored the LbzRpcService class to improve code structure and
efficiency. Moved `lastRecording` and `albumArtUrl` fields to class
scope and removed their initialization from the loop.

Enhanced album art URL handling with `TrySetAlbumArtUrl` and
`SetAlbumArtUrl` methods. Prioritized MusicBrainz data and added
fallback to YouTube thumbnails.
2024-10-20 22:18:12 +02:00
.gitignore Initial commit 2024-06-02 17:42:01 +02:00
Program.cs Refactor LbzRpcService and add HandleNewListenData method 2024-10-20 22:18:12 +02:00
README.md Minor formatting edits in README 2024-06-02 17:47:14 +02:00
config.ini.example Initial commit 2024-06-02 17:42:01 +02:00
lbz-rpc.csproj Improvements to album art retrieval 2024-08-12 18:07:38 +02:00
lbz-rpc.sln Initial commit 2024-06-02 17:42:01 +02:00

ListenBrainz-DiscordRPC Broker

This is a simple broker that watches a ListenBrainz now-playing status and sends it to Discord RPC.

NOTE: An account on ListenBrainz will be required to use this broker.

Usage as standalone application

The project can be run directly by simply running dotnet run in the project directory. This will start the broker and begin sending now-playing status to Discord RPC. You can also start the executable directly from the binary output directory; note that a valid configuration file must be present in the same directory as the executable.

NOTE: This project has not been tested on Linux but should work with minimal changes. The Windows service functionality will not work on Linux.

Installation as a Windows Service

Alternatively, this project uses Topshelf to install as a Windows service. To install it, run the following command (as administrator):

lbz-rpc.exe install

To uninstall the service, run the following command:

lbz-rpc.exe uninstall

While installed you can manage the service using Services (services.msc) or the Topshelf command line (lbz-rpc.exe start, lbz-rpc.exe stop, lbz-rpc.exe restart).

Configuration

In a file called config.ini, provide the necessary details:

[general]
discord_token = ###
listenbrainz_username = your_username_here
poll_interval = 10
ignored_sources = jellyfin

Explanation of the fields:

  • discord_token: The token of your Discord application. You can create a new application and get the token from the Discord Developer Portal.
  • listenbrainz_username: Your ListenBrainz username.
  • poll_interval: The interval in seconds at which the broker will poll ListenBrainz for now-playing status.
  • ignored_sources: A comma-separated list of sources to ignore. This is useful if you want to ignore certain sources from being sent to Discord RPC (such as if you're already using jellyfin-rpc and want this to catch everything else).

Scrobbling

This broker does not scrobble tracks to ListenBrainz. If you want to scrobble tracks, here are some suggestions:

  • Web Scrobbler for Firefox - A browser extension that scrobbles tracks from various sources. Recommend configuring to ignore media that is not categorised as music.
  • jellyfin-plugin-listenbrainz - A Jellyfin plugin that scrobbles tracks from Jellyfin to ListenBrainz.

For more suggestions, see the official ListenBrainz website.