This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Simplest integration of Spotify into Python

Project Description

Pyspotify Utils

This repository attempts to make it as simple as possible to integrate pyspotify.

It’s currently as simple as # pip install pyspotify_helper # python >>> from pyspotify_helper import Spotify >>> spotify_pro_credentials = { “spotify_name”: “”, “spotify_password”: “” } >>> Spotify(spotify_pro_credentials).play(“Stadium Arcadium”, “albums”)

Initialization:

Sadly, that simplicity comes after some initialization.

You need a spotify_appkey.key in your project root directory. You can get this following the tutorial at http://pyspotify.mopidy.com/en/latest/quickstart/#application-keys.

Dependencies:

libspotify pyspotify

Information on installing dependencies at http://pyspotify.mopidy.com/en/latest/installation/.

Usage:

The most important method is play(name, category, shuffle=False). Name is a free-form string that will be searched on Spotify (more info at http://news.spotify.com/us/2008/01/22/searching-spotify/). Category is one of “tracks”, “artists”, or “albums”. Shuffle decides whether or not the music gets shuffled when played.

If no results are found, there will be an error. (IndexError: list index out of range)

The play() method does not block. They return immediately, while a different thread is started to play the music.

There are four methods to control playback: next_track, pause, resume, and pause_toggle.

These methods will cancel the currently playing song when called.

Spotify() returns a singleton. The credentials only need to be passed in the first time you call the function. See the “if __name__ == ‘__main__’:” section.

TODO (As in, questions for you and my future self):

How does searching work with playlists? More specifically, can I easily distinguish between owned playlists and other playlists? What about playlists with the same name?

Release History

Release History

This version
History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyspotify_helper-0.0.1.tar.gz (3.2 kB) Copy SHA256 Checksum SHA256 Source Sep 16, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting