Scrobbled
Rust bindings for the Last.fm API
Tutorial
Important Prerequisite
To make requests to Last.fm you need an API key and secret, which you can get here.
Once you have these, make sure to set them in scrobbled before making any API requests. To do so:
async
Authentication
Token
To make authenticated requests to Last.fm, a "web service session" is required. To obtain one, we first need an auth token:
let token = get_token.await.unwrap;
println!; // abcde...
This will open a tab in the user's default browser requesting permission to access their Last.fm account. Once they accept, they will be redirected to a page showing the token, which will automatically be received by scrobbled and returned to the caller. Users can close the tab without needing any further action.
Session
Once we have a token, to get a session and start interacting with the API, create a Session:
use Session;
// Get a session token using the (single-use) auth token
let session = new.await.unwrap;
// Ready to go =)