Adjust recording system to archive, but not process, recordings with no marks

This allows them to be preserved for a period of time, rather than be
deleted immediately. Useful for recovering recordings when someone forgot
to press the record button during the session.
This commit is contained in:
Calvin Walton 2015-03-11 11:12:03 -04:00
parent aa0aaf2300
commit eedbafa94f
2 changed files with 21 additions and 24 deletions

View File

@ -123,29 +123,28 @@ target_dir = "#{raw_archive_dir}/#{meeting_id}"
if not FileTest.directory?(target_dir)
FileUtils.mkdir_p target_dir
archive_events(meeting_id, redis_host, redis_port, raw_archive_dir)
# we will abort the archiving if there's no marks to start and stop the recording
if not archive_has_recording_marks?(meeting_id, raw_archive_dir)
BigBlueButton.logger.info("There's no recording marks for #{meeting_id}, aborting the archive process")
archive_audio(meeting_id, audio_dir, raw_archive_dir)
archive_presentation(meeting_id, presentation_dir, raw_archive_dir)
archive_deskshare(meeting_id, deskshare_dir, raw_archive_dir)
archive_video(meeting_id, video_dir, raw_archive_dir)
# we need to delete the keys here because the sanity phase won't never happen for this recording
BigBlueButton.logger.info("Deleting keys")
if not archive_has_recording_marks?(meeting_id, raw_archive_dir)
BigBlueButton.logger.info("There's no recording marks for #{meeting_id}, not processing recording.")
# we need to delete the keys here because the sanity phase won't
# automatically happen for this recording
BigBlueButton.logger.info("Deleting redis keys")
redis = BigBlueButton::RedisWrapper.new(redis_host, redis_port)
events_archiver = BigBlueButton::RedisEventsArchiver.new redis
events_archiver.delete_events(meeting_id)
BigBlueButton.logger.info("Removing events.xml")
FileUtils.rm_r target_dir
BigBlueButton.logger.info("Removing the recorded flag")
FileUtils.rm("#{recording_dir}/status/recorded/#{meeting_id}.done")
File.open("#{recording_dir}/status/archived/#{meeting_id}.norecord", "w") do |archive_norecord|
archive_norecord.write("Archived #{meeting_id} (no recording marks")
end
else
archive_audio(meeting_id, audio_dir, raw_archive_dir)
archive_presentation(meeting_id, presentation_dir, raw_archive_dir)
archive_deskshare(meeting_id, deskshare_dir, raw_archive_dir)
archive_video(meeting_id, video_dir, raw_archive_dir)
archive_done = File.new("#{recording_dir}/status/archived/#{meeting_id}.done", "w")
archive_done.write("Archived #{meeting_id}")
archive_done.close
File.open("#{recording_dir}/status/archived/#{meeting_id}.done", "w") do |archive_done|
archive_done.write("Archived #{meeting_id}")
end
end
#else
# BigBlueButton.logger.debug("Skipping #{meeting_id} as it has already been archived.")
end

View File

@ -45,6 +45,9 @@ def archive_recorded_meeting(recording_dir)
archived_done = "#{recording_dir}/status/archived/#{meeting_id}.done"
next if File.exists?(archived_done)
archived_norecord = "#{recording_dir}/status/archived/#{meeting_id}.norecord"
next if File.exists?(archived_norecord)
archived_fail = "#{recording_dir}/status/archived/#{meeting_id}.fail"
next if File.exists?(archived_fail)
@ -55,12 +58,7 @@ def archive_recorded_meeting(recording_dir)
step_stop_time = BigBlueButton.monotonic_clock
step_time = step_stop_time - step_start_time
if not File.exists?(recorded_done)
BigBlueButton.logger.info("There's no recording marks in #{meeting_id}, skipping it")
return
end
step_succeeded = (ret == 0 && File.exists?(archived_done))
step_succeeded = (ret == 0 && (File.exists?(archived_done) || File.exists?(archived_norecord)))
BigBlueButton.redis_publisher.put_archive_ended meeting_id, {
"success" => step_succeeded,