Skip to content
Snippets Groups Projects
Commit b4d902cd authored by Calvin Walton's avatar Calvin Walton
Browse files

Drop old/broken matterhorn script, and old video processing code.

parent ec6e4fb6
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 1926 deletions
......@@ -43,27 +43,3 @@ end
When /^processing the audio and video for playback$/ do
pending # express the regexp above with the code you wish you had
end
Then /^the audio must be stripped from the raw video$/ do
stripped_flv = "stripped.flv"
strip_audio_from_video("webcam.flv", stripped_flv)
end
Then /^the video must be made the same length as the processed audio$/ do
blank_canvas = "canvas.jpg"
# Determine the width and height of the video
create_blank_canvas(1280, 720, "white", blank_canvas)
# Determine the paddings that need to be generated
create_blank_video(15, 1000, blank_canvas, "blank1.flv")
create_blank_video(4, 1000, blank_canvas, "blank2.flv")
# Concatenate all videos
concatenate_videos(["blank1.flv", "stripped.flv", "blank2.flv"], "concat-video.flv")
end
Then /^the processed audio multiplexed into the video$/ do
multiplex_audio_and_video("audio.wav", "concat-video.flv", "processed-video.flv")
end
# Set encoding to utf-8
# encoding: UTF-8
#
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
#
# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
#
# This program is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 3.0 of the License, or (at your option) any later
# version.
#
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
#
require 'rubygems'
require 'fileutils'
require 'builder'
require 'streamio-ffmpeg'
require 'mime/types'
require 'digest/md5'
require 'zip'
module BigBlueButton
class MediaFormatException < StandardError
end
class MatterhornProcessor
def self.create_manifest_xml(webcam, deskshare, manifest, meeting_id)
vpresenter = FFMPEG::Movie.new(webcam) if File.exists?(webcam)
vpresentation = FFMPEG::Movie.new(deskshare) if File.exists?(deskshare)
duration = vpresenter ? vpresenter.duration.round : vpresentation.duration.round
xml = Builder::XmlMarkup.new( :indent => 2 )
result = xml.instruct! :xml, :version => "1.0"
timestamp = (Time::now).utc.strftime("%Y-%m-%dT%H:%M:%S")
xml.tag!("mediapackage", "duration" => duration.to_s.split(".")[0] + "000", "id" => meeting_id, "start" => timestamp ) {
xml.media{
if vpresenter
xml.track("id" => "track-1", "type" => "presenter/source") {
xml.mimetype(MIME::Types.type_for(vpresenter.path).first.content_type)
xml.checksum(Digest::MD5.hexdigest(File.read(vpresenter.path)), "type" => "md5")
xml.url(vpresenter.path.sub(/.+\//, ""))
xml.size(vpresenter.size)
xml.tags
# Remove path and just have video.flv
xml.duration(vpresenter.duration.round.to_s.split(".")[0] + "000")
xml.video("id" => "video1") {
xml.encoder("type" => vpresenter.video_codec)
xml.resolution(vpresenter.width.to_s + "x" + vpresenter.height.to_s)
xml.bitrate(vpresenter.bitrate.to_s + "000")
xml.framerate(vpresenter.frame_rate)
}
}
end
if vpresentation
xml.track("id" => "track-2", "type" => "presentation/source") {
xml.mimetype(MIME::Types.type_for(vpresentation.path).first.content_type)
xml.checksum(Digest::MD5.hexdigest(File.read(vpresentation.path)),"type" => "md5")
xml.url(vpresentation.path.sub(/.+\//, ""))
xml.size(vpresentation.size)
xml.duration(vpresentation.duration.round.to_s.split(".")[0] + "000")
xml.tags
# Remove path and just have deskshare.flv
xml.video("id" => "video2") {
xml.encoder("type" => vpresentation.video_codec)
xml.resolution(vpresentation.width.to_s + "x" + vpresentation.height.to_s)
xml.bitrate(vpresentation.bitrate.to_s + "000")
xml.framerate(vpresentation.frame_rate)
}
}
end
}
xml.metadata {
xml.catalog("id" => "catalog-1", "type" => "dublincore/episode"){
xml.mimetype("text/xml")
xml.url("dublincore.xml")
}
}
}
BigBlueButton.logger.info("Task: Creating manifest.xml = \n#{result}")
aFile = File.new(manifest,"w+")
aFile.write(result)
aFile.close
end
# Creates dublincore.xml
# Example:
# create_dublin_core_xml( "/path/to/save/dublincore.xml",
# {:title => metadata[:title],
# :subject => metadata[:subject],
# :description => metadata[:description],
# :creator => metadata[:creator],
# :contributor => metadata[:contributor],
# :language => metadata[:language],
# :identifier => metadata[:identifier]})
#
def self.create_dublincore_xml(dublin_core_xml, metadata)
xml = Builder::XmlMarkup.new( :indent => 2 )
result = xml.instruct! :xml, :version => "1.0"
xml.dublincore("xmlns" => "http://www.opencastproject.org/xsd/1.0/dublincore/",
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance/",
"xsi:schemaLocation" => "http://www.opencastproject.org http://www.opencastproject.org/schema.xsd",
"xmlns:dcterms" => "http://purl.org/dc/terms/","xmlns:oc" => "http://www.opencastproject.org/matterhorn") {
xml.tag!("dcterms:title", metadata[:title])
xml.tag!("dcterms:subject", metadata[:subject])
xml.tag!("dcterms:description", metadata[:description])
xml.tag!("dcterms:creator", metadata[:creator])
xml.tag!("dcterms:contributor", metadata[:contributor])
xml.tag!("dcterms:language", metadata[:language])
xml.tag!("dcterms:identifier", metadata[:identifier])
}
BigBlueButton.logger.info("Task: Creating dublincore.xml = \n#{result}")
aFile = File.new(dublin_core_xml, "w+")
aFile.write(result)
aFile.close
end
def self.zip_artifacts(files, zipped_file)
BigBlueButton.logger.info("Task: Zipping package... #{zipped_file} #{files}")
Zip::ZipFile.open(zipped_file, Zip::ZipFile::CREATE) do |zipfile|
files.each { |f|
BigBlueButton.logger.info("Zipping #{f} into #{zipped_file}")
zipfile.add(f, f)
}
end
end
def upload_to_matterhorn(host, username, password, file)
BigBlueButton.logger.info("Task: Sending zipped package")
c = Curl::Easy.new("#{host}/ingest/rest/addZippedMediaPackage")
c.http_auth_types = :digest
c.username = username
c.password = password
c.headers["X-Requested-Auth"] = "Digest"
c.multipart_form_post = true
c.http_post(Curl::PostField.file('upload', file))
c.verbose = true
begin
c.perform
rescue Exception=>e
end
end
end
end
......@@ -85,176 +85,6 @@ module BigBlueButton
BigBlueButton::Events.get_stop_deskshare_events(events_xml).size.should == 1
end
it "should get the video width" do
dir = "resources/raw/8774263b-c4a6-4078-b2e6-46b7d4bc91c1"
video = "#{dir}/video/8774263b-c4a6-4078-b2e6-46b7d4bc91c1/320x240-1-1301433140446.flv"
BigBlueButton.get_video_width(video).should == 320
BigBlueButton.get_video_height(video).should == 240
end
it "should get the video duration" do
dir = "resources/raw/8774263b-c4a6-4078-b2e6-46b7d4bc91c1"
video = "#{dir}/video/8774263b-c4a6-4078-b2e6-46b7d4bc91c1/320x240-1-1301433140446.flv"
BigBlueButton.get_video_duration(video).should == 48.4
end
it "should scale the video " do
scaled_vid = BigBlueButton.scale_to_640_x_480(1100, 867)
scaled_vid[:width].should == 579
scaled_vid[:height].should == 480
end
it "should get the video bitrate and framerate" do
dir = "resources/raw/8774263b-c4a6-4078-b2e6-46b7d4bc91c1"
video = "#{dir}/video/8774263b-c4a6-4078-b2e6-46b7d4bc91c1/320x240-1-1301433140446.flv"
BigBlueButton.get_video_bitrate(video).should == 0
BigBlueButton.get_video_framerate(video).should == nil
end
it "should generate a video", :skip => true do
dir = "resources/raw/8774263b-c4a6-4078-b2e6-46b7d4bc91c1"
video = "#{dir}/video/8774263b-c4a6-4078-b2e6-46b7d4bc91c1/320x240-1-1301433140446.flv"
temp_dir = "/tmp/matterhorn"
if FileTest.directory?(temp_dir)
FileUtils.remove_dir temp_dir
end
FileUtils.mkdir_p temp_dir
stripped_flv = "#{temp_dir}/stripped.flv"
BigBlueButton.strip_audio_from_video(video, stripped_flv)
blank_canvas = "#{temp_dir}/canvas.jpg"
concat_vid = "#{temp_dir}/concat-video.flv"
vid_width = BigBlueButton.get_video_width(video)
vid_height = BigBlueButton.get_video_height(video)
events_xml = "#{dir}/events.xml"
first_timestamp = BigBlueButton::Events.first_event_timestamp(events_xml)
last_timestamp = BigBlueButton::Events.last_event_timestamp(events_xml)
blank1 = "#{temp_dir}/blank1.flv"
blank2 = "#{temp_dir}/blank2.flv"
start_evt = BigBlueButton::Events.get_start_video_events(events_xml)
start_evt[0][:start_timestamp].should == 1301433180523
stop_evt = BigBlueButton::Events.get_stop_video_events(events_xml)
stop_evt[0][:stop_timestamp].should == 1301433230112
BigBlueButton.create_blank_canvas(vid_width, vid_height, "white", blank_canvas)
first_gap_duration = start_evt[0][:start_timestamp] - first_timestamp
puts "First gap = " + first_gap_duration.to_s
end_gap_duration = last_timestamp - stop_evt[0][:stop_timestamp]
puts "End gap = " + end_gap_duration.to_s
BigBlueButton.create_blank_video(first_gap_duration/1000, 1000, blank_canvas, blank1)
BigBlueButton.create_blank_video(end_gap_duration/1000, 1000, blank_canvas, blank2)
BigBlueButton.concatenate_videos([blank1, stripped_flv, blank2], concat_vid)
end
it "should generate one webcam file from multiple webcam files", :skip => true do
meeting_id = "974a4b8c-5bf7-4382-b4cd-eb26af7dfcc2"
raw_archive_dir = "resources/raw/#{meeting_id}"
target_dir = "/tmp/matterhorn/process/matterhorn/#{meeting_id}"
if FileTest.directory?(target_dir)
FileUtils.remove_dir target_dir
end
FileUtils.mkdir_p target_dir
# Create a copy of the raw archives
temp_dir = "#{target_dir}/temp"
FileUtils.mkdir_p temp_dir
FileUtils.cp_r(raw_archive_dir, temp_dir)
BigBlueButton::AudioProcessor.process("#{temp_dir}/#{meeting_id}", "#{target_dir}/audio.ogg")
# Process video
video_dir = "#{temp_dir}/#{meeting_id}/video/#{meeting_id}"
blank_canvas = "#{temp_dir}/canvas.jpg"
BigBlueButton.create_blank_canvas(MAX_VID_WIDTH, MAX_VID_HEIGHT, "white", blank_canvas)
events_xml = "#{temp_dir}/#{meeting_id}/events.xml"
first_timestamp = BigBlueButton::Events.first_event_timestamp(events_xml)
first_timestamp.to_i.should == 1305560822952
last_timestamp = BigBlueButton::Events.last_event_timestamp(events_xml)
last_timestamp.to_i.should == 1305561067407
start_evt = BigBlueButton::Events.get_start_video_events(events_xml)
start_evt.size.should == 2
stop_evt = BigBlueButton::Events.get_stop_video_events(events_xml)
stop_evt.size.should == 2
matched_evts = BigBlueButton::Events.match_start_and_stop_video_events(start_evt, stop_evt)
matched_evts.size.should == 2
paddings = BigBlueButton.generate_video_paddings(matched_evts, first_timestamp, last_timestamp)
paddings.size.should == 3
webcams = []
paddings.concat(matched_evts).sort{|a,b| a[:start_timestamp] <=> b[:start_timestamp]}.each do |comb|
if (comb[:gap])
webcams << "#{temp_dir}/#{comb[:stream]}"
BigBlueButton.create_blank_video((comb[:stop_timestamp] - comb[:start_timestamp])/1000, 1000, blank_canvas, "#{temp_dir}/#{comb[:stream]}")
else
stripped_webcam = "#{temp_dir}/stripped-wc-#{comb[:stream]}.flv"
BigBlueButton.strip_audio_from_video("#{video_dir}/#{comb[:stream]}.flv", stripped_webcam)
flv_out = "#{temp_dir}/#{meeting_id}/scaled-wc-#{comb[:stream]}"
webcams << flv_out
frame_size = BigBlueButton.scale_to_640_x_480(BigBlueButton.get_video_width(stripped_webcam), BigBlueButton.get_video_height(stripped_webcam))
BigBlueButton.fit_to_screen_size(frame_size[:width], frame_size[:height], stripped_webcam, flv_out)
end
end
concat_vid = "#{target_dir}/webcam.flv"
BigBlueButton.concatenate_videos(webcams, concat_vid)
BigBlueButton.multiplex_audio_and_video("#{target_dir}/audio.ogg", concat_vid, "#{target_dir}/muxed-audio-webcam.flv")
end
it "should generate one deskshare file from multiple deskshare files", :skip => true do
meeting_id = "974a4b8c-5bf7-4382-b4cd-eb26af7dfcc2"
raw_archive_dir = "resources/raw/#{meeting_id}"
target_dir = "/tmp/matterhorn/process/matterhorn/#{meeting_id}"
if FileTest.directory?(target_dir)
FileUtils.remove_dir target_dir
end
FileUtils.mkdir_p target_dir
# Create a copy of the raw archives
temp_dir = "#{target_dir}/temp"
FileUtils.mkdir_p temp_dir
FileUtils.cp_r(raw_archive_dir, temp_dir)
# Process webcam recording
BigBlueButton.process_webcam(target_dir, temp_dir, meeting_id)
# Process desktop sharing
BigBlueButton.process_deskstop_sharing(target_dir, temp_dir, meeting_id)
BigBlueButton::MatterhornProcessor.create_manifest_xml("#{target_dir}/muxed-audio-webcam.flv", "#{target_dir}/deskshare.flv", "#{target_dir}/manifest.xml")
BigBlueButton::MatterhornProcessor.create_dublincore_xml("#{target_dir}/dublincore.xml",
{:title => "Business Ecosystem",
:subject => "TTMG 5001",
:description => "How to manage your product's ecosystem",
:creator => "Richard Alam",
:contributor => "Popen3",
:language => "En-US",
:identifier => "ttmg-5001-2"})
puts Dir.pwd
Dir.chdir(target_dir) do
puts Dir.pwd
BigBlueButton::MatterhornProcessor.zip_artifacts("muxed-audio-webcam.flv", "deskshare.flv", "dublincore.xml", "manifest.xml", "#{meeting_id}.zip")
end
puts Dir.pwd
# cmd = "scp -i /home/firstuser/.ssh/matt_id_rsa #{target_dir}/#{meeting_id}.zip root@ec2-50-16-8-19.compute-1.amazonaws.com:/opt/matterhorn/felix/inbox/"
# puts cmd
# Open3.popen3(cmd) do | stdin, stdout, stderr|
# p $?.exitstatus
# end
end
end
end
end
*.log
thin.pid
Matterhorn Webapp
=================
Go to the webapp folder, and follow these instructions
* The matterhorn webapp requires:
sudo apt-get install ruby1.8-dev
sudo apt-get install libxml2
sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev
* Install bundler and execute for get the required gems:
sudo gem install bundler
sudo bundle install
* Setting configuration:
- Edit the bigbluebutton.yml file according to your installation
## For development
* Run the following:
sudo thin -R config.ru start
## For production
* We need to create a run start level:
sudo thin install
sudo /usr/sbin/update-rc.d -f thin defaults
* Then, run the following commands:
sudo sh deploy.sh
sudo service thin start
## Proxy Pass with Nginx
* Edit the file /etc/nginx/sites-enabled/bigbluebutton:
# Bigbluebutton
location /matterhorn/ {
proxy_pass http://127.0.0.1:3000/;
proxy_redirect default;
}
===========
There is a ruby script in EC2 instance that:
1) Converts audio.wav to audiopresenter.ogg
2) Remove audio from flash videos, converting videopresenter.flv to justvideopresenter.flv and videopresentation.flv to justvideopresentation.flv.
3) Creates manifest.xml
4) Creates dublincore.xml (metadata is taken from strings declared in the script)
5) Creates a zipped package tosend.zip with
justvideopresenter.flv
justvideopresentation.flv
audiopresenter.ogg
manifest.xml
dublincore.xml
6) Compiles and executes a java class that sends the zipped package to Matterhorn server in the EC2 instance
Previously I installed:
vorbis tools => sudo apt-get install vorbis-tools
zip => sudo apt-get install zip
ruby => sudo apt-get install ruby irb rdoc
rubygems => sudo apt-get install rubygems
builder (a gem to generate xml) => gem install builder
streamio-ffmpeg (a gem to get media info) => gem install streamio-ffmpeg
To run the script:
cd /home/ubuntu/bnmaterial/prepareMediaRuby
ruby remix.rb audio.wav videopresenter.flv videopresentation.flv
Notes:
About parameters passed to the ruby script:
Audio file must be named <whatevername>.wav
Presenter Video must be named <whatever>presenter.flv
Presentation Video must be named <whatever>presentation.flv
If you don't want to run the ruby script and only want to send a ready zipped file to Matterhorn server :
cd /home/ubuntu/bnmaterial/
java ClientPreemptiveDigestAuthentication
It takes tosend.zip and sends it to Matterhorn Server
Then you can verify the uploaded file is in
http://ec2-50-17-155-248.compute-1.amazonaws.com:8080/engage/ui/index.html
Actually there are 3 objects in Media Gallery
--------------------------------------------
| MATTERHORN 1.1 INSTALLATION IN UBUNTU LUCID |
--------------------------------------------
MATTERHORN INSTALLATION DIRECTORY AND SOURCES
Create Matterhorn installation directory
sudo mkdir -p /opt/matterhorn
sudo chown $USER:$GROUPS /opt/matterhorn
Update pacakges and install subversion
sudo apt-get update
sudo apt-get install subversion
Checkout Matterhorn 1.1 source in Matterhorn directory
cd /opt/matterhorn
svn checkout http://opencast.jira.com/svn/MH/tags/1.1.0 /opt/matterhorn/1.1.0
JAVA
Update sources list
sudo nano /etc/apt/sources.list
Add these lines at the end:
deb http://archive.canonical.com/ubuntu lucid partner
deb-src http://archive.canonical.com/ubuntu lucid partner
Save the file and update
sudo apt-get update
Install java
sudo apt-get install sun-java6-jdk
Set JAVA_HOME variable
echo "export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.24/" >> ~/.bashrc
source ~/.bashrc
APACHE MAVEN
Install maven
sudo apt-get install maven2
Set maven opts
export MAVEN_OPTS='-Xms256m -Xmx960m -XX:PermSize=64m -XX:MaxPermSize=256m'
APACHE FELIX
Get the lastest release of Felix
sudo wget http://apache.deathculture.net//felix/org.apache.felix.main.distribution-3.2.2.tar.gz
Unarchive
sudo tar xvf org.apache.felix.main.distribution-3.2.2.tar.gz
Move and rename unarchived folder to Matterhorn installation directory
sudo mv felix-framework-3.2.2 /opt/matterhorn/felix
Configure
sudo mkdir /opt/matterhorn/felix/load
sudo cp -rf /opt/matterhorn/1.1.0/docs/felix/* /opt/matterhorn/felix/
BUILD MATTERHORN
Go to Matterhorn source directory, deploy
cd /opt/matterhorn/1.1.0/
sudo mvn clean install -DdeployTo=/opt/matterhorn/felix/matterhorn
THIRD PARTY TOOLS
Go to third party directory and run the script to install them
cd /opt/matterhorn/1.1.0/docs/scripts/3rd_party
sudo ./menu3p
Note: Here you have an interactive menu where you need to run only options 0,1 and 2
for Ubuntu.
EXPORT ENVIRONMENT VARIABLES
echo "export M2_REPO=/home/$USER/.m2/repository" >> ~/.bashrc
echo "export FELIX_HOME=/opt/matterhorn/felix" >> ~/.bashrc
echo "export JAVA_OPTS='-Xms1024m -Xmx1024m -XX:MaxPermSize=256m'" >> ~/.bashrc
source ~/.bashrc
CONFIGURE MATTERHORN PARAMETERS
sudo nano /opt/matterhorn/felix/conf/config.properties
Change server url "http://localhost" to your hostname
Example:
org.opencastproject.server.url=ec2-50-16-8-19.compute-1.amazonaws.com:8080
Change storage directory to the dir where you want to store processed files
Example:
org.opencastproject.storage.dir=/opt/matterhorn/opencast
FELIX HOME
Running Matterhorn could throw an error with FELIX_HOME so edit the script to run Matterhorn
sudo nano /opt/matterhorn/felix/bin/start_matterhorn.sh
Change line 10 to
FELIX="/opt/matterhorn/felix"
RUN MATTERHORN
sudo sh /opt/matterhorn/felix/bin/start_matterhorn.sh
|||||||||||||||||||||||||||||||||||
Ingesting to Matterhorn inbox
|||||||||||||||||||||||||||||||||||
----------------------------------
Notes:
----------------------------------
User in BBB server is firstuser
User in Matterhorn server is matt
BBB server ip: 192.168.1.42
Matterhorn server ip: 192.168.1.40
FELIX_HOME: /opt/matterhorn/felix
----------------------------------
Steps:
----------------------------------
In the BBB server:
1) Create a ssh key
ssh-keygen -t rsa
2)Ask for a passphrase. Press Enter
3)Ask for repeating the passphrase. Press Enter
The public key was generated in /home/firstuser/.ssh/
Its name is id_rsa.pub
In MH server:
4)Create a .ssh directory
sudo mkdir /home/matt/.ssh
5)Create authorized_keys file
sudo nano /home/matt/.ssh/authorized_keys
6) Copy the content from /home/firstuser/.ssh/id_rsa.pub in BBB server
To /home/matt/.ssh/authorized_keys in MH server
In BBB Server:
7)scp /path/to/zipped_file.zip matt@192.168.1.40:/opt/matterhorn/felix/inbox
The file is sent and ingested in Matterhorn
----------------------------------
About inbox ingestion:
----------------------------------
-By default inbox directory is $FELIX_HOME/inbox
-If you need to change inbox directory, change the parameter
felix.fileinstall.dir
in
/opt/matterhorn/1.1.0/docs/felix/load/org.apache.felix.fileinstall-inbox.cfg
-Zipped package is deleted after it is ingested in inbox dir
-If the zipped package is not a media package it is sent to the storage_dir/files/collection
where storage_dir is a parameter configured in $FELIX_HOME/conf/config.properties
#!/bin/bash
#
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
#
# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
#
# This program is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 3.0 of the License, or (at your option) any later
# version.
#
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
#
#
#Create Matterhorn installation directory
#
echo "Create Matterhorn installation directory"
echo "------------------------------------------------------"
echo "sudo mkdir -p /opt/matterhorn"
echo "------------------------------------------------------"
sudo mkdir -p /opt/matterhorn
echo "------------------------------------------------------"
echo "sudo chown $USER:$GROUPS /opt/matterhorn"
echo "------------------------------------------------------"
sudo chown $USER:$GROUPS /opt/matterhorn
#
#Update packages and install subversion
#
echo "Update packages and install subversion"
echo "------------------------------------------------------"
echo "sudo apt-get update --yes"
echo "------------------------------------------------------"
sudo apt-get update --yes
echo "------------------------------------------------------"
echo "sudo apt-get install subversion --yes"
echo "------------------------------------------------------"
sudo apt-get install subversion --yes
#
#Checkout Matterhorn 1.1 source in Matterhorn directory
#
echo "Checkout Matterhorn 1.1 source in Matterhorn directory"
echo "------------------------------------------------------"
echo "cd /opt/matterhorn"
echo "------------------------------------------------------"
cd /opt/matterhorn
echo "------------------------------------------------------"
echo "svn checkout http://opencast.jira.com/svn/MH/tags/1.1.0 /opt/matterhorn/1.1.0"
echo "------------------------------------------------------"
svn checkout http://opencast.jira.com/svn/MH/tags/1.1.0 /opt/matterhorn/1.1.0
#
#JAVA
#Update sources list
#
echo "Update sources list"
echo "------------------------------------------------------"
echo "deb http://archive.canonical.com/ubuntu lucid partner" >> /etc/apt/sources.list
echo "------------------------------------------------------"
echo "------------------------------------------------------"
echo "deb-src http://archive.canonical.com/ubuntu lucid partner" >> /etc/apt/sources.list
echo "------------------------------------------------------"
#
#Update packages
#
echo "Update packages"
echo "------------------------------------------------------"
echo "sudo apt-get update --yes"
echo "------------------------------------------------------"
sudo apt-get update --yes
#
#Install java
#
echo "Install Java"
sudo sh -c 'echo sun-java6-jdk shared/accepted-sun-dlj-v1-1 select true | /usr/bin/debconf-set-selections'
sudo apt-get install sun-java6-jdk --yes
#
#Set JAVA_HOME variable
#
echo "Set JAVA_HOME variable"
echo "------------------------------------------------------"
echo "export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.24/" >> ~/.bashrc
echo "------------------------------------------------------"
echo "------------------------------------------------------"
echo "source ~/.bashrc"
echo "------------------------------------------------------"
source ~/.bashrc
#
#APACHE MAVEN
#Install maven
#
echo "Install Apache Maven"
echo "------------------------------------------------------"
echo "sudo apt-get install maven2 --yes"
echo "------------------------------------------------------"
sudo apt-get install maven2 --yes
#
#Set maven opts
#
echo "Set maven opts"
echo "------------------------------------------------------"
echo export MAVEN_OPTS='-Xms256m -Xmx960m -XX:PermSize=64m -XX:MaxPermSize=256m'
echo "------------------------------------------------------"
#
#APACHE FELIX
#Get the lastest release of Felix
#
echo "Get lastest release of Felix"
echo "------------------------------------------------------"
echo "cd /usr/src"
echo "------------------------------------------------------"
cd /usr/src
echo "------------------------------------------------------"
echo "sudo wget http://apache.deathculture.net//felix/org.apache.felix.main.distribution-3.2.2.tar.gz"
echo "------------------------------------------------------"
sudo wget http://apache.deathculture.net//felix/org.apache.felix.main.distribution-3.2.2.tar.gz
#
#Unarchive
#
echo "Unarchive"
echo "------------------------------------------------------"
echo "sudo tar xvf org.apache.felix.main.distribution-3.2.2.tar.gz"
echo "------------------------------------------------------"
sudo tar xvf org.apache.felix.main.distribution-3.2.2.tar.gz
#
#Move and rename unarchived folder to Matterhorn installation directory
#
echo "Move and rename unarchived folder to Matterhorn installation directory"
echo "------------------------------------------------------"
echo "sudo mv felix-framework-3.2.2 /opt/matterhorn/felix"
echo "------------------------------------------------------"
sudo mv felix-framework-3.2.2 /opt/matterhorn/felix
#
#Configure
#
echo "Configure"
echo "------------------------------------------------------"
echo "sudo mkdir /opt/matterhorn/felix/load"
echo "------------------------------------------------------"
sudo mkdir /opt/matterhorn/felix/load
echo "------------------------------------------------------"
echo "sudo cp -rf /opt/matterhorn/1.1.0/docs/felix/* /opt/matterhorn/felix/"
echo "------------------------------------------------------"
sudo cp -rf /opt/matterhorn/1.1.0/docs/felix/* /opt/matterhorn/felix/
#
#BUILD MATTERHORN
#Go to Matterhorn source directory, deploy
#
echo "Go to Matterhorn source directory, deploy"
echo "------------------------------------------------------"
echo "cd /opt/matterhorn/1.1.0/"
echo "------------------------------------------------------"
cd /opt/matterhorn/1.1.0/
echo "------------------------------------------------------"
echo "sudo mvn install -DskipTests=true -DdeployTo=/opt/matterhorn/felix/matterhorn"
echo "------------------------------------------------------"
#sudo mvn clean install -DskipTests=true -DdeployTo=/opt/matterhorn/felix/matterhorn
sudo mvn install -DskipTests=true -DdeployTo=/opt/matterhorn/felix/matterhorn
#
#THIRD PARTY TOOLS
#
echo "Fixing bug about libpng12 broken url. Replacing config data"
echo "New URL is : http://downloads.sourceforge.net/project/libpng/libpng12/1.2.46/libpng-1.2.46.tar.gz"
echo "URL: http://downloads.sourceforge.net/project/libpng/libpng12/1.2.46/libpng-1.2.46.tar.gz
PKG: libpng-1.2.46.tar.gz
SHA: d5f3a2439b0b6d85a26499b2be09918eb54ea13a
DIR: libpng-1.2.46
PCP: pc-png.zip" > /opt/matterhorn/1.1.0/docs/scripts/3rd_party/base_libs/png/config.txt
echo "Go to third party directory and run the script to install them"
echo "------------------------------------------------------"
echo "cd /opt/matterhorn/1.1.0/docs/scripts/3rd_party"
echo "------------------------------------------------------"
cd /opt/matterhorn/1.1.0/docs/scripts/3rd_party
echo "export necesary variables to compile"
echo "------------------------------------------------------"
echo "export HOME3P=/opt/matterhorn/1.1.0/docs/scripts/3rd_party"
echo "------------------------------------------------------"
export HOME3P=/opt/matterhorn/1.1.0/docs/scripts/3rd_party # use absolute path, not "."
#export SUDOPWD=matt # if needed
echo "Compile and log the compilation in do-all.log:"
echo "------------------------------------------------------"
echo "sudo ./do-all 2>&1 | tee do-all.log"
echo "------------------------------------------------------"
sudo ./do-all 2>&1 | tee do-all.log
#
#EXPORT ENVIRONMENT VARIABLES
#
echo "Export M2_REPO, FELIX_HOME, JAVA_OPTS"
echo "------------------------------------------------------"
echo "export M2_REPO=/home/$USER/.m2/repository"
echo "------------------------------------------------------"
echo "export M2_REPO=/home/$USER/.m2/repository" >> ~/.bashrc
echo "------------------------------------------------------"
echo "export FELIX_HOME=/opt/matterhorn/felix"
echo "------------------------------------------------------"
echo "export FELIX_HOME=/opt/matterhorn/felix" >> ~/.bashrc
echo "------------------------------------------------------"
echo "export JAVA_OPTS='-Xms1024m -Xmx1024m -XX:MaxPermSize=256m'"
echo "------------------------------------------------------"
echo "export JAVA_OPTS='-Xms1024m -Xmx1024m -XX:MaxPermSize=256m'" >> ~/.bashrc
echo "------------------------------------------------------"
echo "source ~/.bashrc"
echo "------------------------------------------------------"
source ~/.bashrc
#
#CONFIGURE MATTERHORN PARAMETERS
#
echo "Change server url "http://localhost" to your hostname"
ip=`ifconfig eth0 | sed -n 's/.*dr:\(.*\)\s Bc.*/\1/p'`
sed -i "s/org\.opencastproject\.server\.url=.*/org\.opencastproject\.server\.url=http:\/\/$ip:8080/g" /opt/matterhorn/felix/conf/config.properties
echo "Change storage directory to the dir where you want to store processed files"
sed -i "s/org\.opencastproject\.storage\.dir=.*/org\.opencastproject\.storage\.dir=\/opt\/matterhorn\/opencast/g" /opt/matterhorn/felix/conf/config.properties
#
#FELIX HOME
#Running Matterhorn could throw an error with FELIX_HOME so edit the script to run Matterhorn
#
echo "Change FELIX_HOME variable in star_matterhorn.sh script"
sed -i 's/FELIX=".*/ FELIX="\/opt\/matterhorn\/felix"/g' /opt/matterhorn/felix/bin/start_matterhorn.sh
echo "MATTERHORN Installed"
echo "To run, type on the command line "
echo "sudo /opt/matterhorn/felix/bin/start_matterhorn.sh"
# -------------------------------------------------------------
# To run this script we need:
# --------------------------------------------------------------
# - Mediapackage parameters like title, creator and subject
# to search workflows in Matterhorn and get their status.
#
# - Matterhorn server url, user and password.
#
# -------------------------------------------------------------
# Script output:
# --------------------------------------------------------------
# STATUS: INSTANTIATED
# STATUS: RUNNING
# STATUS: SUCCEEDED
#
# Set encoding to utf-8
# encoding: UTF-8
#
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
#
# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
#
# This program is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 3.0 of the License, or (at your option) any later
# version.
#
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
#
require "rubygems"
require "curb"
require "nokogiri"
require "cgi"
require 'trollop'
require 'yaml'
opts = Trollop::options do
opt :title, :type => String
opt :creator, :type => String
opt :subject, :type => String
end
title = opts[:title]
creator = opts[:creator]
subject = opts[:subject]
# This script lives in scripts while matterhorn.yml lives in scripts/
matt_props = YAML::load(File.open('matterhorn.yml'))
rest_server = matt_props['rest_server']
#Zipped file parameters to search a workflow in Matterhorn
title = "Business Ecosystem"
creator = "Richard Alam"
subject = "TTMG 5001"
#Create URI
encoded_params = CGI.escape("sort=DATE_CREATED_DESC&title=#{title}&creator=#{creator}&subject=#{subject}")
#Request Authentication
c = Curl::Easy.new("#{rest_server}/workflow/instances.xml?#{encoded_params}")
c.http_auth_types = :digest
c.username = 'matterhorn_system_account'
c.password = 'CHANGE_ME'
c.headers["X-Requested-Auth"] = "Digest"
#Ask for workflow status to Matterhorn.
#Stops when status is SUCCEEDED.
state = ""
begin
sleep 20
tmp = state
c.perform
xml_response = c.body_str
xml_doc = Nokogiri::XML(xml_response)
workflow = xml_doc.xpath("//workflow")
state = workflow[-1].attribute('state')
if !tmp.to_str.eql? state.to_str
puts "STATUS: " + state
end
end while !state.to_str.eql? "SUCCEEDED"
#
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
#
# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
#
# This program is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 3.0 of the License, or (at your option) any later
# version.
#
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
#
# NOTE:
# Copy into /etc/bigbluebutton/god/conf
# sudo cp matt-pub-god-conf.rb /etc/bigbluebutton/god/conf/matterhorn-publish-conf.rb
#
# Monitors the BigBlueButton Matterhorn publisher process
God.watch do |w|
# The name of the watcher
w.name = "bbb-matterhorn-publisher"
# The default time for reporting the state of the monitored process
w.interval = 1.minute
# Start the process
w.start = "ruby publish-matterhorn.rb"
# Start your process in this directory
w.dir = "/usr/local/bigbluebutton/core/scripts/"
# Time to wait before monitoring, after starting the process
w.start_grace = 30.seconds
# Cleans the pid file before starting the process.
# god will daemonizes the process
w.behavior(:clean_pid_file)
# Start the process if it is not running
# And report its status every 30 seconds
# In other words god revives the process every time it dies
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 30.seconds
c.running = false
end
end
end
# The ip address of the matterhorn server.
server: 192.168.0.147
# The username we use to SCP the processed recording to matterhorn.
user: root
# The private key to use to SCP into matterhorn
key: /usr/local/bigbluebutton/core/scripts/matt_id_rsa
# The directory in the matterhorn server where the
# processed recording will be delivered for publishing to matterhorn
# NOTE: Make sure that the directory is writeable by the above user.
inbox: /opt/matterhorn/felix/inbox/
# Set encoding to utf-8
# encoding: UTF-8
#
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
#
# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
#
# This program is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 3.0 of the License, or (at your option) any later
# version.
#
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
#
require '../../core/lib/recordandplayback'
require 'rubygems'
require 'trollop'
require 'yaml'
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]
#Matterhorn process log file
logger = Logger.new("/var/log/bigbluebutton/matterhorn/process-#{meeting_id}.log", 'daily' )
BigBlueButton.logger = logger
# This script lives in scripts/archive/steps while bigbluebutton.yml lives in scripts/
props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))
recording_dir = props['recording_dir']
raw_archive_dir = "#{recording_dir}/raw/#{meeting_id}"
target_dir = "#{recording_dir}/process/matterhorn/#{meeting_id}"
if not FileTest.directory?(target_dir)
FileUtils.mkdir_p target_dir
if !Dir["#{raw_archive_dir}/video/*"].empty? or !Dir["#{raw_archive_dir}/deskshare/*"].empty?
# Create a copy of the raw archives
temp_dir = "#{target_dir}/temp"
FileUtils.mkdir_p temp_dir
FileUtils.cp_r(raw_archive_dir, temp_dir)
# Process webcam recording
BigBlueButton.process_webcam(target_dir, temp_dir, meeting_id) if !Dir["#{raw_archive_dir}/video/*"].empty?
# Process desktop sharing
BigBlueButton.process_deskstop_sharing(target_dir, temp_dir, meeting_id) if !Dir["#{raw_archive_dir}/deskshare/*"].empty?
# Mux audio and deskshare if webcam was not processed
if !File.exists?("#{target_dir}/muxed-audio-webcam.flv")
BigBlueButton::AudioProcessor.process("#{temp_dir}/#{meeting_id}", "#{target_dir}/audio")
BigBlueButton.mux_audio_deskshare( target_dir, "#{target_dir}/audio.ogg", "#{target_dir}/deskshare.flv")
end
#Create xml files with metadata
BigBlueButton::MatterhornProcessor.create_manifest_xml("#{target_dir}/muxed-audio-webcam.flv", "#{target_dir}/deskshare.flv", "#{target_dir}/manifest.xml", meeting_id)
metadata = BigBlueButton::Events.get_meeting_metadata("#{temp_dir}/#{meeting_id}/events.xml")
dublincore_data = { :title => metadata[:title.to_s].nil? ? meeting_id : metadata[:title.to_s],
:subject => metadata[:subject.to_s],
:description => metadata[:description.to_s],
:creator => metadata[:creator.to_s],
:contributor => metadata[:contributor.to_s],
:language => metadata[:language.to_s],
:identifier => metadata[:identifier.to_s]
}
BigBlueButton::MatterhornProcessor.create_dublincore_xml("#{target_dir}/dublincore.xml", dublincore_data)
else
logger.error "Failed Matterhorn process for meeting #{meeting_id}. Absence of video (webcam or deskshare)."
end
process_done = File.new("#{recording_dir}/status/processed/#{meeting_id}-matterhorn.done", "w")
process_done.write("Processed #{meeting_id}")
process_done.close
end
# Set encoding to utf-8
# encoding: UTF-8
#
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
#
# Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
#
# This program is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 3.0 of the License, or (at your option) any later
# version.
#
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
#
require '../../core/lib/recordandplayback'
require 'rubygems'
require 'yaml'
bbb_props = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))
matt_props = YAML::load(File.open('matterhorn.yml'))
scp_server = matt_props['server']
scp_inbox = matt_props['inbox']
scp_key = matt_props['key']
scp_user = matt_props['user']
recording_dir = bbb_props['recording_dir']
done_files = Dir.glob("#{recording_dir}/status/processed/*.done")
done_files.each do |df|
match = /(.*)-(.*).done/.match df.sub(/.+\//, "")
meeting_id = match[1]
if (match[2] == "matterhorn")
BigBlueButton.logger = Logger.new("/var/log/bigbluebutton/matterhorn/publish-#{meeting_id}.log", 'daily' )
process_dir = "#{recording_dir}/process/matterhorn/#{meeting_id}"
target_dir = "#{recording_dir}/publish/matterhorn/#{meeting_id}"
if not FileTest.directory?(target_dir)
FileUtils.mkdir_p target_dir
WEBCAM = "muxed-audio-webcam.flv"
DESKSHARE = "deskshare.flv"
MANIFEST = "manifest.xml"
DUBLIN = "dublincore.xml"
files = [WEBCAM, DESKSHARE, MANIFEST, DUBLIN]
files.select! do |file|
if File.exist?("#{process_dir}/#{file}")
FileUtils.cp("#{process_dir}/#{file}", target_dir)
file
end
end
BigBlueButton.logger.info files
Dir.chdir(target_dir) do
BigBlueButton::MatterhornProcessor.zip_artifacts(files, "#{meeting_id}.zip")
end
command = "scp -i #{scp_key} -o StrictHostKeyChecking=no -o CheckHostIP=no #{target_dir}/#{meeting_id}.zip #{scp_user}@#{scp_server}:#{scp_inbox}"
BigBlueButton.execute(command)
BigBlueButton.logger.info("Removing processed files.")
FileUtils.rm_r(Dir.glob("#{process_dir}/*"))
BigBlueButton.logger.info("Removing published files.")
FileUtils.rm_r(Dir.glob("#{target_dir}/*"))
end
end
end
source "http://rubygems.org"
gem "sinatra", :require => "sinatra/base"
gem "haml"
gem "thin"
gem "nokogiri"
gem "rack", "1.2.0"
gem "bigbluebutton-api-ruby", :git => "git://github.com/markoscalderon/bigbluebutton-api-ruby.git", :branch => "api-0.8"
GIT
remote: git://github.com/markoscalderon/bigbluebutton-api-ruby.git
revision: 071a372eb7e823f3a24137fd5df5f584d9ab1b4a
branch: api-0.8
specs:
bigbluebutton-api-ruby (0.0.10)
nokogiri (~> 1.4.0)
GEM
remote: http://rubygems.org/
specs:
daemons (1.1.3)
eventmachine (0.12.10)
haml (3.1.1)
nokogiri (1.4.4)
rack (1.2.0)
sinatra (1.2.6)
rack (~> 1.1)
tilt (>= 1.2.2, < 2.0)
thin (1.2.11)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
tilt (1.3)
PLATFORMS
ruby
DEPENDENCIES
bigbluebutton-api-ruby!
haml
nokogiri
rack (= 1.2.0)
sinatra
thin
bbb_salt: 'e49e0123e531d0816abaf4bc1b1d7f11'
bbb_url: 'http://192.168.1.37/bigbluebutton/api'
bbb_version: '0.9.0'
require 'rubygems'
require 'sinatra'
require 'main'
run Main
\ No newline at end of file
DEPLOY_DIR=/var/www/bigbluebutton/matterhorn
if [ "$(whoami)" != "root" ]; then
echo "Please run the script as root."
exit 1
fi
echo "Deleting old files..."
rm -r $DEPLOY_DIR
if [ ! -e $DEPLOY_DIR ]
then
echo "Creating deployment directory ${DEPLOY_DIR}..."
mkdir $DEPLOY_DIR
fi
echo "Copying new files..."
cp -r "./views" $DEPLOY_DIR
cp "bigbluebutton.yml" $DEPLOY_DIR
cp "config.ru" $DEPLOY_DIR
cp "main.rb" $DEPLOY_DIR
mkdir $DEPLOY_DIR"/log"
mkdir $DEPLOY_DIR"/tmp"
echo "Installing matterhorn webapp in thin..."
# see http://code.macournoyer.com/thin/usage/
thin config -C "/etc/thin/matterhorn.yml" -c $DEPLOY_DIR"/" --servers "1" -e "production"
echo "**************************************************"
echo "For start the thin server: sudo service thin start"
echo "**************************************************"
require 'rubygems'
require 'bundler'
Bundler.setup(:default)
#require 'sinatra'
require 'sinatra/base'
require 'haml'
require 'bigbluebutton-api'
#TODO: manage exceptions
# support of multiple conferences
# wait student for meeting to start
# logout
class LoginScreen < Sinatra::Base
use Rack::Session::Pool, :expire_after => 2592000
configure do
set :pass_inst, "instructor"
set :pass_stud, "student"
end
get('/login/?') {
if session["user"].nil? == false
redirect to("/?")
else
haml :login
end
}
post('/login/?') do
username=params[:txtusername]
password=params[:txtpassword]
if password==settings.pass_inst
session["user"]=username
session["role"]="instructor"
elsif password==settings.pass_stud
session["user"]=username
session["role"]="student"
end
redirect to("/")
end
end
class Main < Sinatra::Base
use LoginScreen
#enable logger
set :logging, true
configure do
set :pass_inst, "instructor"
set :pass_stud, "student"
#setting up logger
log = File.new("log/sinatra.log", "a")
STDOUT.reopen(log)
STDERR.reopen(log)
#loading config YAML file
config_file = 'bigbluebutton.yml'
unless File.exist? config_file
puts config_file + " does not exists..."
end
puts "loading config file..."
$config = YAML.load_file(config_file)
#setting bigbluebutton object
puts "setting bigbluebutton session" + $config['bbb_url']
$bbb_api = BigBlueButton::BigBlueButtonApi.new($config['bbb_url'], $config['bbb_salt'], $config['bbb_version'], true)
end
before do
unless session['user']
redirect ("/login")
end
end
get('/?') {
puts "getting meetings..."
resp = $bbb_api.get_meetings
@conflist = Hash.new
unless !resp["meetings"].nil? then
puts resp[:meetings]
@conflist = resp[:meetings]
end
@message = ""
if @conflist.length == 0
@message = "No meetings running..."
end
haml :list
}
get '/logout' do
session.clear
redirect to("/login")
end
get '/enter' do
meeting_id = params[:meetingid]
username = session['user']
passwd = nil
if session['role'] == "instructor"
passwd = settings.pass_inst
elsif session['role'] == "student"
passwd = settings.pass_stud
end
redirect $bbb_api.join_meeting_url(meeting_id, username, passwd)
end
get '/metadata' do
haml :metadata
end
post '/metadata/process' do
meeting_name=params[:txtname]
meeting_id=params[:txtid]
metadata = Hash.new
metadata[:title]=params[:txttitle]
metadata[:series]=params[:txtseries]
metadata[:instructor]=params[:txtinstructor]
$bbb_api.create_meeting(meeting_name, meeting_id, settings.pass_inst, settings.pass_stud, nil, nil, nil, nil, nil, true, metadata)
redirect to("/enter?meetingid=#{meeting_id}")
end
end
!!!
%html
%head
%title Matterhorn - BigBlueButton Integration
%script{:type => "text/javascript", :src => "https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"}
%body
#header{ :style => "text-align=right" }
- unless session["user"].nil? then
%a{ :href => "logout" } logout
#content
=yield
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment