ListenBrainz

:information_source: Summary Discourse plugin to show a user’s ListenBrainz listenings in their profile
:hammer_and_wrench: Repository Link https://git.sr.ht/~phw/discourse-listenbrainz
:open_book: Install Guide How to install plugins in Discourse

Features

This Discourse plugin allows users to showcase their recent listenings from ListenBrainz in their user profile. The users can choose to show their most recent listen or general statistics about their ListenBrainz profile.

ListenBrainz is an online service to keep track of music you listen to and provides you with insights into your listening habits and recommendations. The project is completely open-source and publishes all data as open data.

This plugin is currently in use in the MusicBrainz community forums, but it might be interesting for other music related communities as well.

grafik

Configuration

Admin settings

You can configure the ListenBrainz plugin in the Discourse admin interface. The following options are available:

  • listenbrainz enable: Allow users to show their ListenBrainz status in their profiles. Default: enabled.

  • listenbrainz username matches discourse: Enable this if the usernames of the Discourse users usually match their ListenBrainz usernames. The users can still configure a different ListenBrainz username, but it will be pre-filled with their Discourse username. This option is primarily intended to be used on the MetaBrainz community forums. Default: disabled.

  • listenbrainz poster icon: Allow users to show a link to their ListenBrainz profile next to their username in each post. Default: enabled.

  • listenbrainz_onebox_enabled: Enables Onebox support for URLs to ListenBrainz profile pages. Default: enabled.

  • listenbrainz_onebox_range: Statistic time range for ListenBrainz Oneboxes. Default: This month.

User preferences

Each user stays in control whether their ListenBrainz activity gets shown in their profile. The users can configure this in their profile preferences. The following preferences are
available.

  • Show ListenBrainz information in my user profile: When enabled an infobox with details of the user’s ListenBrainz profile will be shown in the user’s user card and user profile. The content of the infobox can be configured with the options below. Default: disabled.

  • ListenBrainz username: The user’s ListenBrainz username. Must be set in order for the ListenBrainz details to show up for the user. If listenbrainz username matches discourse is enabled for the site than this defaults to the Discourse username, otherwise the default is empty.

  • Show a link to my ListenBrainz profile next to my Discourse username: When enabled a link to the user’s ListenBrainz profile is shown next to their username in each post. This option is only available if the site has listenbrainz poster icon enabled. Default: disabled.

  • Display: Configures the content shown in the ListenBrainz infobox. The following options are available:

    • Most recent listen: Show the user’s currently playing track or the most recently played track.

    • User profile statistics: Show general statistics for the user’s ListenBrainz profile, such as listen count, most played track and release cover art of the most played releases.

    • Most recent listen with fallback to user profile statistics: Attempt to show the recent listen, but if none is available fall back to showing the user profile statistics. This is the default setting.

  • Time range: Select the time range for which the user profile statistics get generated. Default: This month.

  • Fallback to larger time range if there are no listens in the selected range: If enabled, the profile statistics view will automatically fall back to a larger time range if you had no listens in the selected time range. E.g. if you have selected “This week” but have no listens recorded in the current week then the statistics will fall back to show “This month”. Default: enabled.

  • Show recent listen not older than: Do not show the user’s last played track if it is older than the given time. Default: 24 hours.

TODO

Please see the official issue tracker for open issue and planned features.

7 Likes

is there something similar that shows on spotify?

Not that I know of. If someone wants to do this, the ListenBrainz might serve as a foundation to build upon.

Is it too difficult to do? Wonder if I can make it?

Sorry, I missed your question here. How difficult this will be depends on how much experience you have with developing web applications and more specifically if you have some experience with the Ember.js and Ruby on Rails frameworks. I personally have a rather broad experience with web development, but had no further experience with Ember.js. So this was often the most time consuming part when developing the plugin, as I had to figure out how to do the things I wanted to do in this framework.

Anyway, the first step would be to set up a local discourse for development and see to get the LB plugin running there. I wrote down my personal notes on what to do at ~phw/discourse-listenbrainz: CONTRIBUTE.md - sourcehut git (but it’s very brief). Once this is working you could start experimenting what happens when you fiddle with parts of the code.

But having said all this I have personally zero interest in doing the Spotify thing. If you want to tackle this and have some questions about how my plugin is structured and working I can assist, but everything related to the Spotify API and how to use it you’d need to get from Spotify’s docs.

1 Like

I’m guessing you have some experience with ListenBrainz since you made this lol, how does it function with last.fm? I personally have never used either but I think the functionality of this plugin is neat, however it sounds like most of my users (or possibly none) use ListenBrainz, but multiple already use last.fm. I looked into it and I see that you can import from lastfm into ListenBrainz, but I’m assuming this isn’t an active connection like how lastfm hooks into spotify. etc (which I’m assuming is the same thing ListenBrainz does?).

Basically do you know if they signed up for ListenBrainz and I installed this plugin if it’s possible to chain Spotify (or whatever)>lastfm>ListenBrainz, and thus this plugin would work? I’m guessing no as it seems more like you can import your lastfm data but it’s not actively monitoring it.

Yes, that. You can repeat the import and it will only import new data. But this is more meant as a mean to migrate from last.fm to ListenBrainz and not for continuous sync.

ListenBrainz can be directly connected with Spotify, though, and will record all the listenings from there.

Apart from that this plugin of course makes mostly sense when users are actually using LB.

It could be quite interesting to have something similar for last.fm or, as suggested above, Spotify. For various reasons I have no interest myself in putting any work into this, but I invite everyone who’s interested to take my plugin as a basis for such a plugin.

I guess so, yes. I’m not one of the developers, but I have done multiple ListenBrainz integrations and also very actively use it myself. Also I have in some way or another worked on multiple MusicBrainz related projects, mainly MusicBrainz Picard.