Spotify-rs
Easy to use Spotify Local API abstraction library.
What can I do with it
Spotify-rs provides an easy-to-use abstraction over the Spotify Local API.
It is made for communicating with the local Spotify client in a straightforward way.
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.
Since version 0.4.0, spotify-rs supports asynchronous polling, so now
you can just register a callback, sit back and watch your application deliver
live information about the track you're currently playing, the current volume,
or, really, anything else supported by the Spotify Local API.
Since version 0.5.0, spotify-rs can queue and play songs on the local Spotify client!
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
Of course I also have a complete example for you,
with proper error checking and long polling! :P
extern crate spotify;
use ;
Example output:
Spotify Client (Version 1.0.42.151.g19de0aa6)
Now playing: Tim Minchin - White Wine In The Sun
Volume: 100%
Now playing: Tim Minchin - Encore
Volume: 50%
Volume: 76%
Now playing: Tim Minchin - Ready For This ?
Volume: 100%
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
+P
to open the preferences - Scroll down and click 'Show advanced settings'
- In the
Startup and Window Behaviour
section,
enableAllow Spotify to be opened from the web
.
You might wanna restart Spotify after doing that.
That's it! Everything should work now.