#lastfm #scrobble #music-player #http-client #api-bindings

rustfm-scrobble-proxy

Fork of rustfm-scrobble, a Last.fm Scrobble crate, adding proxy support

3 stable releases

2.0.0 Jul 13, 2023
1.1.3 Nov 16, 2022
1.1.2 Jul 19, 2022

#88 in Multimedia

Download history 84/week @ 2024-04-20 113/week @ 2024-04-27 105/week @ 2024-05-04 94/week @ 2024-05-11 117/week @ 2024-05-18 113/week @ 2024-05-25 114/week @ 2024-06-01 88/week @ 2024-06-08 111/week @ 2024-06-15 103/week @ 2024-06-22 102/week @ 2024-06-29 113/week @ 2024-07-06 90/week @ 2024-07-13 100/week @ 2024-07-20 135/week @ 2024-07-27 123/week @ 2024-08-03

462 downloads per month
Used in rescrobbled

MIT license

61KB
973 lines

rustfm-scrobble-proxy

Latest Version


rustfm-scrobble-proxy is a fork of rustfm-scrobble. Its API is (mostly) identical, but it replaces the internal ureq HTTP client with attohttpc. This allows the library to be used behind a proxy seamlessly, as attohttpc picks up proxy settings automatically, unlike ureq. In addition, scrobbling tracks without an album is now allowed.

To see all changes, see the CHANGELOG.md file. The fork happened in version 1.1.2.

rustfm-scrobble is licensed under the MIT license. See the LICENSE file for more information. Below is the original README.


rustfm-scrobble is a Last.fm Scrobble API 2.0 crate for Rust. It allows easy acccess to the "scrobble" and "now playing" notification endpoints through a simple Rust API. It can be used to record song-plays from music players, build analog scrobbling tools similar to VinylScrobbler or work with IoT Devices. It was initially built to implement a Spotify scrobbling service using the Spotify Connect Protocol when the Alexa Spotify client did not support scrobbling plays to Last.fm.

Features

  • Scrobble songs to Last.fm ('scrobble' API endpoint)
  • Publish now-playing song to Last.fm ('now playing' API endpoint)
  • Batch scrobble support in Scrobbler::scrobble_batch and ScrobbleBatch
  • Multiple authentication flows to gain permissions to publish to Last.fm user profile
    • Store a pre-authenticated session key & throw away secret data after initial authentication
  • Simple error handling; each API operation returns a Result with a simple Error type on failure
  • Unit tested

Install

Add rustfm-scrobble to your Cargo.toml.

[dependencies]
rustfm-scrobble="1.1"

Usage

  • API Documentation
  • Code Examples
    • Example now-playing & scrobbling client
    • Example batch scrobbling client
    • cargo build --examples
    • ./target/debug/examples/example
  • Build: cargo build
  • Run Unit tests: cargo test
extern crate rustfm_scrobble;
use rustfm_scrobble::{Scrobble, Scrobbler};

let username = "last-fm-username";
let password = "last-fm-password";
let api_key = "client-api-key";
let api_secret = "client-api-secret";
 
let mut scrobbler = Scrobbler::new(api_key, api_secret);
scrobbler.authenticate_with_password(username, password);
 
let song = Scrobble::new("Example Artist", "Example Song", "Example Album");
scrobbler.scrobble(song);

In Use

rustfm-scrobble is used in several projects including polaris, connectr, rescrobbled and rb-scrobbler.

Status

The API is stable & backwards compatibility will be guaranteed for all 1.0 releases.

License

MIT license, see ./LICENSE.

Dependencies

~2.5–4MB
~99K SLoC