- start automating publish part

This commit is contained in:
Richard Alam 2011-06-06 15:55:28 -04:00
parent 988da9b621
commit a66daaad8a
3 changed files with 107 additions and 96 deletions

View File

@ -3,43 +3,49 @@ require 'rubygems'
require 'trollop'
require 'yaml'
logger = Logger.new("/var/log/bigbluebutton/matterhorn-publish-#{meeting_id}.log", 'daily' )
BigBlueButton.logger = logger
opts = Trollop::options do
opt :meeting_id, "Meeting id to archive", :default => '58f4a6b3-cd07-444d-8564-59116cb53974', :type => String
end
meeting_id = opts[:meeting_id]
logger = Logger.new("/var/log/bigbluebutton/matterhorn-publish-#{meeting_id}.log", 'daily' )
BigBlueButton.logger = logger
match = /(.*)-(.*)/.match meeting_id
meeting_id = match[1]
playback = match[2]
# This script lives in scripts/archive/steps while matterhorn.yaml lives in scripts/
bbb_props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))
matt_props = YAML::load(File.open('matterhorn.yml'))
scp_server = matt_props['scp_server']
scp_inbox = matt_props['scp_inbox']
scp_key = matt_props['scp_key']
scp_user = matt_props['scp_user']
recording_dir = bbb_props['recording_dir']
if (playback == "matterhorn")
# This script lives in scripts/archive/steps while matterhorn.yaml lives in scripts/
bbb_props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))
matt_props = YAML::load(File.open('matterhorn.yml'))
scp_server = matt_props['scp_server']
scp_inbox = matt_props['scp_inbox']
scp_key = matt_props['scp_key']
scp_user = matt_props['scp_user']
recording_dir = bbb_props['recording_dir']
process_dir = "#{recording_dir}/process/matterhorn/#{meeting_id}"
process_dir = "#{recording_dir}/process/matterhorn/#{meeting_id}"
target_dir = "#{recording_dir}/publish/matterhorn/#{meeting_id}"
if FileTest.directory?(target_dir)
FileUtils.mkdir_p target_dir
target_dir = "#{recording_dir}/publish/matterhorn/#{meeting_id}"
if FileTest.directory?(target_dir)
FileUtils.remove_dir target_dir
end
FileUtils.mkdir_p target_dir
FileUtils.cp("#{process_dir}/muxed-audio-webcam.flv", target_dir)
FileUtils.cp("#{process_dir}/deskshare.flv", target_dir)
FileUtils.cp("#{process_dir}/manifest.xml", target_dir)
FileUtils.cp("#{process_dir}/dublincore.xml", target_dir)
Dir.chdir(target_dir) do
BigBlueButton::MatterhornProcessor.zip_artifacts("muxed-audio-webcam.flv", "deskshare.flv", "dublincore.xml", "manifest.xml", "#{meeting_id}.zip")
end
command = "scp -i #{scp_key} #{target_dir}/#{meeting_id}.zip #{scp_user}@#{scp_server}:#{scp_inbox}"
BigBlueButton.logger.info(command)
Open3.popen3(command) do | stdin, stdout, stderr|
BigBlueButton.logger.info("scp result=#{$?.exitstatus}")
FileUtils.cp("#{process_dir}/muxed-audio-webcam.flv", target_dir)
FileUtils.cp("#{process_dir}/deskshare.flv", target_dir)
FileUtils.cp("#{process_dir}/manifest.xml", target_dir)
FileUtils.cp("#{process_dir}/dublincore.xml", target_dir)
Dir.chdir(target_dir) do
BigBlueButton::MatterhornProcessor.zip_artifacts("muxed-audio-webcam.flv", "deskshare.flv", "dublincore.xml", "manifest.xml", "#{meeting_id}.zip")
end
command = "scp -i #{scp_key} #{target_dir}/#{meeting_id}.zip #{scp_user}@#{scp_server}:#{scp_inbox}"
BigBlueButton.logger.info(command)
Open3.popen3(command) do | stdin, stdout, stderr|
BigBlueButton.logger.info("scp result=#{$?.exitstatus}")
end
else
end
end

View File

@ -3,6 +3,9 @@ require 'rubygems'
require 'trollop'
require 'yaml'
logger = Logger.new("/var/log/bigbluebutton/simple-process-#{meeting_id}.log", 'daily' )
BigBlueButton.logger = logger
opts = Trollop::options do
opt :meeting_id, "Meeting id to archive", :default => '58f4a6b3-cd07-444d-8564-59116cb53974', :type => String
end
@ -12,9 +15,6 @@ meeting_id = opts[:meeting_id]
# This script lives in scripts/archive/steps while properties.yaml lives in scripts/
props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))
logger = Logger.new("/var/log/bigbluebutton/simple-process-#{meeting_id}.log", 'daily' )
BigBlueButton.logger = logger
recording_dir = props['recording_dir']
raw_archive_dir = "#{recording_dir}/raw/#{meeting_id}"

