- extract metadata from events.xml and generate index.html in publish dir for simple playback

This commit is contained in:
Richard Alam 2011-05-24 18:16:54 -04:00
parent c89cc5b777
commit 0c128872ea
7 changed files with 95 additions and 32 deletions

View File

@ -3,6 +3,18 @@ require 'nokogiri'
module BigBlueButton module BigBlueButton
module Events module Events
def self.get_meeting_metadata(events_xml)
doc = Nokogiri::XML(File.open(events_xml))
metadata = {}
doc.xpath("//metadata").each do |e|
e.keys.each do |k|
metadata[k] = e.attribute(k)
end
end
metadata
end
# Get the timestamp of the first event. # Get the timestamp of the first event.
def self.first_event_timestamp(events_xml) def self.first_event_timestamp(events_xml)
doc = Nokogiri::XML(File.open(events_xml)) doc = Nokogiri::XML(File.open(events_xml))

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<recording meeting_id="974a4b8c-5bf7-4382-b4cd-eb26af7dfcc2"> <recording meeting_id="974a4b8c-5bf7-4382-b4cd-eb26af7dfcc2">
<metadata> <metadata
<title>Business Ecosystem</title> title="Business Ecosystem"
<subject>TTMG 5001</subject> subject="TTMG 5001"
<description>How to manage your product's ecosystem</description> description="How to manage your product's ecosystem"
<creator>Richard Alam</creator> creator="Richard Alam"
<contributor>Popen3</contributor> contributor="Popen3"
<language>en-US</language> language="en-US"
<identifier>ttmg-5001-2</identifier> identifier="ttmg-5001-2"
</metadata> />
<event timestamp="1305560822952" module="PARTICIPANT" eventname="ParticipantJoinEvent"> <event timestamp="1305560822952" module="PARTICIPANT" eventname="ParticipantJoinEvent">
<role>MODERATOR</role> <role>MODERATOR</role>
<userId>11</userId> <userId>11</userId>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<recording meeting_id="974a4b8c-5bf7-4382-b4cd-eb26af7dfcc2">
<metadata
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"
/>
</recording>

View File

@ -0,0 +1,16 @@
require 'spec_helper'
require 'redis'
module BigBlueButton
describe Events do
context "#success" do
it "should extract the meeting metadata" do
dir = "resources/raw"
events_xml = "#{dir}/metadata.xml"
metadata = BigBlueButton::Events.get_meeting_metadata(events_xml)
puts metadata
puts metadata['title']
end
end
end
end

View File

@ -34,15 +34,12 @@ FileUtils.cp("#{process_dir}/deskshare.flv", target_dir)
FileUtils.cp("#{process_dir}/manifest.xml", target_dir) FileUtils.cp("#{process_dir}/manifest.xml", target_dir)
FileUtils.cp("#{process_dir}/dublincore.xml", target_dir) FileUtils.cp("#{process_dir}/dublincore.xml", target_dir)
puts Dir.pwd
Dir.chdir(target_dir) do 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") BigBlueButton::MatterhornProcessor.zip_artifacts("muxed-audio-webcam.flv", "deskshare.flv", "dublincore.xml", "manifest.xml", "#{meeting_id}.zip")
end end
puts Dir.pwd
cmd = "scp -i #{scp_key} #{target_dir}/#{meeting_id}.zip #{scp_user}@#{scp_server}:#{scp_inbox}" command = "scp -i #{scp_key} #{target_dir}/#{meeting_id}.zip #{scp_user}@#{scp_server}:#{scp_inbox}"
puts cmd BigBlueButton.logger.info(command)
Open3.popen3(cmd) do | stdin, stdout, stderr| Open3.popen3(command) do | stdin, stdout, stderr|
p $?.exitstatus BigBlueButton.logger.info("scp result=#{$?.exitstatus}")
end end

View File

