aboutsummaryrefslogtreecommitdiffstats
path: root/stewardess.rb
blob: 476546c93000bb05789695bba0894dfe005f1c53 (plain)
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
#!/usr/bin/env ruby

# Thanks to:
# https://gist.github.com/225381

require 'rubygems'
require 'sinatra'

require 'json'


post '/blend/:filename' do
  filename = File.join('up', params[:filename])
  datafile = params[:data]
  File.open(filename, 'wb') do |file|
    file.write(datafile[:tempfile].read)
  end

  # Run something like:
  # length = params[:length] # Desired length (in seconds)
  # [console] python src/earworm.py -d #{length} -l #{filename}
  # send_file("*.mp3")
  # [console] rm *.mp3
  
  send_file('up/thefile.jpg')
end