2011-05-14 05:45:59 +08:00
|
|
|
require '../lib/recordandplayback'
|
|
|
|
require 'rubygems'
|
|
|
|
require 'yaml'
|
|
|
|
require 'fileutils'
|
|
|
|
|
|
|
|
|
2011-06-07 02:42:38 +08:00
|
|
|
def archive_recorded_meeting()
|
2011-06-07 02:58:16 +08:00
|
|
|
`ruby archive/archive.rb`
|
2011-06-07 02:42:38 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def process_archived_meeting(recording_dir)
|
2011-06-07 02:58:16 +08:00
|
|
|
done_files = Dir.glob("#{recording_dir}/status/archived/*.done")
|
|
|
|
done_files.each do |df|
|
|
|
|
match = /(.*).done/.match df.sub(/.+\//, "")
|
|
|
|
meeting_id = match[1]
|
|
|
|
|
|
|
|
# Execute all the scripts under the steps directory.
|
|
|
|
# This script must be invoked from the scripts directory for the PATH to be resolved.
|
|
|
|
Dir.glob("#{Dir.pwd}/process/*.rb").sort.each do |file|
|
|
|
|
# BigBlueButton.logger.info("Executing #{file}\n")
|
2011-06-30 06:39:25 +08:00
|
|
|
#IO.popen("ruby #{file} -m #{meeting_id}")
|
|
|
|
#Process.wait
|
|
|
|
#puts "********** #{$?.exitstatus} #{$?.exited?} #{$?.success?}********************"
|
|
|
|
command = "ruby #{file} -m #{meeting_id}"
|
|
|
|
BigBlueButton.execute(command)
|
|
|
|
|
2011-06-07 02:58:16 +08:00
|
|
|
end
|
|
|
|
end
|
2011-05-14 05:45:59 +08:00
|
|
|
end
|
|
|
|
|
2011-06-07 02:42:38 +08:00
|
|
|
def publish_processed_meeting(recording_dir)
|
2011-06-07 02:58:16 +08:00
|
|
|
done_files = Dir.glob("#{recording_dir}/status/processed/*.done")
|
|
|
|
|
|
|
|
done_files.each do |df|
|
|
|
|
match = /(.*).done/.match df.sub(/.+\//, "")
|
|
|
|
meeting_id = match[1]
|
|
|
|
|
|
|
|
# Execute all the scripts under the steps directory.
|
|
|
|
# This script must be invoked from the scripts directory for the PATH to be resolved.
|
|
|
|
Dir.glob("#{Dir.pwd}/publish/*.rb").sort.each do |file|
|
|
|
|
# BigBlueButton.logger.info("Executing #{file}\n")
|
2011-06-30 06:39:25 +08:00
|
|
|
#IO.popen("ruby #{file} -m #{meeting_id}")
|
|
|
|
#Process.wait
|
|
|
|
#puts "********** #{$?.exitstatus} #{$?.exited?} #{$?.success?}********************"
|
|
|
|
command = "ruby #{file} -m #{meeting_id}"
|
|
|
|
BigBlueButton.execute(command)
|
|
|
|
|
2011-06-07 02:58:16 +08:00
|
|
|
end
|
|
|
|
end
|
2011-06-07 02:42:38 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
# if not FileTest.directory?("#{archive_dir}/#{meeting_id}")
|
|
|
|
# puts "#{archive_dir}/#{meeting_id} does not exist."
|
|
|
|
#
|
|
|
|
# else
|
|
|
|
# puts "#{archive_dir}/#{meeting_id} exists."
|
|
|
|
# `ruby process/simple.rb -m #{meeting_id}`
|
|
|
|
# `ruby publish/simple.rb -m #{meeting_id}`
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO:
|
|
|
|
# 1. Check if meeting-id has corresponding dir in /var/bigbluebutton/archive
|
|
|
|
# 2. If yest, return
|
|
|
|
# 3. If not, archive the recording
|
|
|
|
# 4. Add entry in /var/bigbluebutton/status/archived/<meeting-id>.done file
|
|
|
|
|
|
|
|
|
|
|
|
# Execute all the scripts under the steps directory.
|
|
|
|
# This script must be invoked from the scripts directory for the PATH to be resolved.
|
|
|
|
#Dir.glob("#{Dir.pwd}/archive/steps/*.rb").sort.each do |file|
|
|
|
|
# BigBlueButton.logger.info("Executing #{file}\n")
|
|
|
|
# IO.popen("ruby #{file} -m #{meeting_id}")
|
|
|
|
# Process.wait
|
|
|
|
#puts "********** #{$?.exitstatus} #{$?.exited?} #{$?.success?}********************"
|
|
|
|
#end
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-05-14 05:45:59 +08:00
|
|
|
props = YAML::load(File.open('bigbluebutton.yml'))
|
|
|
|
recording_dir = props['recording_dir']
|
2011-06-07 02:42:38 +08:00
|
|
|
archive_recorded_meeting()
|
|
|
|
process_archived_meeting(recording_dir)
|
2011-06-07 04:09:53 +08:00
|
|
|
publish_processed_meeting(recording_dir)
|
2011-05-14 05:45:59 +08:00
|
|
|
|