/pyspotify

Python bindings for libspotify

Primary LanguagePythonApache License 2.0Apache-2.0

Experimental Windows support

Author of this fork had some (limited) success in running this on Windows, with libspotify.dll. Microsoft Visual Studio 10.0 compiler to build the compiled Python module.

New api.processed.h had to be generated for the build, because on Windows, Spotify wants __stdcall callbacks. cl /EP was used to preprocess api.h, and then empty lines were removed, as well as everything until typedef uint64_t sp_uint64; (included headers and other things).

Also, because of the __stdcalls, ffi_callback_win decorator was introduced in __init__py, that will return ffi.callback decorator but with __stdcall added to the type string. Every callback function definition that was decorated with ffi.callback is now decorated with ffi_callback_win.

To build the native lib, libspotify/api.h has to be somewhere that the compiler can find it, as well as libspotify.lib but named as spotify.lib. Then, when it successfully build, copy libspotify.dll over to the output directory (where the _spotify.pyd is).

pyspotify

pyspotify provides a Python interface to Spotify's online music streaming service.

With pyspotify you can access music metadata, search in Spotify's library of 20+ million tracks, manage your Spotify playlists, and play music from Spotify. All from your own Python applications.

pyspotify uses CFFI to make a pure Python wrapper around the official libspotify library. It works on CPython 2.7 and 3.3+, as well as PyPy 2.6+ and PyPy3 2.5+. It is known to work on Linux and OS X. Windows support should be possible, but is awaiting a contributor with the interest and knowledge to maintain it.

libspotify's deprecation

Note that as of May 2015 libspotify is officially deprecated by Spotify and is no longer actively maintained.

Spotify has published newer libraries intended for Android and iOS development, as well as web APIs to access track metadata and manage playlists. Though, for making apps with Spotify playback capabilities, on any other platform than Android and iOS, there is currently no alternative to libspotify.

libspotify has been the main way of integrating with Spotify since 2009, and is today a part of numerous open source projects and commercial applications, including many receivers and even cars. There's no guarantees, but one can hope that the large deployment of libspotify means that the library will continue to work with the Spotify service for a long time into the future.

Project resources

Latest PyPI version Travis CI build status Test coverage