lib/robut/plugin/rdio/server.rb in robut-0.2.0 vs lib/robut/plugin/rdio/server.rb in robut-0.2.1
- old
+ new
@@ -13,15 +13,37 @@
class << self
# A list of items that haven't been fetched by the web playback
# API yet.
attr_accessor :queue
+
+ # The playback token for +domain+. If you're accessing Rdio over
+ # localhost, you shouldn't need to change this. Otherwise,
+ # download the rdio-python plugin:
+ #
+ # https://github.com/rdio/rdio-python
+ #
+ # and generate a new token for your domain:
+ #
+ # ./rdio-call --consumer-key=YOUR_CONSUMER_KEY --consumer-secret=YOUR_CONSUMER_SECRET getPlaybackToken domain=YOUR_DOMAIN
+ attr_accessor :token
+
+ # The domain associated with +token+. Defaults to localhost.
+ attr_accessor :domain
end
self.queue = []
# Renders a simple Rdio web player.
get '/' do
File.read(File.expand_path('public/index.html', File.dirname(__FILE__)))
+ end
+
+ get '/js/vars.js' do
+ content_type 'text/javascript'
+ <<END
+var rdio_token = '#{self.class.token}';
+var rdio_domain = '#{self.class.domain}';
+END
end
# Returns the sources that haven't been fetched yet.
get '/queue.json' do
queue = self.class.queue.dup