Deno library and CLI to access the ListenBrainz API
MIT License
TypeScript library to access the ListenBrainz API.
You can use it to submit your listening history to your ListenBrainz account with your own apps.
For end users, there is also the elbisaur CLI, which exposes many features of the library to the command line. In addition to showcasing the usage of the API client, it also has advanced features to manage listens.
GET
and POST
methods for (yet) unsupported API endpointsAs this library only makes use of web standards, it is also compatible with modern browsers (after transpilation to JavaScript).
In order to submit listens, you have to specify a user token which you can obtain from your ListenBrainz settings page.
The following example instantiates a ListenBrainz client with a token from an environment variable and submits a playing now notification for a track:
import { ListenBrainzClient } from "@kellnerd/listenbrainz";
const client = new ListenBrainzClient({ userToken: Deno.env.get("LB_TOKEN") });
await client.playingNow({ artist_name: "John Doe", track_name: "Love Song" });
All listen parsers accept text input and generate Listen
objects as their output.
These objects can then be used together with the ListenBrainz API and the LB client.
None of the parsers performs any filtering of listens, so you have to detect potential duplicates and skipped listens yourself.
The parsers do not include any logic to access files to make them platform independent. You can pass them the content from a HTTP response body or from a file, for example.
The following parsers are available in the listenbrainz/parser/*
submodules:
Listen
object (as shown by the LB “Inspect listen” dialog) or an array of Listen
objects (format of a LB listening history export) as input.Listen
objects, separated by line breaks.AUDIOSCROBBLER/1.1
header which are generated by players with Rockbox firmware, possibly also by others.track_metadata.additional_info.skipped = true
.track_metadata.additional_info
attributes skipped
, reason_end
and a too short duration_ms
.elbisaur
is a CLI which can be used to submit and manage listens. Learn more.