1 unstable release

0.7.1 Mar 10, 2024

#6 in #api-url

Download history 167/week @ 2024-03-08 10/week @ 2024-03-15 17/week @ 2024-03-22 55/week @ 2024-03-29 52/week @ 2024-04-05

138 downloads per month

MIT license

47KB
925 lines

DO NOT USE THIS

use https://github.com/InputUsername/listenbrainz-rs instead

This is just a temporary fork with some merged pull requests to allow some upstream packages to get uploaded.


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

~2.9–4MB
~109K SLoC