11 releases (7 breaking)

0.8.0 Jul 28, 2024
0.7.0 Feb 12, 2023
0.6.0 Jan 26, 2023
0.5.0 Dec 4, 2022
0.2.0 Jan 20, 2021

#204 in HTTP client

Download history 169/week @ 2024-08-12 114/week @ 2024-08-19 121/week @ 2024-08-26 159/week @ 2024-09-02 95/week @ 2024-09-09 109/week @ 2024-09-16 143/week @ 2024-09-23 125/week @ 2024-09-30 106/week @ 2024-10-07 62/week @ 2024-10-14 2/week @ 2024-10-21 31/week @ 2024-10-28 40/week @ 2024-11-04 13/week @ 2024-11-11 97/week @ 2024-11-18 71/week @ 2024-11-25

222 downloads per month
Used in rescrobbled

MIT license

65KB
1.5K SLoC

listenbrainz

Crate Documentation CI builder License

ListenBrainz API bindings for Rust.

There is also listenbrainz-rust. However, that crate only supports single listens, imports and now playing requests, and is also not maintained anymore. This crate, on the other hand, aims to be a complete API wrapper for the ListenBrainz API, version 1.


lib.rs:

API bindings for ListenBrainz.

This crate aims to be an idiomatic wrapper of the ListenBrainz HTTP API (version 1). It contains functionality for direct access to the API in the [raw] module, as well as a more convenient ListenBrainz client which is easier to use.

Generally, using the raw functionality is more cumbersome, as its types and functions map one-to-one to the HTTP API's JSON input- and response data. Using the ListenBrainz type is therefore recommended.

Example

Submit a currently playing song to ListenBrainz.org:

#
let mut client = ListenBrainz::new();

client.authenticate("LISTENBRAINZ TOKEN")
    .expect("Could not authenticate with ListenBrainz");

client.playing_now("The Beatles", "Here Comes the Sun", Some("Abbey Road"))
    .expect("Could not submit 'playing now' request");

Use a custom API URL, for example to submit songs to Maloja:

#
let mut client = ListenBrainz::new_with_url("http://maloja.example.com/apis/listenbrainz");

client.authenticate("MALOJA API KEY")
    .expect("Could not authenticate with Maloja");

client.listen("Lymbyc Systym", "Split Stones", None)
    .expect("Could not submit listen");

Dependencies

~3–4.5MB
~84K SLoC