No description or website provided.
JavaScript Ruby CoffeeScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bin
lib
public
views
.gitignore
Gemfile
Gemfile.lock
Guardfile
config.ru
license.txt
readme.md

readme.md

Spotification

A rudimentary remote jukebox for spotify or rdio (for mac os x only).

Installation

Install ruby 1.9.3 and bundler

Clone this repository:

git clone http://github.com/markryall/spotification.git
cd spotification

Install prerequisites:

bundle

Running

There are two processes: the web server process and the player.

The web server allows remote users to search rdio/spotify for tracks (using the their web api), enqueue tracks/albums, control volume and skip tracks. If configured, the web server can also show the recently played tracks for a given user on lastfm (using the lastfm api).

The player monitors the spotify/rdio mac os x applications and the queue (using applescript - hence the mac os x restriction). When spotify/rdio has stopped playing, the player will tell it to start playing the next track in the queue. Note that this queue has nothing to do with the spotify/rdio queue (it is a directory containing a file for each queued track).

So in one terminal session:

rackup

This starts a sinatra application running (on port 9292 by default).

In another terminal session:

./bin/spotification_player

Configuration for spotify

The spotify web services return all results regardless of whether they are available in the country associated with your account. Set the SPOTIFY_TERRITORY to the code associated with your country (AU for australia).

Configuration for rdio

Configuration of the rdio services are more complicated because you need to authenticate to use them. Firstly you need to create an account to get api access: http://developer.rdio.com

Set the environment variables RDIO_CONSUMER_KEY and RDIO_CONSUMER_SECRET according to the values for your application account.

Now in an irb session

require 'rdio'
rdio = Rdio.new [ENV['RDIO_CONSUMER_KEY'], ENV['RDIO_CONSUMER_SECRET']]
p rdio.begin_authentication 'oob'
# browse to the url and authorise your application to access your rdio account
p rdio.complete_authentication '<the code from the site>'

Now set the RDIO_CLIENT_KEY and RDIO_CLIENT_SECRET environment variables from the return values.

You also need to set the SPOTIFICATION_MODE environment variable to rdio (default behaviour is to use spotify).

So easy!

Usage

There's really not much too this:

Browse to http://localhost:9292 on a desktop or http://localhost:9292/mobile from a mobile device.

last.fm

In case you (like me) have configured spotify/rdio to scrobble anything you play to lastfm then you can use this to show recently played tracks (played using spotify, rdio or anything else).

For some unknown reason, lastfm requires an application id to read the recently played tracks for a given user. To use the '/lastfm' route you will need to create a lastfm application with your lastfm account and set the LASTFM_API_KEY and LAST_FM_USER environment variables.

Future Plans

  • add lastfm to mobile interface
  • make rdio configuration more straigthforward
  • replace desktop web interface with a single page
  • perhaps introduce ember, angular or something to simplify javascript