View File

@ -4,71 +4,76 @@ require 'trollop'
require 'yaml'
require 'builder'
logger = Logger.new("/var/log/bigbluebutton/simple-publish-#{meeting_id}.log", 'daily' )
BigBlueButton.logger = logger
opts = Trollop::options do
opt :meeting_id, "Meeting id to archive", :default => '58f4a6b3-cd07-444d-8564-59116cb53974', :type => String
end
meeting_id = opts[:meeting_id]
logger = Logger.new("/var/log/bigbluebutton/simple-publish-#{meeting_id}.log", 'daily' )
BigBlueButton.logger = logger
match = /(.*)-(.*)/.match meeting_id
meeting_id = match[1]
playback = match[2]
# This script lives in scripts/archive/steps while properties.yaml lives in scripts/
bbb_props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))
simple_props = YAML::load(File.open('simple.yml'))
if (playback == "simple")
# This script lives in scripts/archive/steps while properties.yaml lives in scripts/
bbb_props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))
simple_props = YAML::load(File.open('simple.yml'))
recording_dir = bbb_props['recording_dir']
process_dir = "#{recording_dir}/process/simple/#{meeting_id}"
publish_dir = simple_props['publish_dir']
playback_host = simple_props['playback_host']
recording_dir = bbb_props['recording_dir']
process_dir = "#{recording_dir}/process/simple/#{meeting_id}"
publish_dir = simple_props['publish_dir']
playback_host = simple_props['playback_host']
target_dir = "#{recording_dir}/publish/simple/#{meeting_id}"
if FileTest.directory?(target_dir)
FileUtils.remove_dir target_dir
target_dir = "#{recording_dir}/publish/simple/#{meeting_id}"
if not FileTest.directory?(target_dir)
FileUtils.mkdir_p target_dir
package_dir = "#{target_dir}/#{meeting_id}"
FileUtils.mkdir_p package_dir
audio_dir = "#{package_dir}/audio"
FileUtils.mkdir_p audio_dir
FileUtils.cp("#{process_dir}/audio.ogg", audio_dir)
FileUtils.cp("#{process_dir}/events.xml", package_dir)
FileUtils.cp_r("#{process_dir}/presentation", package_dir)
FileUtils.cp_r(package_dir, publish_dir)
dir_list = Dir.entries(publish_dir) - ['.', '..']
recordings = []
dir_list.each do |d|
if File::directory?("#{publish_dir}/#{d}")
rec_time = File.ctime("#{publish_dir}/#{d}")
play_link = "http://#{playback_host}/playback/simple/playback.html?meetingId=#{d}"
metadata = BigBlueButton::Events.get_meeting_metadata("#{publish_dir}/#{d}/events.xml")
recordings << {:rec_time => rec_time, :link => play_link, :title => metadata['title']}
end
end
b = Builder::XmlMarkup.new(:indent => 2)
html = b.html {
b.head {
b.title "Simple Playback Recordings"
}
b.body {
b.h1 "Simple Playback Recordings"
recordings.each do |r|
b.p { |y|
y << r[:rec_time].to_s
b.a({:href => r[:link]}, r[:title])
}
end
}
}
index_html = File.new("#{publish_dir}/index.html","w")
index_html.write(html)
index_html.close
end
end
FileUtils.mkdir_p target_dir
package_dir = "#{target_dir}/#{meeting_id}"
FileUtils.mkdir_p package_dir
audio_dir = "#{package_dir}/audio"
FileUtils.mkdir_p audio_dir
FileUtils.cp("#{process_dir}/audio.ogg", audio_dir)
FileUtils.cp("#{process_dir}/events.xml", package_dir)
FileUtils.cp_r("#{process_dir}/presentation", package_dir)
FileUtils.cp_r(package_dir, publish_dir)
dir_list = Dir.entries(publish_dir) - ['.', '..']
recordings = []
dir_list.each do |d|
if File::directory?("#{publish_dir}/#{d}")
rec_time = File.ctime("#{publish_dir}/#{d}")
play_link = "http://#{playback_host}/playback/simple/playback.html?meetingId=#{d}"
metadata = BigBlueButton::Events.get_meeting_metadata("#{publish_dir}/#{d}/events.xml")
recordings << {:rec_time => rec_time, :link => play_link, :title => metadata['title']}
end
end
b = Builder::XmlMarkup.new(:indent => 2)
html = b.html {
b.head {
b.title "Simple Playback Recordings"
}
b.body {
b.h1 "Simple Playback Recordings"
recordings.each do |r|
b.p { |y|
y << r[:rec_time].to_s
b.a({:href => r[:link]}, r[:title])
}
end
}
}
index_html = File.new("#{publish_dir}/index.html","w")
index_html.write(html)
index_html.close