Merge branch 'develop' into feature/rsvp_slot_conflict

This commit is contained in:
Brian Smith 2014-10-29 20:41:05 -04:00
commit a310c46288
11 changed files with 106 additions and 31 deletions

View File

@ -126,6 +126,8 @@ module JamAdmin
config.twitter_app_secret = ENV['TWITTER_APP_SECRET'] || 'Azcy3QqfzYzn2fsojFPYXcn72yfwa0vG6wWDrZ3KT8'
config.ffmpeg_path = ENV['FFMPEG_PATH'] || (File.exist?('/usr/local/bin/ffmpeg') ? '/usr/local/bin/ffmpeg' : '/usr/bin/ffmpeg')
config.normalize_ogg_path = ENV['NORMALIZE_OGG_PATH'] || (File.exist?('/usr/local/bin/normalize-ogg') ? '/usr/local/bin/normalize-ogg' : '/usr/bin/normalize-ogg')
config.normalize_mp3_path = ENV['NORMALIZE_MP3_PATH'] || (File.exist?('/usr/local/bin/normalize-mp3') ? '/usr/local/bin/normalize-mp3' : '/usr/bin/normalize-mp3')
config.max_audio_downloads = 100

View File

@ -481,6 +481,7 @@ message RecordingMasterMixComplete {
optional string msg = 3;
optional string notification_id = 4;
optional string created_at = 5;
optional string claimed_recording_id = 6;
}
message DownloadAvailable {

View File

@ -27,6 +27,10 @@ module JamRuby
"#{base_url}/findSession"
end
def self.session(session)
"#{base_url}/session/#{session.id}"
end
private
def self.base_url

View File

@ -712,9 +712,10 @@ module JamRuby
)
end
def recording_master_mix_complete(receiver_id, recording_id, band_id, msg, notification_id, created_at)
def recording_master_mix_complete(receiver_id, recording_id, claimed_recording_id, band_id, msg, notification_id, created_at)
recording_master_mix_complete = Jampb::RecordingMasterMixComplete.new(
:recording_id => recording_id,
:claimed_recording_id => claimed_recording_id,
:band_id => band_id,
:msg => msg,
:notification_id => notification_id,

View File

@ -1147,6 +1147,7 @@ module JamRuby
msg = @@message_factory.recording_master_mix_complete(
claimed_recording.user_id,
recording.id,
claimed_recording.id,
notification.band_id,
notification_msg,
notification.id,

View File

@ -322,7 +322,7 @@ module JamRuby
raise "no output ogg file after mix" unless File.exist? @output_ogg_filename
ffmpeg_cmd = "#{APP_CONFIG.ffmpeg_path} -i \"#{@output_ogg_filename}\" -ab 128k -metadata JamRecordingId=#{@manifest[:recording_id]} -metadata JamMixId=#{@mix_id} -metadata JamType=Mix \"#{@output_mp3_filename}\""
ffmpeg_cmd = "#{APP_CONFIG.ffmpeg_path} -i \"#{@output_ogg_filename}\" -ab 192k -metadata JamRecordingId=#{@manifest[:recording_id]} -metadata JamMixId=#{@mix_id} -metadata JamType=Mix \"#{@output_mp3_filename}\""
system(ffmpeg_cmd)
@ -335,6 +335,30 @@ module JamRuby
end
raise "no output mp3 file after conversion" unless File.exist? @output_mp3_filename
# time to normalize both mp3 and ogg files
normalize_ogg_cmd = "#{APP_CONFIG.normalize_ogg_path} --bitrate 128 -i \"#{@output_ogg_filename}\""
system(normalize_ogg_cmd)
unless $? == 0
@error_reason = 'normalize-ogg-failed'
@error_detail = $?.to_s
error_msg = "normalize-ogg failed status=#{$?} error_reason=#{@error_reason} error_detail=#{@error_detail}"
@@log.info(error_msg)
raise error_msg
end
raise "no output ogg file after normalization" unless File.exist? @output_ogg_filename
normalize_mp3_cmd = "#{APP_CONFIG.normalize_mp3_path} --bitrate 128 -i \"#{@output_mp3_filename}\""
system(normalize_mp3_cmd)
unless $? == 0
@error_reason = 'normalize-mp3-failed'
@error_detail = $?.to_s
error_msg = "normalize-mp3 failed status=#{$?} error_reason=#{@error_reason} error_detail=#{@error_detail}"
@@log.info(error_msg)
raise error_msg
end
raise "no output mp3 file after conversion" unless File.exist? @output_mp3_filename
end
def symbolize_keys(obj)

View File

@ -38,6 +38,14 @@ def app_config
ENV['FFMPEG_PATH'] || '/usr/local/bin/ffmpeg'
end
def normalize_ogg_path
ENV['NORMALIZE_OGG_PATH'] || '/usr/local/bin/normalize-ogg'
end
def normalize_mp3_path
ENV['NORMALIZE_MP3_PATH'] || '/usr/local/bin/normalize-mp3'
end
def icecast_reload_cmd
'true' # as in, /bin/true
end

View File

@ -25,6 +25,7 @@
var notificationBatchSize = 20;
var currentNotificationPage = 0;
var didLoadAllNotifications = false, isLoading = false;
var ui = new context.JK.UIHelper(JK.app);
function isNotificationsPanelVisible() {
return $contents.is(':visible')
@ -1120,7 +1121,7 @@
"class": "button-orange",
callback: shareRecording,
callback_args: {
"recording_id": payload.recording_id
"claimed_recording_id": payload.claimed_recording_id
}
}]
);
@ -1128,7 +1129,9 @@
}
function shareRecording(args) {
var recordingId = args.recording_id;
var claimedRecordingId = args.claimed_recording_id;
ui.launchShareDialog(claimedRecordingId, 'recording');
}
function registerBandInvitation() {

View File

@ -18,7 +18,7 @@
<% end %>
<div class="recordings-page">
<% if @claimed_recording.is_public %>
<% if @claimed_recording.is_public || @claimed_recording.recording.has_access?(current_user) %>
<div class="landing-band">
<% unless @claimed_recording.recording.band.blank? %>
<div class="landing-avatar">
@ -97,7 +97,7 @@
<% end %>
</div>
<% if @claimed_recording.is_public %>
<% if @claimed_recording.is_public || @claimed_recording.recording.has_access?(current_user) %>
<% if signed_in? %>
<% unless @claimed_recording.recording.band.nil? %>
<%= render :partial => "shared/landing_sidebar", :locals => {:user => @claimed_recording.recording.band, :recent_history => @claimed_recording.recording.band.recent_history} %>

View File

@ -178,6 +178,8 @@ if defined?(Bundler)
config.audiomixer_path = "/var/lib/audiomixer/audiomixer/audiomixerapp"
config.ffmpeg_path = ENV['FFMPEG_PATH'] || (File.exist?('/usr/local/bin/ffmpeg') ? '/usr/local/bin/ffmpeg' : '/usr/bin/ffmpeg')
config.normalize_ogg_path = ENV['NORMALIZE_OGG_PATH'] || (File.exist?('/usr/local/bin/normalize-ogg') ? '/usr/local/bin/normalize-ogg' : '/usr/bin/normalize-ogg')
config.normalize_mp3_path = ENV['NORMALIZE_MP3_PATH'] || (File.exist?('/usr/local/bin/normalize-mp3') ? '/usr/local/bin/normalize-mp3' : '/usr/bin/normalize-mp3')
# if it looks like linux, use init.d script; otherwise use kill
config.icecast_reload_cmd = ENV['ICECAST_RELOAD_CMD'] || (File.exist?('/usr/local/bin/icecast2') ? "bash -l -c #{Shellwords.escape("sudo /etc/init.d/icecast2 reload")}" : "bash -l -c #{Shellwords.escape("kill -1 `ps -f | grep /usr/local/bin/icecast | grep -v grep | awk \'{print $2}\'`")}")

View File

@ -1,6 +1,6 @@
require 'spec_helper'
describe "Landing", :js => true, :type => :feature, :capybara_feature => true do
describe "Landing" do
let (:user) { FactoryGirl.create(:user) }
@ -10,41 +10,70 @@ describe "Landing", :js => true, :type => :feature, :capybara_feature => true do
Recording.delete_all
end
before(:each) do
MusicSession.delete_all
sign_in_poltergeist(user)
end
let (:claimed_recording) { FactoryGirl.create(:claimed_recording) }
let (:recording) { claimed_recording.recording }
it "should render comments" do
describe "no js required" do
recording = ClaimedRecording.first
comment = "test comment"
timestamp = "less than a minute ago"
url = "/recordings/#{claimed_recording.id}"
visit url
it "shows private recording to someone who was in the session" do
# make the session hidden
claimed_recording.is_public = false
claimed_recording.save!
fill_in "txtRecordingComment", with: comment
find('#btnPostComment').trigger(:click)
visit "/recordings/#{claimed_recording.id}"
# (1) Test a user creating a comment and ensure it displays.
# and verify that after we visit the page, we can see the name of it
find('strong', text: 'RECORDING NOT FOUND')
# comment body
find('div.comment-text', text: comment)
# log in the user who was a part of the session
sign_in(claimed_recording.user)
# timestamp
find('div.comment-timestamp', text: timestamp)
visit "/recordings/#{claimed_recording.id}"
# (2) Test a user visiting a landing page with an existing comment.
# and verify that after we visit the page, we can see the name of it
find('h2', text: claimed_recording.name)
end
end
# re-visit page to reload from database
visit url
# comment body
find('div.comment-text', text: comment)
describe "js required", :js => true, :type => :feature, :capybara_feature => true do
# timestamp
find('div.comment-timestamp', text: timestamp)
before(:each) do
MusicSession.delete_all
sign_in_poltergeist(user)
end
it "should render comments" do
recording = ClaimedRecording.first
comment = "test comment"
timestamp = "less than a minute ago"
url = "/recordings/#{claimed_recording.id}"
visit url
fill_in "txtRecordingComment", with: comment
find('#btnPostComment').trigger(:click)
# (1) Test a user creating a comment and ensure it displays.
# comment body
find('div.comment-text', text: comment)
# timestamp
find('div.comment-timestamp', text: timestamp)
# (2) Test a user visiting a landing page with an existing comment.
# re-visit page to reload from database
visit url
# comment body
find('div.comment-text', text: comment)
# timestamp
find('div.comment-timestamp', text: timestamp)
end
end
end