-
Notifications
You must be signed in to change notification settings - Fork 1
/
retune.rb
46 lines (36 loc) · 879 Bytes
/
retune.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require 'rubygems'
require 'bundler/setup'
require 'sinatra'
require 'json'
require './lib/app_script_adapter'
require './lib/app_poll'
set :itu_app_script, AppScriptAdapter.new
app_poll = AppPoll.new(settings.itu_app_script)
set :itu_poll_thread, app_poll.start_poll
get '/catalog/artists' do
content_type :json
list = settings.itu_app_script.all_artists
list.sort.to_json
end
get '/catalog/show/:artist' do
content_type :json
list = settings.itu_app_script.all_songs_by_artist(params[:artist])
list.to_json
end
post '/queue/add' do
settings.itu_app_script.q_add(params[:song])
end
get '/queue/play' do
settings.itu_app_script.q_play
end
get '/queue/show' do
content_type :json
list = settings.itu_app_script.q_show
list.to_json
end
get '/queue/skip' do
settings.itu_app_script.skip
end
get '/queue/stop' do
settings.itu_app_script.stop
end