* taking gon to 5.0.1 for now
This commit is contained in:
parent
a732d2a191
commit
52f9bde0a3
|
|
@ -51,7 +51,7 @@ gem 'aasm', '3.0.16'
|
||||||
gem 'postgres-copy', '0.6.0'
|
gem 'postgres-copy', '0.6.0'
|
||||||
gem 'aws-sdk', '1.29.1'
|
gem 'aws-sdk', '1.29.1'
|
||||||
gem 'bugsnag'
|
gem 'bugsnag'
|
||||||
gem 'gon'
|
gem 'gon', '5.0.1' # '5.0.3' has an issue with setting globals in an initializer
|
||||||
gem 'cocoon'
|
gem 'cocoon'
|
||||||
gem 'haml-rails'
|
gem 'haml-rails'
|
||||||
gem 'resque'
|
gem 'resque'
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
= f.inputs name: 'Claimed Recording' do
|
||||||
|
= link_to_remove_association "Delete Claimed Recording", f, class: 'button', style: 'margin-left:10px; position: relative; top: -37px; left: 50px;'
|
||||||
|
%ol.nested-fields
|
||||||
|
|
||||||
|
|
||||||
|
%div{style: 'display:none'}
|
||||||
|
= #f.input :should_retry, :as => :hidden, :input_html => {:value => '0' }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
= f.inputs name: 'Track' do
|
||||||
|
%ol.nested-fields
|
||||||
|
= puts "f.object #{f.object.url}"
|
||||||
|
= f.input :user, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path, :input_html => { id: "jam_ruby_recorded_track_user_id", name: "", id_element: "#WILL_BE_OVERRIDDEN_BY_JS_IN_RECORDED_FORM" }
|
||||||
|
= f.input :user_id, :as => :hidden, :input_html => { class: "jam_ruby_recorded_track[user_id]" }
|
||||||
|
= f.input :instrument, collection: Instrument.all
|
||||||
|
= f.input :sound, :as => :select, collection: options_for_select(RecordedTrack::SOUND, 'stereo')
|
||||||
|
= f.input :url, :as => :file
|
||||||
|
- unless f.object.nil? && f.object.url.nil?
|
||||||
|
%a{href: f.object.sign_url} current file
|
||||||
|
|
||||||
|
= f.input :client_id, as: :hidden
|
||||||
|
= f.input :track_id, as: :hidden
|
||||||
|
= f.input :client_track_id, as: :hidden
|
||||||
|
|
||||||
|
= link_to_remove_association "remove track", f
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
.nested-fields
|
|
||||||
= f.inputs :name => "Track" do
|
|
||||||
= f.input :user, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path
|
|
||||||
= f.input :instrument, :collection => Instrument.all
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE recorded_tracks ALTER COLUMN user_id SET NOT NULL;
|
||||||
|
ALTER TABLE recorded_tracks ALTER COLUMN instrument_id SET NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE recordings ADD COLUMN name varchar(1024);
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
class RecordedTrackUploader < CarrierWave::Uploader::Base
|
||||||
|
# include CarrierWaveDirect::Uploader
|
||||||
|
include CarrierWave::MimeTypes
|
||||||
|
|
||||||
|
process :set_content_type
|
||||||
|
process :add_metadata
|
||||||
|
|
||||||
|
def initialize(*)
|
||||||
|
super
|
||||||
|
JamRuby::UploaderConfiguration.set_aws_private_configuration(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_metadata
|
||||||
|
|
||||||
|
# add this metadata to ogg file without disturbing audio
|
||||||
|
#JamRecordingId=af9f1598-2243-4c21-98c1-5e0c56da5b89
|
||||||
|
#JamTrackId=5b1c3ef4-01d7-471e-8684-e2a5743ffd26
|
||||||
|
#JamClientId=8331bcec-7810-42c1-9f39-a5c129406e85
|
||||||
|
#JamType=LocalTrack
|
||||||
|
|
||||||
|
# secret sauce is -codec copy, and a bunch of -metadata arguments.
|
||||||
|
# after done, stomp input file with new one
|
||||||
|
|
||||||
|
input_file = current_path
|
||||||
|
output_file = current_path + '.new.ogg'
|
||||||
|
ffmpeg_cmd = "#{APP_CONFIG.ffmpeg_path} -i \"#{input_file}\" -codec copy -metadata JamRecordingId=#{model.recording_id} -metadata JamTrackId=#{model.client_track_id} -metadata JamClientId=#{model.client_id} -metadata JamType=LocalTrack \"#{output_file}\""
|
||||||
|
system(ffmpeg_cmd)
|
||||||
|
|
||||||
|
unless $? == 0
|
||||||
|
raise "ffmpeg failed"
|
||||||
|
end
|
||||||
|
|
||||||
|
FileUtils.mv output_file, input_file
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add a white list of extensions which are allowed to be uploaded.
|
||||||
|
def extension_white_list
|
||||||
|
%w(ogg)
|
||||||
|
end
|
||||||
|
|
||||||
|
def store_dir
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def md5
|
||||||
|
@md5 ||= ::Digest::MD5.file(current_path).hexdigest
|
||||||
|
end
|
||||||
|
|
||||||
|
def filename
|
||||||
|
model.filename if model.id
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue