Git Product home page Git Product logo

rustfm-scrobble's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.