diff --git a/ruby/lib/jam_ruby/resque/audiomixer.rb b/ruby/lib/jam_ruby/resque/audiomixer.rb index bb962a733..a8fedade0 100644 --- a/ruby/lib/jam_ruby/resque/audiomixer.rb +++ b/ruby/lib/jam_ruby/resque/audiomixer.rb @@ -57,10 +57,10 @@ module JamRuby filename = file[:filename] if filename.start_with? "http" # fetch it from wherever, put it somewhere on disk, and replace filename in the file parameter with the local disk one - download_filename = Dir::Tmpname.make_tmpname(["#{Dir.tmpdir}audiomixer-file", '.ogg'], nil) + download_filename = Dir::Tmpname.make_tmpname(["#{Dir.tmpdir}/audiomixer-file", '.ogg'], nil) uri = URI(filename) - open download_filename, 'w' do |io| + open download_filename, 'wb' do |io| begin Net::HTTP.start(uri.host, uri.port) do |http| request = Net::HTTP::Get.new uri @@ -103,7 +103,7 @@ module JamRuby # write the manifest object to file, to pass into audiomixer def prepare_manifest - @manifest_file = Dir::Tmpname.make_tmpname( ["#{Dir.tmpdir}audiomixer-manifest-#{@manifest['recording_id']}", '.json'], nil) + @manifest_file = Dir::Tmpname.make_tmpname( ["#{Dir.tmpdir}/audiomixer-manifest-#{@manifest['recording_id']}", '.json'], nil) File.open(@manifest_file,"w") do |f| f.write(@manifest.to_json) end @@ -113,7 +113,7 @@ module JamRuby # make a suitable location to store the output mix, and pass the chosen filepath into the manifest def prepare_output - @output_filename = Dir::Tmpname.make_tmpname( ["#{Dir.tmpdir}audiomixer-output-#{@manifest['recording_id']}", '.ogg'], nil) + @output_filename = Dir::Tmpname.make_tmpname( ["#{Dir.tmpdir}/audiomixer-output-#{@manifest['recording_id']}", '.ogg'], nil) # update manifest so that audiomixer writes here @manifest[:output][:filename] = @output_filename @@ -123,7 +123,7 @@ module JamRuby # make a suitable location to store an output error file, which will be populated on failure to help diagnose problems. def prepare_error_out - @error_out_filename = Dir::Tmpname.make_tmpname( ["#{Dir.tmpdir}audiomixer-error-out-#{@manifest['recording_id']}", '.ogg'], nil) + @error_out_filename = Dir::Tmpname.make_tmpname( ["#{Dir.tmpdir}/audiomixer-error-out-#{@manifest['recording_id']}", '.ogg'], nil) # update manifest so that audiomixer writes here @manifest[:error_out] = @error_out_filename @@ -233,6 +233,7 @@ module JamRuby error_msg = "audiomixer job failed status=#{$?} error_reason=#{error_reason} error_detail=#{error_detail}" @@log.info(error_msg) @error_reason = "unable-find-appmixer" + @error_detail = APP_CONFIG.audiomixer_path raise error_msg end rescue Exception => e diff --git a/web/config/application.rb b/web/config/application.rb index 3fd9a3243..4432bb33a 100644 --- a/web/config/application.rb +++ b/web/config/application.rb @@ -165,5 +165,7 @@ include JamRuby config.ga_suppress_admin = true config.redis_host = "localhost:6379" + + config.audiomixer_path = "/var/lib/audiomixer/audiomixer/audiomixerapp" end end diff --git a/web/config/environment.rb b/web/config/environment.rb index 061a53982..5f59817ee 100644 --- a/web/config/environment.rb +++ b/web/config/environment.rb @@ -5,5 +5,7 @@ Mime::Type.register "audio/ogg", :audio_ogg APP_CONFIG = Rails.application.config +puts APP_CONFIG.audiomixer_path + # Initialize the rails application SampleApp::Application.initialize! diff --git a/web/config/environments/development.rb b/web/config/environments/development.rb index 10b03e52e..6aec3027a 100644 --- a/web/config/environments/development.rb +++ b/web/config/environments/development.rb @@ -1,3 +1,15 @@ + +def audiomixer_workspace_path + if ENV['WORKSPACE'] + dev_path = ENV['WORKSPACE'] + else + dev_path = ENV['HOME'] + '/workspace' + end + + dev_path = "#{dev_path}/audiomixer/audiomixer/audiomixerapp" + dev_path if File.exist? dev_path +end + SampleApp::Application.configure do # Settings specified here will take precedence over those in config/application.rb @@ -58,4 +70,6 @@ SampleApp::Application.configure do config.websocket_gateway_connect_time_stale = 16 config.websocket_gateway_connect_time_expire = 26 + config.audiomixer_path = ENV['AUDIOMIXER_PATH'] || audiomixer_workspace_path || "/var/lib/audiomixer/audiomixer/audiomixerapp" + end