From b4d902cd9ae412a26c005edd9d06312b2ddf4a9b Mon Sep 17 00:00:00 2001 From: Calvin Walton <calvin.walton@kepstin.ca> Date: Fri, 2 Sep 2016 14:45:23 -0400 Subject: [PATCH] Drop old/broken matterhorn script, and old video processing code. --- .../step_definitions/process_video_step.rb | 24 - .../generators/matterhorn_processor.rb | 170 ------- .../lib/recordandplayback/generators/video.rb | 468 ------------------ .../deskshare_generator_spec.rb | 170 ------- record-and-playback/matterhorn/.gitignore | 2 - record-and-playback/matterhorn/README | 234 --------- .../matterhorn/matterhorn-install.sh | 301 ----------- .../matterhorn/scripts/ingest-status.rb | 90 ---- .../matterhorn/scripts/matt-pub-god-conf.rb | 55 -- .../matterhorn/scripts/matterhorn.yml | 11 - .../matterhorn/scripts/process/matterhorn.rb | 88 ---- .../matterhorn/scripts/publish-matterhorn.rb | 73 --- .../matterhorn/webapp/.gitignore | 1 - record-and-playback/matterhorn/webapp/Gemfile | 7 - .../matterhorn/webapp/Gemfile.lock | 35 -- .../matterhorn/webapp/bigbluebutton.yml | 3 - .../matterhorn/webapp/config.ru | 5 - .../matterhorn/webapp/deploy.sh | 32 -- record-and-playback/matterhorn/webapp/main.rb | 146 ------ .../matterhorn/webapp/views/layout.haml | 11 - .../matterhorn/webapp/views/list.haml | 9 - .../matterhorn/webapp/views/login.haml | 12 - .../matterhorn/webapp/views/metadata.haml | 23 - 23 files changed, 1970 deletions(-) delete mode 100755 record-and-playback/core/lib/recordandplayback/generators/matterhorn_processor.rb delete mode 100644 record-and-playback/matterhorn/.gitignore delete mode 100755 record-and-playback/matterhorn/README delete mode 100755 record-and-playback/matterhorn/matterhorn-install.sh delete mode 100755 record-and-playback/matterhorn/scripts/ingest-status.rb delete mode 100755 record-and-playback/matterhorn/scripts/matt-pub-god-conf.rb delete mode 100755 record-and-playback/matterhorn/scripts/matterhorn.yml delete mode 100644 record-and-playback/matterhorn/scripts/process/matterhorn.rb delete mode 100755 record-and-playback/matterhorn/scripts/publish-matterhorn.rb delete mode 100644 record-and-playback/matterhorn/webapp/.gitignore delete mode 100755 record-and-playback/matterhorn/webapp/Gemfile delete mode 100644 record-and-playback/matterhorn/webapp/Gemfile.lock delete mode 100755 record-and-playback/matterhorn/webapp/bigbluebutton.yml delete mode 100755 record-and-playback/matterhorn/webapp/config.ru delete mode 100755 record-and-playback/matterhorn/webapp/deploy.sh delete mode 100755 record-and-playback/matterhorn/webapp/main.rb delete mode 100755 record-and-playback/matterhorn/webapp/views/layout.haml delete mode 100755 record-and-playback/matterhorn/webapp/views/list.haml delete mode 100755 record-and-playback/matterhorn/webapp/views/login.haml delete mode 100755 record-and-playback/matterhorn/webapp/views/metadata.haml diff --git a/record-and-playback/core/features/step_definitions/process_video_step.rb b/record-and-playback/core/features/step_definitions/process_video_step.rb index 7e5f62d84c..ccd37d8917 100755 --- a/record-and-playback/core/features/step_definitions/process_video_step.rb +++ b/record-and-playback/core/features/step_definitions/process_video_step.rb @@ -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 - - - - diff --git a/record-and-playback/core/lib/recordandplayback/generators/matterhorn_processor.rb b/record-and-playback/core/lib/recordandplayback/generators/matterhorn_processor.rb deleted file mode 100755 index 784c47730d..0000000000 --- a/record-and-playback/core/lib/recordandplayback/generators/matterhorn_processor.rb +++ /dev/null @@ -1,170 +0,0 @@ -# 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 diff --git a/record-and-playback/core/lib/recordandplayback/generators/video.rb b/record-and-playback/core/lib/recordandplayback/generators/video.rb index dc8fd07eec..c0f76f5b0f 100755 --- a/record-and-playback/core/lib/recordandplayback/generators/video.rb +++ b/record-and-playback/core/lib/recordandplayback/generators/video.rb @@ -21,467 +21,11 @@ require 'rubygems' -require 'streamio-ffmpeg' require File.expand_path('../../edl', __FILE__) module BigBlueButton - FFMPEG_CMD_BASE="ffmpeg -loglevel warning -nostats" - - # Strips the audio stream from the video file - # video_in - the FLV file that needs to be stripped of audio - # video_out - the resulting FLV with the audio stripped - # Example: - # strip_audio_from_video(orig-video.flv, video2.flv) - def self.strip_audio_from_video(video_in, video_out) - BigBlueButton.logger.info("Task: Stripping audio from video") - command = "#{FFMPEG_CMD_BASE} -i #{video_in} -an -vcodec copy #{video_out}" - BigBlueButton.execute(command) - # TODO: check for result, raise an exception when there is an error - end - - # Generates a new video file given a start point and a duration - # start - start point of the video_in, in milisseconds - # duration - duration of the new video file, in milisseconds - # video_in - the video to be used as base - # video_out - the resulting new video - def self.trim_video(start, duration, video_in, video_out) - BigBlueButton.logger.info("Task: Trimming video") - command = "#{FFMPEG_CMD_BASE} -i #{video_in} -vcodec copy -acodec copy -ss #{BigBlueButton.ms_to_strtime(start)} -t #{BigBlueButton.ms_to_strtime(duration)} #{video_out}" - BigBlueButton.execute(command) - # TODO: check for result, raise an exception when there is an error - end - - # Create a blank video using Flash Screen Video codec of specific length - # length - length of blank video in seconds - # rate - the frame rate of the video - # blank_canvas - an image (JPG) used to generate the video frames - # video_out - the resulting blank video file - # Example: - # create_blank_video(15, 1000, canvas.jpg, blank-video.flv) - def self.create_blank_deskshare_video(length, rate, blank_canvas, video_out) - BigBlueButton.logger.info("Task: Creating blank deskshare video") - command = "#{FFMPEG_CMD_BASE} -loop 1 -i #{blank_canvas} -t #{length} -r #{rate} -vcodec flashsv #{video_out}" - BigBlueButton.execute(command) - # TODO: check for result, raise exception when there is an error - end - - # Create a blank video of specific length - # length - length of blank video in seconds - # rate - the frame rate of the video - # blank_canvas - an image (JPG) used to generate the video frames - # video_out - the resulting blank video file - # Example: - # create_blank_video(15, 1000, canvas.jpg, blank-video.flv) - def self.create_blank_video(length, rate, blank_canvas, video_out) - BigBlueButton.logger.info("Task: Creating blank video") - command = "#{FFMPEG_CMD_BASE} -y -loop 1 -i #{blank_canvas} -t #{length} -r #{rate} #{video_out}" - BigBlueButton.execute(command) - # TODO: check for result, raise exception when there is an error - end - - def self.create_blank_video_ms(length, rate, blank_canvas, video_out) - BigBlueButton.create_blank_video(BigBlueButton.ms_to_strtime(length), rate, blank_canvas, video_out) - end - - # Creates a blank image file with the specified dimension and color - # width - the width of the image - # height - the height of the image - # color - the color of the image - # out_file - the file of the resulting image - # Example: - # create_blank_canvas(1280, 720, white, blank_canvas.jpg) - def self.create_blank_canvas(width, height, color, out_file) - BigBlueButton.logger.info("Task: Creating blank canvas") - command = "convert -size #{width}x#{height} xc:#{color} #{out_file}" - BigBlueButton.execute(command) - # TODO: check for result, raise an exception when there is an error - end - - # Concatenates several videos into one video - # videos_in - an array of videos that need to be concatenated. The videos - # will be concatenated based on their order in the array. - # video_out - the concatenated video - # - def self.concatenate_videos(videos_in, video_out) - BigBlueButton.logger.info("Task: Concatenating videos") - # This command hangs. - #command = "mencoder -forceidx -of lavf -oac copy -ovc copy -o #{video_out} #{videos_in.join(' ')}" - #BigBlueButton.execute(command) - # Somehow, using the backtick works but not using popen. - #BigBlueButton.logger.info("mencoder -forceidx -of lavf -oac copy -ovc copy -o #{video_out} #{videos_in.join(' ')}") - #`mencoder -forceidx -of lavf -oac copy -ovc copy -o #{video_out} #{videos_in.join(' ')}` - #Converting .flv input videos to .mpg and then concatenating them also works using popen. - - #Create .mpg files - mpgs = [] - videos_in.each do |flv| - if File.extname(flv) == ".mpg" - mpg = flv - else - mpg = "#{flv}.mpg" - BigBlueButton.convert_flv_to_mpg(flv,mpg) - end - mpgs << mpg - end - - target_dir = File.dirname("#{video_out}") - - #Concatenate mpg files - BigBlueButton.concatenate_mpg_files(mpgs,"#{target_dir}/concatenated.mpg") - - #Convert mpg to flv - BigBlueButton.convert_mpg_to_flv("#{target_dir}/concatenated.mpg", video_out) - - end - - #Converts flv to mpg - def self.convert_flv_to_mpg(flv_video, mpg_video_out) - command = "#{FFMPEG_CMD_BASE} -i #{flv_video} -q:v 0 -f mpegts -r 29.97 #{mpg_video_out}" - BigBlueButton.logger.info("Task: Converting .flv to .mpg") - BigBlueButton.execute(command) - end - - #Concatenates mpg files - def self.concatenate_mpg_files(videos_in, mpg_video_out) - command = "cat #{videos_in.join(' ')} > #{mpg_video_out}" - BigBlueButton.logger.info("Task: Concatenating .mpg files") - BigBlueButton.execute(command); - end - - #Converts .mpg to .flv - def self.convert_mpg_to_flv(mpg_video,flv_video_out) - command = "#{FFMPEG_CMD_BASE} -i #{mpg_video} -q:v 0 #{flv_video_out}" - BigBlueButton.logger.info("Task: Converting .mpg to .flv") - BigBlueButton.execute(command); - end - - - # Multiplexes an audio and video - # audio - the audio file - # video - the video file. Must not contain an audio stream. - def self.multiplex_audio_and_video(audio, video, video_out) - BigBlueButton.logger.info("Task: Multiplexing audio and video") - command = "#{FFMPEG_CMD_BASE} -i #{audio} -i #{video} -map 1:0 -map 0:0 -ar 44100 #{video_out}" - BigBlueButton.execute(command) - # TODO: check result, raise an exception when there is an error - end - - - # Determine the video padding we need to generate. - def self.generate_video_paddings(events, first_timestamp, last_timestamp) - BigBlueButton.logger.info("Task: Generating video paddings") - paddings = [] - events.sort! {|a,b| a[:start_timestamp] <=> b[:start_timestamp]} - - length_of_gap = events[0][:start_timestamp] - first_timestamp - if (length_of_gap > 0) - paddings << {:start_timestamp => first_timestamp, :stop_timestamp => events[0][:start_timestamp] - 1, :gap => true, :stream => "blank-beginning.flv"} - end - - i = 0 - while i < events.length - 1 - ar_prev = events[i] - ar_next = events[i+1] - length_of_gap = ar_next[:start_timestamp] - ar_prev[:stop_timestamp] - - if (length_of_gap > 0) - paddings << {:start_timestamp => ar_prev[:stop_timestamp] + 1, :stop_timestamp => ar_next[:start_timestamp] - 1, :gap => true, :stream => "blank-#{i}.flv"} - end - - i += 1 - end - - length_of_gap = last_timestamp - events[-1][:stop_timestamp] - if (length_of_gap > 0) - paddings << {:start_timestamp => events[-1][:stop_timestamp] + 1, :stop_timestamp => last_timestamp - 1, :gap => true, :stream => "blank-end.flv"} - end - - paddings - end - - # Determine the deskshare padding we need to generate. - def self.generate_deskshare_paddings(events, first_timestamp, last_timestamp) - BigBlueButton.logger.info("Task: Generating deskshare paddings") - paddings = [] - events.sort! {|a,b| a[:start_timestamp] <=> b[:start_timestamp]} - - length_of_gap = events[0][:start_timestamp] - first_timestamp - if (length_of_gap > 0) - paddings << {:start_timestamp => first_timestamp, :stop_timestamp => events[0][:start_timestamp] - 1, :gap => true, :stream => "ds-blank-beginning.flv"} - end - - i = 0 - while i < events.length - 1 - ar_prev = events[i] - ar_next = events[i+1] - length_of_gap = ar_next[:start_timestamp] - ar_prev[:stop_timestamp] - - if (length_of_gap > 0) - paddings << {:start_timestamp => ar_prev[:stop_timestamp] + 1, :stop_timestamp => ar_next[:start_timestamp] - 1, :gap => true, :stream => "ds-blank-#{i}.flv"} - end - - i += 1 - end - - length_of_gap = last_timestamp - events[-1][:stop_timestamp] - if (length_of_gap > 0) - paddings << {:start_timestamp => events[-1][:stop_timestamp] + 1, :stop_timestamp => last_timestamp - 1, :gap => true, :stream => "ds-blank-end.flv"} - end - - paddings - end - - - def self.get_video_height(video) - FFMPEG::Movie.new(video).height - end - - def self.get_video_width(video) - FFMPEG::Movie.new(video).width - end - - def self.get_video_duration(video) - FFMPEG::Movie.new(video).duration - end - - def self.get_video_bitrate(video) - FFMPEG::Movie.new(video).bitrate - end - - def self.get_video_framerate(video) - FFMPEG::Movie.new(video).frame_rate - end - - MAX_VID_WIDTH = 640 - MAX_VID_HEIGHT = 480 - - # Calculate the anamorphic factor for this video. - # see http://howto-pages.org/ffmpeg/ - # We need to calculate how much we need to scale - # the width and height to maintain a 4/3 aspect ratio - def self.calc_anamorphic_factor(width, height) - BigBlueButton.logger.info("Task: Calculating anamorphic factor of video") - (4.0 * height) / (width * 3.0) - end - - # Is the video orientation in portrait mode? - def self.portrait?(width, height) - BigBlueButton.logger.info("Task: Determining if the video orientation in portrait mode") - larger_than_max?(width, height) and (width < height) - end - - # Is the video orientation in landscape mode? - def self.landscape?(width, height) - BigBlueButton.logger.info("Task: Determining if the video orientation in landscape mode") - larger_than_max?(width, height) and (width > height) - end - - # Is the video width and height bigger than 640x480? - def self.larger_than_max?(width, height) - BigBlueButton.logger.info("Task: Determining if the video width and height bigger than max values") - (width > MAX_VID_WIDTH) and (height > MAX_VID_HEIGHT) - end - - # Calculate the height of the video to maintain 4/3 aspect ratio. - # We want to fit the video into 640/480 size. If we shrink the width (W) - # of the video to 640, calculate the height (H) using the formula. - # (W/H)*(anamorphic_factor) = (4/3) - # - def self.calc_height(anamorphic_factor) - BigBlueButton.logger.info("Task: Calculating height of video to maintain 4/3 aspect ratio") - (3 * MAX_VID_WIDTH * anamorphic_factor) / 4 - end - - # Calculate the width of the video to maintain 4/3 aspect ratio. - # We want to fit the video into 640/480 size. If we shrink the height (H) - # of the video to 480, calculate the width (W) using the formula. - # (W/H)*(anamorphic_factor) = (4/3) - # - def self.calc_width(anamorphic_factor) - BigBlueButton.logger.info("Task: Calculating width of video to maintain 4/3 aspect ratio") - (4 * MAX_VID_HEIGHT) / (3 * anamorphic_factor) - end - - # Determine if video is less that 640x480. - def self.fits_640_by_480?(width, height) - BigBlueButton.logger.info("Task: Determine if video is less that max width and height") - (width < MAX_VID_WIDTH) and (height < MAX_VID_HEIGHT) - end - - # Determine the width and height of the video that fits - # within 640x480 while maintaining aspect ratio. - def self.fit_to_640_by_480(width, height) - BigBlueButton.logger.info("Fitting the video to the max width and height") - anamorphic_factor = calc_anamorphic_factor(width, height) - if (width <= MAX_VID_WIDTH) and (height > MAX_VID_HEIGHT) - # Fit the video vertically and adjust the width then pad it to fit into 640x480 video. - width = calc_width(anamorphic_factor) - height = MAX_VID_HEIGHT - elsif (height <= MAX_VID_HEIGHT) and (width > MAX_VID_WIDTH) - # Fit the video horizontally and adjust the height then pad the top and bottom to fit the 640x480 video. - height = calc_height(anamorphic_factor) - width = MAX_VID_WIDTH - else - if (height > width) - width = calc_width(anamorphic_factor) - height = MAX_VID_HEIGHT - elsif (width >= height) - height = calc_height(anamorphic_factor) - width = MAX_VID_WIDTH - end - end - {:width => width.to_i, :height => height.to_i} - end - - def self.fit_to(width, height, fit_width, fit_height) - BigBlueButton.logger.info("Fitting the video resolution from #{width}x#{height} to #{fit_width}x#{fit_height}") - aspect_ratio = width / height.to_f - if fit_width / fit_height.to_f > aspect_ratio - height = fit_height - width = height * aspect_ratio - else - width = fit_width - height = width / aspect_ratio - end - BigBlueButton.logger.info("Best fit width #{width.to_i} height #{height.to_i}") - {:width => width.to_i, :height => height.to_i} - end - - # Scale the video to 640x480 or smaller - def self.scale_to_640_x_480(width, height) - BigBlueButton.logger.info("Scaling the video to the max width and height") - if not fits_640_by_480?(width, height) - while (width > MAX_VID_WIDTH or height > MAX_VID_HEIGHT) - scaled_vid = fit_to_640_by_480(width, height) - width = scaled_vid[:width] - height = scaled_vid[:height] - end - end - {:width => width, :height => height} - end - - def self.process_webcam(target_dir, temp_dir, meeting_id) - BigBlueButton.logger.info("Processing webcam") - # Process audio - BigBlueButton::AudioProcessor.process("#{temp_dir}/#{meeting_id}", "#{target_dir}/audio") - - # 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) - last_timestamp = BigBlueButton::Events.last_event_timestamp(events_xml) - start_evt = BigBlueButton::Events.get_start_video_events(events_xml) - stop_evt = BigBlueButton::Events.get_stop_video_events(events_xml) - matched_evts = BigBlueButton::Events.match_start_and_stop_video_events(start_evt, stop_evt) - - paddings = BigBlueButton.generate_video_paddings(matched_evts, first_timestamp, last_timestamp) - - webcams = [] - paddings.concat(matched_evts).sort{|a,b| a[:start_timestamp] <=> b[:start_timestamp]}.each do |comb| - if (comb[:gap]) - blank_flv = "#{temp_dir}/#{comb[:stream]}" - webcams << blank_flv - BigBlueButton.create_blank_video((comb[:stop_timestamp] - comb[:start_timestamp].to_f)/1000.0, 1000, blank_canvas, blank_flv) - else - stripped_webcam = "#{temp_dir}/stripped-wc-#{comb[:stream]}.flv" - BigBlueButton.strip_audio_from_video("#{video_dir}/#{comb[:stream]}.flv", stripped_webcam) - scaled_flv = "#{temp_dir}/#{meeting_id}/scaled-wc-#{comb[:stream]}.flv" - webcams << scaled_flv - frame_size = BigBlueButton.scale_to_640_x_480(BigBlueButton.get_video_width(stripped_webcam), BigBlueButton.get_video_height(stripped_webcam)) - - width = frame_size[:width] - height = frame_size[:height] - - frame_size = "-s #{width}x#{height}" - side_padding = ((MAX_VID_WIDTH - width) / 2).to_i - top_bottom_padding = ((MAX_VID_HEIGHT - height) / 2).to_i - - # Use for newer version of FFMPEG - padding = "-vf pad=#{MAX_VID_WIDTH}:#{MAX_VID_HEIGHT}:#{side_padding}:#{top_bottom_padding}:FFFFFF" - command = "#{FFMPEG_CMD_BASE} -i #{stripped_webcam} -aspect 4:3 -r 1000 -q:v 0 #{frame_size} #{padding} #{scaled_flv}" - #BigBlueButton.logger.info(command) - #IO.popen(command) - #Process.wait - BigBlueButton.execute(command) - 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 - - def self.process_deskstop_sharing(target_dir, temp_dir, meeting_id) - BigBlueButton.logger.info("Processing desktop sharing") - blank_canvas = "#{temp_dir}/ds-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) - last_timestamp = BigBlueButton::Events.last_event_timestamp(events_xml) - - start_evts = BigBlueButton::Events.get_start_deskshare_events(events_xml) - stop_evts = BigBlueButton::Events.get_stop_deskshare_events(events_xml) - - matched_evts = BigBlueButton::Events.match_start_and_stop_video_events(start_evts, stop_evts) - paddings = BigBlueButton.generate_deskshare_paddings(matched_evts, first_timestamp, last_timestamp) - - flvs = [] - paddings.concat(matched_evts).sort{|a,b| a[:start_timestamp] <=> b[:start_timestamp]}.each do |comb| - if (comb[:gap]) - blank_flv = "#{temp_dir}/#{comb[:stream]}" - flvs << blank_flv - BigBlueButton.create_blank_deskshare_video((comb[:stop_timestamp] - comb[:start_timestamp].to_f)/1000, 1000, blank_canvas, blank_flv) - else - deskshare_dir = "#{temp_dir}/#{meeting_id}/deskshare" - scaled_flv = "#{deskshare_dir}/scaled-#{comb[:stream]}" - padded_flv = "#{deskshare_dir}/padded-#{comb[:stream]}" - flvs << padded_flv - flv_in = "#{deskshare_dir}/#{comb[:stream]}" - - deskshare_params = "-aspect 4:3 -r 1000 -q:v 0 -vcodec flashsv" - - #Scale options - frame_size = BigBlueButton.scale_to_640_x_480(BigBlueButton.get_video_width(flv_in), BigBlueButton.get_video_height(flv_in)) - width = frame_size[:width] - height = frame_size[:height] - frame_size = "-s #{width}x#{height}" - - #Scale video - scale_command = "#{FFMPEG_CMD_BASE} -i #{flv_in} #{deskshare_params} #{frame_size} #{scaled_flv}" - BigBlueButton.execute(scale_command) - - # Padding options - side_padding = ((MAX_VID_WIDTH - width) / 2).to_i - top_bottom_padding = ((MAX_VID_HEIGHT - height) / 2).to_i - padding_params = "-vf pad=#{MAX_VID_WIDTH}:#{MAX_VID_HEIGHT}:#{side_padding}:#{top_bottom_padding}:FFFFFF" - - #Pad video - padding_command = "#{FFMPEG_CMD_BASE} -i #{scaled_flv} #{deskshare_params} #{padding_params} #{padded_flv}" - BigBlueButton.execute(padding_command) - - end - end - - BigBlueButton.concatenate_videos(flvs, "#{target_dir}/deskshare.flv") - end - - # Converts a time in milisseconds to a format that FFmpeg understands - # ms - time in milisseconds - # Example: - # ms_to_strtime(1000) - # Output: - # 00:00:01.000 - def self.ms_to_strtime(ms) - t = Time.at(ms / 1000, (ms % 1000) * 1000) - return t.getutc.strftime("%H:%M:%S.%L") - end - def BigBlueButton.process_multiple_videos(target_dir, temp_dir, meeting_id, output_width, output_height, audio_offset, include_deskshare=false) BigBlueButton.logger.info("Processing webcam videos") @@ -542,20 +86,8 @@ module BigBlueButton filename = BigBlueButton::EDL::encode( audio_file, video_file, format, "#{target_dir}/webcams", audio_offset) end - end - - # Muxes audio with deskshare video - # audio_file : Audio of the recording - # deskshare_file : Video of shared desktop of the recording - - def self.mux_audio_deskshare(target_dir, audio_file, deskshare_file) - command = "#{FFMPEG_CMD_BASE} -i #{audio_file} -i #{deskshare_file} -vcodec flv -b 1000k -threads 0 -map 1:0 -map 0:0 -ar 22050 #{target_dir}/muxed_audio_deskshare.flv" - BigBlueButton.execute(command) - FileUtils.mv("#{target_dir}/muxed_audio_deskshare.flv","#{target_dir}/deskshare.flv") - end - end diff --git a/record-and-playback/core/spec/recordandplayback/deskshare_generator_spec.rb b/record-and-playback/core/spec/recordandplayback/deskshare_generator_spec.rb index 3b6c81f658..f6e3424323 100755 --- a/record-and-playback/core/spec/recordandplayback/deskshare_generator_spec.rb +++ b/record-and-playback/core/spec/recordandplayback/deskshare_generator_spec.rb @@ -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 diff --git a/record-and-playback/matterhorn/.gitignore b/record-and-playback/matterhorn/.gitignore deleted file mode 100644 index a5922f4e53..0000000000 --- a/record-and-playback/matterhorn/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.log -thin.pid diff --git a/record-and-playback/matterhorn/README b/record-and-playback/matterhorn/README deleted file mode 100755 index fd1aa465f5..0000000000 --- a/record-and-playback/matterhorn/README +++ /dev/null @@ -1,234 +0,0 @@ -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 - diff --git a/record-and-playback/matterhorn/matterhorn-install.sh b/record-and-playback/matterhorn/matterhorn-install.sh deleted file mode 100755 index 1485c302ea..0000000000 --- a/record-and-playback/matterhorn/matterhorn-install.sh +++ /dev/null @@ -1,301 +0,0 @@ -#!/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" - - diff --git a/record-and-playback/matterhorn/scripts/ingest-status.rb b/record-and-playback/matterhorn/scripts/ingest-status.rb deleted file mode 100755 index 70511c54fb..0000000000 --- a/record-and-playback/matterhorn/scripts/ingest-status.rb +++ /dev/null @@ -1,90 +0,0 @@ -# ------------------------------------------------------------- -# 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" diff --git a/record-and-playback/matterhorn/scripts/matt-pub-god-conf.rb b/record-and-playback/matterhorn/scripts/matt-pub-god-conf.rb deleted file mode 100755 index b827df3091..0000000000 --- a/record-and-playback/matterhorn/scripts/matt-pub-god-conf.rb +++ /dev/null @@ -1,55 +0,0 @@ -# -# 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 - diff --git a/record-and-playback/matterhorn/scripts/matterhorn.yml b/record-and-playback/matterhorn/scripts/matterhorn.yml deleted file mode 100755 index aea57acb04..0000000000 --- a/record-and-playback/matterhorn/scripts/matterhorn.yml +++ /dev/null @@ -1,11 +0,0 @@ -# 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/ - diff --git a/record-and-playback/matterhorn/scripts/process/matterhorn.rb b/record-and-playback/matterhorn/scripts/process/matterhorn.rb deleted file mode 100644 index ba506fc693..0000000000 --- a/record-and-playback/matterhorn/scripts/process/matterhorn.rb +++ /dev/null @@ -1,88 +0,0 @@ -# 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 - diff --git a/record-and-playback/matterhorn/scripts/publish-matterhorn.rb b/record-and-playback/matterhorn/scripts/publish-matterhorn.rb deleted file mode 100755 index 412dc0edcf..0000000000 --- a/record-and-playback/matterhorn/scripts/publish-matterhorn.rb +++ /dev/null @@ -1,73 +0,0 @@ -# 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 diff --git a/record-and-playback/matterhorn/webapp/.gitignore b/record-and-playback/matterhorn/webapp/.gitignore deleted file mode 100644 index 8b13789179..0000000000 --- a/record-and-playback/matterhorn/webapp/.gitignore +++ /dev/null @@ -1 +0,0 @@ - diff --git a/record-and-playback/matterhorn/webapp/Gemfile b/record-and-playback/matterhorn/webapp/Gemfile deleted file mode 100755 index 9e33ebb994..0000000000 --- a/record-and-playback/matterhorn/webapp/Gemfile +++ /dev/null @@ -1,7 +0,0 @@ -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" diff --git a/record-and-playback/matterhorn/webapp/Gemfile.lock b/record-and-playback/matterhorn/webapp/Gemfile.lock deleted file mode 100644 index fff573cf48..0000000000 --- a/record-and-playback/matterhorn/webapp/Gemfile.lock +++ /dev/null @@ -1,35 +0,0 @@ -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 diff --git a/record-and-playback/matterhorn/webapp/bigbluebutton.yml b/record-and-playback/matterhorn/webapp/bigbluebutton.yml deleted file mode 100755 index 764e271eeb..0000000000 --- a/record-and-playback/matterhorn/webapp/bigbluebutton.yml +++ /dev/null @@ -1,3 +0,0 @@ -bbb_salt: 'e49e0123e531d0816abaf4bc1b1d7f11' -bbb_url: 'http://192.168.1.37/bigbluebutton/api' -bbb_version: '0.9.0' diff --git a/record-and-playback/matterhorn/webapp/config.ru b/record-and-playback/matterhorn/webapp/config.ru deleted file mode 100755 index 9b4dc738c8..0000000000 --- a/record-and-playback/matterhorn/webapp/config.ru +++ /dev/null @@ -1,5 +0,0 @@ -require 'rubygems' -require 'sinatra' - -require 'main' -run Main \ No newline at end of file diff --git a/record-and-playback/matterhorn/webapp/deploy.sh b/record-and-playback/matterhorn/webapp/deploy.sh deleted file mode 100755 index 1422de98a9..0000000000 --- a/record-and-playback/matterhorn/webapp/deploy.sh +++ /dev/null @@ -1,32 +0,0 @@ -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 "**************************************************" diff --git a/record-and-playback/matterhorn/webapp/main.rb b/record-and-playback/matterhorn/webapp/main.rb deleted file mode 100755 index 489293331e..0000000000 --- a/record-and-playback/matterhorn/webapp/main.rb +++ /dev/null @@ -1,146 +0,0 @@ -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 - - - - - - diff --git a/record-and-playback/matterhorn/webapp/views/layout.haml b/record-and-playback/matterhorn/webapp/views/layout.haml deleted file mode 100755 index 63de1798f6..0000000000 --- a/record-and-playback/matterhorn/webapp/views/layout.haml +++ /dev/null @@ -1,11 +0,0 @@ -!!! -%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 diff --git a/record-and-playback/matterhorn/webapp/views/list.haml b/record-and-playback/matterhorn/webapp/views/list.haml deleted file mode 100755 index 1b0996d077..0000000000 --- a/record-and-playback/matterhorn/webapp/views/list.haml +++ /dev/null @@ -1,9 +0,0 @@ -%h1 BigBlueButton Conferences Running -%p= @message -%ul{ :id => "conference-list" } - - @conflist.each do |attr| - %li - %a{ :href => "enter?meetingid=#{attr[:meetingID]}" }= attr[:meetingID] - %p="running:#{attr[:running]}" -- if session['role'] == 'instructor' - %a{ :href => "metadata" } Create Conference \ No newline at end of file diff --git a/record-and-playback/matterhorn/webapp/views/login.haml b/record-and-playback/matterhorn/webapp/views/login.haml deleted file mode 100755 index 8d466ee793..0000000000 --- a/record-and-playback/matterhorn/webapp/views/login.haml +++ /dev/null @@ -1,12 +0,0 @@ -%h1 Personal Capture Using BigBlueButton -%form{:action => "login", :method => "post"} - %legend - Login into the Application - %p - %label{:for => "txtusername"} Username: - %input{:name => "txtusername" , :type => "text", :id => "txtusername"} - %p - %label{:for => "txtpassword"} Password: - %input{:name => "txtpassword" , :type => "password", :id => "txtpassword"} - %p - %input{:type => "submit", :value=>"Login"} diff --git a/record-and-playback/matterhorn/webapp/views/metadata.haml b/record-and-playback/matterhorn/webapp/views/metadata.haml deleted file mode 100755 index 07d08ee47c..0000000000 --- a/record-and-playback/matterhorn/webapp/views/metadata.haml +++ /dev/null @@ -1,23 +0,0 @@ -%h1 Create BigBlueButton Conference -%form{:action => "metadata/process", :method => "post"} - %fieldset - %legend Meeting Info - %p - %label{:for => "txtname"} Conference Name: - %input{:name => "txtname" , :type => "text", :id => "txtname"} - %p - %label{:for => "txtid"} Conference ID: - %input{:name => "txtid" , :type => "text", :id => "txtid"} - %fieldset - %legend Metadata Info - %p - %label{:for => "txttitle"} Title: - %input{:name => "txttitle" , :type => "text", :id => "txttitle"} - %p - %label{:for => "txtseries"} Series: - %input{:name => "txtseries" , :type => "text", :id => "txtseries"} - %p - %label{:for => "txtinstructor"} Instructor: - %input{:name => "txtinstructor" , :type => "text", :id => "txtinstructor"} - %p - %input{:type => "submit", :value=>"Submit Metadata"} -- GitLab