Sha256: 792d3e332c08b5b9d1e422381837e360fb1a01148f706b87443e64c99c0b09ba
Contents?: true
Size: 888 Bytes
Versions: 1
Compression:
Stored size: 888 Bytes
Contents
require 'sinatra' require 'json' class Robut::Plugin::Rdio < Robut::Plugin::Base # A simple server to communicate new Rdio sources to the Web # Playback API. The client will update # Robut::Plugin::Rdio::Server.queue with any new sources, and a call # to /queue.json will pull those new sources as a json object. class Server < Sinatra::Base set :root, File.dirname(__FILE__) class << self # A list of items that haven't been fetched by the web playback # API yet. attr_accessor :queue end self.queue = [] # Renders a simple Rdio web player. get '/' do File.read(File.expand_path('public/index.html', File.dirname(__FILE__))) end # Returns the sources that haven't been fetched yet. get '/queue.json' do queue = self.class.queue.dup self.class.queue = [] queue.to_json end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
robut-0.2.0 | lib/robut/plugin/rdio/server.rb |