MCPcopy Index your code
hub / github.com/dmfutcher/rustfm-scrobble

github.com/dmfutcher/rustfm-scrobble @v1.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.1 ↗ · + Follow
87 symbols 199 edges 7 files 19 documented · 22% updated 4y agov1.1.1 · 2021-01-13★ 382 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

rustfm-scrobble

Latest Version Rust

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.

Core symbols most depended-on inside this repo

set_session_key
called by 9
src/auth.rs
get_auth_request_params
called by 9
src/auth.rs
api_request
called by 7
src/client.rs
set_user_credentials
called by 6
src/client.rs
send_authenticated_request
called by 5
src/client.rs
authenticate_with_token
called by 4
src/scrobbler.rs
as_map
called by 4
src/models.rs
send_batch_scrobbles
called by 4
src/client.rs

Shape

Method 46
Function 22
Class 17
Enum 2

Languages

Rust100%

Modules by API surface

src/models.rs24 symbols
src/client.rs22 symbols
src/auth.rs22 symbols
src/scrobbler.rs14 symbols
src/error.rs4 symbols
examples/example.rs1 symbols

For agents

$ claude mcp add rustfm-scrobble \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page