Giter Site home page Giter Site logo

spotify-api-server's Introduction

spotify-api-server

Implementation of parts of the Spotify playlist API (mirror).

Hopefully this will allow for more services around Spotify as it makes editing playlists much easier than using libspotify.

It's a web server (listens at port 1337 by default) that talks to Spotify using libspotify. JSON is assumed as input and output.

spotify-api-server is an experiment with C, libspotify, evented I/O (libevent) and GPL.

Supported API methods

Playlists

GET /user/{username}/playlists -> {playlists:[<playlist>]}
GET /user/{username}/starred -> <playlist>

GET /playlist/{uri} -> <playlist>
GET /playlist/{uri}/collaborative -> {collaborative:<boolean>}
GET /playlist/{uri}/subscribers -> [<string>]

POST /playlist <- {title:<string>} -> <playlist>
POST /playlist/{uri}/add?index <- [<track URI>] -> <playlist>
POST /playlist/{uri}/remove?index&count -> <playlist>
POST /playlist/{uri}/collaborative?enabled=<boolean> -> <playlist>
POST /playlist/{uri}/patch <- [<track URI>] -> <playlist>

DELETE /playlist/{uri}/delete -> <playlist>

patch replaces all tracks in a playlist with as few adds and removes as possible by first performing a diff between the playlist and the new tracks and then applying the changes.

URIs need to be in their fully qualified form, e.g. spotify:user:%ce%bb:playlist:0PkJWxqU7Xt0fbvgVlJlkU (user part is optional) and spotify:track:1XlDNpWy8dyEljyRd0RC2J.

Inboxes

POST /user/{username}/inbox <- {message:<string>, tracks:[<track URI>]}

message is optional.

How to build

  1. Make sure you have the required libraries:
  1. Run make.

How to run

Necessary requirements:

  • A Spotify premium account.
  • An application key file in binary format. Get it from Spotify.

Start the server:

./server --application-key <path to appkey> --username <username> --password <password>`

Read the source for more command line arguments, like setting the cache location (-C), which port to listen on (-P).

Using credentials to log in

First get a credentials file from Spotify

./server -A spotify_appkey.key -u username -p password -k .credentials

Then start the server using the contents of the credentials file

cat .credentials | xargs ./server -A spotify_appkey.key -u username -c

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.