@ -61,7 +61,7 @@ function getUrlParameters() {
} }
}); });
var p = 0; var p = 0;
$(xml).find("event").each(function(){ $(xml).find("event").each(function(){
var event = $(this); var event = $(this);
if (event.attr('eventname') === 'SharePresentationEvent'){ if (event.attr('eventname') === 'SharePresentationEvent'){
@ -70,10 +70,10 @@ function getUrlParameters() {
time : (event.attr('timestamp') - start) / 1000 time : (event.attr('timestamp') - start) / 1000
}; };
presentations[p] = sharePresentationEvent; presentations[p] = sharePresentationEvent;
p++; p++;
} }
}); });
var i = 0; var i = 0;
$(xml).find("event").each(function(){ $(xml).find("event").each(function(){
var event = $(this); var event = $(this);
@ -85,7 +85,8 @@ function getUrlParameters() {
slideTransitions[i] = transitionEvent; slideTransitions[i] = transitionEvent;
i++; i++;
} }
});
});
} }
function onTimeUpdate(){ function onTimeUpdate(){
@ -98,19 +99,19 @@ function getUrlParameters() {
return; return;
} }
var lastTransition = slideTransitions[slideTransitions.length-1].time; var lastTransition = slideTransitions[slideTransitions.length-1].time;
if (lastTransition < now) { if (lastTransition < now) {
var slideIndex = parseInt(slideTransitions[slideTransitions.length-1].slide) + 1; var slideIndex = parseInt(slideTransitions[slideTransitions.length-1].slide) + 1;
var slideToShow = PRESENTATION + presentationName + '/slide-' + slideIndex + '.png'; var slideToShow = PRESENTATION + presentationName + '/slide-' + slideIndex + '.png';
$('#imgSlide').attr('src', slideToShow); $('#imgSlide').attr('src', slideToShow);
return; return;
} }
$.each(presentations, function(index, value){ $.each(presentations, function(index, value){
var time = value.time; var time = value.time;
if (time < now && presentations[index].time < now){ if (time < now && presentations[index].time < now){
presentationName = presentations[index].name presentationName = presentations[index].name
} }
}); });
@ -121,7 +122,7 @@ function getUrlParameters() {
if ((time < now && slideTransitions[index + 1].time > now)) { if ((time < now && slideTransitions[index + 1].time > now)) {
var slideIndex = parseInt(value.slide) + 1; var slideIndex = parseInt(value.slide) + 1;
var slideToShow = PRESENTATION + presentationName + '/slide-' + slideIndex + '.png'; var slideToShow = PRESENTATION + presentationName + '/slide-' + slideIndex + '.png';
$('#imgSlide').attr('src', slideToShow); $('#imgSlide').attr('src', slideToShow);
} }
}); });

View File

@ -20,7 +20,7 @@ simple_props = YAML::load(File.open('simple.yml'))
recording_dir = bbb_props['recording_dir'] recording_dir = bbb_props['recording_dir']
process_dir = "#{recording_dir}/process/simple/#{meeting_id}" process_dir = "#{recording_dir}/process/simple/#{meeting_id}"
publish_dir = simple_props['publish_dir'] publish_dir = simple_props['publish_dir']
playback_host = simple_prop['playback_host'] playback_host = simple_props['playback_host']
target_dir = "#{recording_dir}/publish/simple/#{meeting_id}" target_dir = "#{recording_dir}/publish/simple/#{meeting_id}"
if FileTest.directory?(target_dir) if FileTest.directory?(target_dir)
@ -40,10 +40,35 @@ FileUtils.cp_r("#{process_dir}/presentation", package_dir)
FileUtils.cp_r(package_dir, publish_dir) FileUtils.cp_r(package_dir, publish_dir)
dir_list = Dir.entries(publish_dir) - ['.', '..'] dir_list = Dir.entries(publish_dir) - ['.', '..']
recordings = []
dir_list.each do |d| dir_list.each do |d|
if File::directory?("#{publish_dir}/#{d}") if File::directory?("#{publish_dir}/#{d}")
puts d rec_time = File.ctime("#{publish_dir}/#{d}")
play_link = "http://#{playback_host}/playback/playback.html?meetingId=#{d}"
metadata = BigBlueButton::Events.get_meeting_metadata("#{publish_dir}/#{d}/events.xml")
puts metadata
recordings << {:rec_time => rec_time, :link => play_link, :title => metadata['title']}
end end
end end
b = Builder::XmlMarkup.new(:indent => 2)
html = b.html {
b.head {
b.title "Simple Playback Recordings"
}
b.body {
b.h1 "Simple Playback Recordings"
recordings.each do |r|
b.p { |y|
y << r[:rec_time].to_s
b.a({:href => r[:link]}, r[:title])
}
end
}
}
index_html = File.new("#{publish_dir}/index.html","w")
index_html.write(html)
index_html.close