* VRFS-2432 notify when stream mix is done
This commit is contained in:
parent
1327229048
commit
ace7ac15c8
|
|
@ -53,6 +53,7 @@ message ClientMessage {
|
||||||
RECORDING_ENDED = 215;
|
RECORDING_ENDED = 215;
|
||||||
RECORDING_MASTER_MIX_COMPLETE = 220;
|
RECORDING_MASTER_MIX_COMPLETE = 220;
|
||||||
DOWNLOAD_AVAILABLE = 221;
|
DOWNLOAD_AVAILABLE = 221;
|
||||||
|
RECORDING_STREAM_MIX_COMPLETE = 222;
|
||||||
|
|
||||||
// band notifications
|
// band notifications
|
||||||
BAND_INVITATION = 225;
|
BAND_INVITATION = 225;
|
||||||
|
|
@ -151,7 +152,8 @@ message ClientMessage {
|
||||||
optional RecordingEnded recording_ended = 215;
|
optional RecordingEnded recording_ended = 215;
|
||||||
optional RecordingMasterMixComplete recording_master_mix_complete = 220;
|
optional RecordingMasterMixComplete recording_master_mix_complete = 220;
|
||||||
optional DownloadAvailable download_available = 221;
|
optional DownloadAvailable download_available = 221;
|
||||||
|
optional RecordingStreamMixComplete recording_stream_mix_complete = 222;
|
||||||
|
|
||||||
// band notifications
|
// band notifications
|
||||||
optional BandInvitation band_invitation = 225;
|
optional BandInvitation band_invitation = 225;
|
||||||
optional BandInvitationAccepted band_invitation_accepted = 230;
|
optional BandInvitationAccepted band_invitation_accepted = 230;
|
||||||
|
|
@ -484,6 +486,15 @@ message RecordingMasterMixComplete {
|
||||||
optional string claimed_recording_id = 6;
|
optional string claimed_recording_id = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message RecordingStreamMixComplete {
|
||||||
|
optional string recording_id = 1;
|
||||||
|
optional string band_id = 2;
|
||||||
|
optional string msg = 3;
|
||||||
|
optional string notification_id = 4;
|
||||||
|
optional string created_at = 5;
|
||||||
|
optional string claimed_recording_id = 6;
|
||||||
|
}
|
||||||
|
|
||||||
message DownloadAvailable {
|
message DownloadAvailable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ module NotificationTypes
|
||||||
RECORDING_STARTED = "RECORDING_STARTED"
|
RECORDING_STARTED = "RECORDING_STARTED"
|
||||||
RECORDING_ENDED = "RECORDING_ENDED"
|
RECORDING_ENDED = "RECORDING_ENDED"
|
||||||
RECORDING_MASTER_MIX_COMPLETE = "RECORDING_MASTER_MIX_COMPLETE"
|
RECORDING_MASTER_MIX_COMPLETE = "RECORDING_MASTER_MIX_COMPLETE"
|
||||||
|
RECORDING_STREAM_MIX_COMPLETE = "RECORDING_STREAM_MIX_COMPLETE"
|
||||||
|
|
||||||
# band notifications
|
# band notifications
|
||||||
BAND_INVITATION = "BAND_INVITATION"
|
BAND_INVITATION = "BAND_INVITATION"
|
||||||
|
|
@ -44,4 +45,5 @@ module NotificationTypes
|
||||||
# general purpose text message
|
# general purpose text message
|
||||||
TEXT_MESSAGE = "TEXT_MESSAGE"
|
TEXT_MESSAGE = "TEXT_MESSAGE"
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
@ -729,6 +729,23 @@ module JamRuby
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def recording_stream_mix_complete(receiver_id, recording_id, claimed_recording_id, band_id, msg, notification_id, created_at)
|
||||||
|
recording_stream_mix_complete = Jampb::RecordingStreamMixComplete.new(
|
||||||
|
:recording_id => recording_id,
|
||||||
|
:claimed_recording_id => claimed_recording_id,
|
||||||
|
:band_id => band_id,
|
||||||
|
:msg => msg,
|
||||||
|
:notification_id => notification_id,
|
||||||
|
:created_at => created_at
|
||||||
|
)
|
||||||
|
|
||||||
|
Jampb::ClientMessage.new(
|
||||||
|
:type => ClientMessage::Type::RECORDING_STREAM_MIX_COMPLETE,
|
||||||
|
:route_to => USER_TARGET_PREFIX + receiver_id,
|
||||||
|
:recording_stream_mix_complete => recording_stream_mix_complete
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
def client_update(product, version, uri, size)
|
def client_update(product, version, uri, size)
|
||||||
client_update = Jampb::ClientUpdate.new(
|
client_update = Jampb::ClientUpdate.new(
|
||||||
product: product,
|
product: product,
|
||||||
|
|
|
||||||
|
|
@ -217,8 +217,10 @@ module JamRuby
|
||||||
return "#{name} has stopped recording."
|
return "#{name} has stopped recording."
|
||||||
|
|
||||||
when NotificationTypes::RECORDING_MASTER_MIX_COMPLETE
|
when NotificationTypes::RECORDING_MASTER_MIX_COMPLETE
|
||||||
return "This recording has been mastered and mixed and is ready to share."
|
return "One of your recordings has been mastered and mixed and is ready to share."
|
||||||
|
|
||||||
|
when NotificationTypes::RECORDING_STREAM_MIX_COMPLETE
|
||||||
|
return "One of your recordings has a stream mix available and is ready to share."
|
||||||
|
|
||||||
# band notifications
|
# band notifications
|
||||||
when NotificationTypes::BAND_INVITATION
|
when NotificationTypes::BAND_INVITATION
|
||||||
|
|
@ -1157,6 +1159,33 @@ module JamRuby
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_recording_stream_mix_complete(recording)
|
||||||
|
|
||||||
|
# only people who get told about mixes are folks who claimed it... not everyone in the session
|
||||||
|
recording.claimed_recordings.each do |claimed_recording|
|
||||||
|
|
||||||
|
notification = Notification.new
|
||||||
|
notification.band_id = recording.band.id if recording.band
|
||||||
|
notification.recording_id = recording.id
|
||||||
|
notification.target_user_id = claimed_recording.user_id
|
||||||
|
notification.description = NotificationTypes::RECORDING_STREAM_MIX_COMPLETE
|
||||||
|
notification.save
|
||||||
|
|
||||||
|
notification_msg = format_msg(notification.description, {:band => recording.band})
|
||||||
|
|
||||||
|
msg = @@message_factory.recording_stream_mix_complete(
|
||||||
|
claimed_recording.user_id,
|
||||||
|
recording.id,
|
||||||
|
claimed_recording.id,
|
||||||
|
notification.band_id,
|
||||||
|
notification_msg,
|
||||||
|
notification.id,
|
||||||
|
notification.created_date)
|
||||||
|
|
||||||
|
@@mq_router.publish_to_user(claimed_recording.user_id, msg)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def send_client_update(product, version, uri, size)
|
def send_client_update(product, version, uri, size)
|
||||||
msg = @@message_factory.client_update( product, version, uri, size)
|
msg = @@message_factory.client_update( product, version, uri, size)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,9 +192,17 @@ module JamRuby
|
||||||
self.mp3_md5 = mp3_md5
|
self.mp3_md5 = mp3_md5
|
||||||
self.completed = true
|
self.completed = true
|
||||||
save!
|
save!
|
||||||
|
|
||||||
|
# did we have a stream mix already when this one finished? We'll check later for sending a notification only on the 1st finished stream mix
|
||||||
|
has_stream_mix = recording.has_stream_mix
|
||||||
|
|
||||||
Recording.where(:id => self.recording.id).update_all(:has_stream_mix => true)
|
Recording.where(:id => self.recording.id).update_all(:has_stream_mix => true)
|
||||||
# only update first_quick_mix_id pointer if this is the 1st quick mix to complete for this recording
|
# only update first_quick_mix_id pointer if this is the 1st quick mix to complete for this recording
|
||||||
Recording.where(:id => self.recording.id).update_all(:first_quick_mix_id => self.id) if recording.first_quick_mix_id.nil?
|
Recording.where(:id => self.recording.id).update_all(:first_quick_mix_id => self.id) if recording.first_quick_mix_id.nil?
|
||||||
|
|
||||||
|
unless has_stream_mix
|
||||||
|
Notification.send_recording_stream_mix_complete(recording)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def s3_url(type='ogg')
|
def s3_url(type='ogg')
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@
|
||||||
RECORDING_ENDED : "RECORDING_ENDED",
|
RECORDING_ENDED : "RECORDING_ENDED",
|
||||||
RECORDING_MASTER_MIX_COMPLETE : "RECORDING_MASTER_MIX_COMPLETE",
|
RECORDING_MASTER_MIX_COMPLETE : "RECORDING_MASTER_MIX_COMPLETE",
|
||||||
DOWNLOAD_AVAILABLE : "DOWNLOAD_AVAILABLE",
|
DOWNLOAD_AVAILABLE : "DOWNLOAD_AVAILABLE",
|
||||||
|
RECORDING_STREAM_MIX_COMPLETE : "RECORDING_STREAM_MIX_COMPLETE",
|
||||||
|
|
||||||
// band notifications
|
// band notifications
|
||||||
BAND_INVITATION : "BAND_INVITATION",
|
BAND_INVITATION : "BAND_INVITATION",
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,7 @@
|
||||||
registerMusicianRecordingSaved();
|
registerMusicianRecordingSaved();
|
||||||
registerBandRecordingSaved();
|
registerBandRecordingSaved();
|
||||||
registerRecordingMasterMixComplete();
|
registerRecordingMasterMixComplete();
|
||||||
|
registerRecordingStreamMixComplete();
|
||||||
|
|
||||||
// band notifications
|
// band notifications
|
||||||
registerBandInvitation();
|
registerBandInvitation();
|
||||||
|
|
@ -280,6 +281,45 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (type === context.JK.MessageType.RECORDING_MASTER_MIX_COMPLETE) {
|
||||||
|
var $action_btn = $notification.find($btnNotificationAction);
|
||||||
|
$action_btn.text('SHARE');
|
||||||
|
$action_btn.click(function() {
|
||||||
|
|
||||||
|
rest.getRecording({id: payload.recording_id})
|
||||||
|
.done(function(recording) {
|
||||||
|
if(recording.my) {
|
||||||
|
ui.launchShareDialog(recording.my.id, 'recording');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
context.JK.Banner.showAlert('Unable to share recording')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.fail(app.ajaxError)
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (type === context.JK.MessageType.RECORDING_STREAM_MIX_COMPLETE) {
|
||||||
|
var $action_btn = $notification.find($btnNotificationAction);
|
||||||
|
$action_btn.text('SHARE');
|
||||||
|
$action_btn.click(function() {
|
||||||
|
|
||||||
|
rest.getRecording({id: payload.recording_id})
|
||||||
|
.done(function(recording) {
|
||||||
|
if(recording.my) {
|
||||||
|
ui.launchShareDialog(recording.my.id, 'recording');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
context.JK.Banner.showAlert('Unable to share recording')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.fail(app.ajaxError)
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (type === context.JK.MessageType.JOIN_REQUEST) {
|
else if (type === context.JK.MessageType.JOIN_REQUEST) {
|
||||||
var $action_btn = $notification.find($btnNotificationAction);
|
var $action_btn = $notification.find($btnNotificationAction);
|
||||||
$action_btn.text('APPROVE');
|
$action_btn.text('APPROVE');
|
||||||
|
|
@ -1128,6 +1168,31 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function registerRecordingStreamMixComplete() {
|
||||||
|
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.RECORDING_STREAM_MIX_COMPLETE, function(header, payload) {
|
||||||
|
logger.debug("Handling RECORDING_STREAM_MIX_COMPLETE msg " + JSON.stringify(payload));
|
||||||
|
|
||||||
|
handleNotification(payload, header.type);
|
||||||
|
|
||||||
|
app.notify({
|
||||||
|
"title": "Recording Stream Mix Complete",
|
||||||
|
"text": payload.msg,
|
||||||
|
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
|
||||||
|
}, [{
|
||||||
|
id: "btn-share",
|
||||||
|
text: "SHARE",
|
||||||
|
"layout-action": "close",
|
||||||
|
href: "#",
|
||||||
|
"class": "button-orange",
|
||||||
|
callback: shareRecording,
|
||||||
|
callback_args: {
|
||||||
|
"claimed_recording_id": payload.claimed_recording_id
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function shareRecording(args) {
|
function shareRecording(args) {
|
||||||
var claimedRecordingId = args.claimed_recording_id;
|
var claimedRecordingId = args.claimed_recording_id;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ child(:comments => :comments) {
|
||||||
node :my do |recording|
|
node :my do |recording|
|
||||||
claim = recording.claim_for_user(current_user) || recording.candidate_claimed_recording
|
claim = recording.claim_for_user(current_user) || recording.candidate_claimed_recording
|
||||||
if claim
|
if claim
|
||||||
{ name: claim.name, description: claim.description, genre: claim.genre.id, genre_name: claim.genre.description }
|
{ name: claim.name, description: claim.description, genre: claim.genre.id, genre_name: claim.genre.description, id: claim.id }
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue