Spotify-rs
Easy to use Spotify Local API abstraction library.
What it is
Spotify-rs provides an easy-to-use abstraction over the Spotify Local API.
It is made for fetching information from the local Spotify Client.
You can easily retrieve the currently playing track, the artist who made it,
the album it's from, the version of the Spotify Client, whether the Spotify Client
is online or offline, etc.
What is isn't
Spotify-rs isn't some kind of hack. It just uses Spotify's own local server.
It only allows fetching information from the client and, maybe in the future,
sending stuff back to the client (e.g. make Spotify play a specific track).
Examples
The following is a minimal example to show you what's possible with spotify-rs.
Please note that this example code lacks error checking, it's really only a quick demonstration.
extern crate spotify;
use Spotify;
Example output:
Spotify Client (Version 1.0.42.151.g19de0aa6)
Playing: Rick Astley - Never Gonna Give You Up
For the sake of completeness I also have a complete example for you,
with proper error checking, which does the same as the example above, but safe! :P
I made error handling really easy, all you need to do is match on the error and
provide a few end-user-friendly clues. That's all!
extern crate spotify;
use ;
F.A.Q.
It doesn't connect, what's wrong?
You probably forgot to start Spotify.
Also make sure that the SpotifyWebHelper process is active.
If you can't find SpotifyWebHelper.exe in your process list,
you might have it disabled. Here's how you enable it:
- Open Spotify
- Press
Ctrl+Pto open the preferences - Scroll down and click 'Show advanced settings'
- In the
Startup and Window Behavioursection,
enableAllow Spotify to be opened from the web.
You might wanna restart Spotify after doing that.
That's it! Everything should work now.