/spotxm

Pulling "now playing" data from Sirius XM

Primary LanguageRuby

SpotXM

An app to pull the now-playing data from Sirius XM and provide Spotify links for the songs. It uses a Postgres database with Sphinx for searching.

To regularly (every 2 minutes) pull the Sirius XM timestamp, there's a Sidekiq (which is backed by Redis) worker that is run by Clockwork. This worker gets the current playlist and saves it to the database, then rebuilds the search indices if needed. So, to run the app, you need to:

  1. Start Solr
  2. Start Redis
  3. Start Sidekiq
  4. Start Clockwork

Instructions on each are below.

Solr and Sunspot

To start Solr:

bundle exec rake sunspot:solr:start

...and to stop it (obviously):

bundle exec rake sunspot:solr:stop

To reindex all object (only needed if you changes to an object's 'searchable' schema):

bundle exec rake sunspot:solr:reindex

Redis

To launch Redis (after installing it with Homebrew)

redis-server /usr/local/etc/redis.conf

Sidekiq

To start Sidekiq

bundle exec sidekiq

To flush the Sidekiq queue (from rails console on Heroku):

Heroku run rails console

Sidekiq.redis {|r| r.flushall }

Clockwork

To start clockwork

clockwork lib/clockwork.rb

Development Notes

Outstanding Issues / To Dos

  • Why does most recent sometimes come up blank?

Add Sidekiq interface so you can check the queue, make sure workers are stacking up.

Confirm that workers are failing quietly and not hammering the Sirius XM servers.

Add time-specific searching for tracks

Sometimes most_recent tracks comes up blank.

Refactor lots of the view stuff into partials (like the track listing)

jbuilder? memcache?

Google analytics

Make tables sortable