#api #lastfm #last-fm #scrobble

rustfm-scrobble

Last.fm Scrobble crate for Rust

12 releases (1 stable)

✓ Uses Rust 2018 edition

1.0.0 Oct 31, 2019
0.9.2 Apr 26, 2019
0.9.1 Nov 20, 2017
0.2.0 Mar 4, 2017

#14 in Multimedia

Download history 14/week @ 2019-08-01 12/week @ 2019-08-08 1/week @ 2019-08-15 206/week @ 2019-08-22 79/week @ 2019-08-29 47/week @ 2019-09-05 30/week @ 2019-09-12 86/week @ 2019-09-19 174/week @ 2019-09-26 14/week @ 2019-10-03 13/week @ 2019-10-10 88/week @ 2019-10-17 62/week @ 2019-10-24

273 downloads per month
Used in 1 crate

MIT license

58KB
943 lines

rustfm-scrobble

Latest Version Build Status

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
  • Very simple error handling; each API operation returns a Result with a simple Error type on failure
  • Unit test suite

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
  • Cargo.toml: rustfm-scrobble="1.0"
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);

Status

Version 1.0 has been released. The API is stable & backwards compatability will be guaranteed for all 1.0 releases.

License

MIT license, see ./LICENSE.

Dependencies

~15MB
~371K SLoC