2012-05-04 02:56:01 +08:00
|
|
|
# Set encoding to utf-8
|
|
|
|
# encoding: UTF-8
|
|
|
|
|
2011-04-26 02:06:32 +08:00
|
|
|
path = File.expand_path(File.join(File.dirname(__FILE__), '../lib'))
|
|
|
|
$LOAD_PATH << path
|
2011-05-25 08:41:44 +08:00
|
|
|
|
2011-05-07 05:26:22 +08:00
|
|
|
require 'recordandplayback/audio_archiver'
|
2011-05-10 02:20:35 +08:00
|
|
|
require 'recordandplayback/events_archiver'
|
|
|
|
require 'recordandplayback/video_archiver'
|
|
|
|
require 'recordandplayback/presentation_archiver'
|
|
|
|
require 'recordandplayback/deskshare_archiver'
|
2011-04-27 04:38:10 +08:00
|
|
|
require 'recordandplayback/generators/events'
|
2011-04-26 02:06:32 +08:00
|
|
|
require 'recordandplayback/generators/audio'
|
2011-05-11 04:17:57 +08:00
|
|
|
require 'recordandplayback/generators/video'
|
2011-04-26 02:06:32 +08:00
|
|
|
require 'recordandplayback/generators/matterhorn_processor'
|
|
|
|
require 'recordandplayback/generators/audio_processor'
|
2011-05-11 00:31:49 +08:00
|
|
|
require 'recordandplayback/generators/presentation'
|
2011-07-16 06:09:11 +08:00
|
|
|
require 'open4'
|
2011-05-11 00:31:49 +08:00
|
|
|
|
2011-04-26 03:29:33 +08:00
|
|
|
module BigBlueButton
|
2011-05-10 05:24:41 +08:00
|
|
|
class MissingDirectoryException < RuntimeError
|
2011-05-07 05:26:22 +08:00
|
|
|
end
|
|
|
|
|
2011-05-10 05:24:41 +08:00
|
|
|
class FileNotFoundException < RuntimeError
|
2011-05-07 05:26:22 +08:00
|
|
|
end
|
|
|
|
|
2011-04-26 03:29:33 +08:00
|
|
|
# BigBlueButton logs information about its progress.
|
|
|
|
# Replace with your own logger if you desire.
|
|
|
|
#
|
|
|
|
# @param [Logger] log your own logger
|
|
|
|
# @return [Logger] the logger you set
|
|
|
|
def self.logger=(log)
|
|
|
|
@logger = log
|
|
|
|
end
|
|
|
|
|
|
|
|
# Get BigBlueButton logger.
|
|
|
|
#
|
|
|
|
# @return [Logger]
|
|
|
|
def self.logger
|
|
|
|
return @logger if @logger
|
|
|
|
logger = Logger.new(STDOUT)
|
|
|
|
logger.level = Logger::INFO
|
|
|
|
@logger = logger
|
|
|
|
end
|
2011-04-27 04:38:10 +08:00
|
|
|
|
2011-05-07 05:26:22 +08:00
|
|
|
def self.dir_exists?(dir)
|
|
|
|
FileTest.directory?(dir)
|
|
|
|
end
|
2011-05-14 05:45:59 +08:00
|
|
|
|
2011-05-07 05:26:22 +08:00
|
|
|
def self.execute(command)
|
2011-05-25 11:50:05 +08:00
|
|
|
output=""
|
2011-06-29 13:08:58 +08:00
|
|
|
status = Open4::popen4(command) do | pid, stdin, stdout, stderr|
|
2011-05-07 05:26:22 +08:00
|
|
|
BigBlueButton.logger.info("Executing: #{command}")
|
2011-06-30 06:39:25 +08:00
|
|
|
|
2011-05-25 08:41:44 +08:00
|
|
|
output = stdout.readlines
|
|
|
|
BigBlueButton.logger.info( "Output: #{output} ") unless output.empty?
|
2011-06-30 06:39:25 +08:00
|
|
|
|
2011-05-07 05:26:22 +08:00
|
|
|
errors = stderr.readlines
|
2011-05-25 08:41:44 +08:00
|
|
|
unless errors.empty?
|
|
|
|
BigBlueButton.logger.error( "Error: stderr: #{errors}")
|
2011-08-06 00:48:19 +08:00
|
|
|
# raise errors.to_s
|
2011-05-25 08:41:44 +08:00
|
|
|
end
|
2011-05-07 05:26:22 +08:00
|
|
|
end
|
2011-06-30 06:39:25 +08:00
|
|
|
BigBlueButton.logger.info("Success ?: #{status.success?}")
|
|
|
|
BigBlueButton.logger.info("Process exited? #{status.exited?}")
|
|
|
|
BigBlueButton.logger.info("Exit status: #{status.exitstatus}")
|
2011-05-25 11:50:05 +08:00
|
|
|
output
|
2011-05-07 05:26:22 +08:00
|
|
|
end
|
2011-05-25 08:41:44 +08:00
|
|
|
end
|