- extract metadata from events.xml and generate index.html in publish dir for simple playback
This commit is contained in:
parent
c89cc5b777
commit
0c128872ea
@ -3,6 +3,18 @@ require 'nokogiri'
|
||||
|
||||
module BigBlueButton
|
||||
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.
|
||||
def self.first_event_timestamp(events_xml)
|
||||
doc = Nokogiri::XML(File.open(events_xml))
|
||||
|
@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<recording meeting_id="974a4b8c-5bf7-4382-b4cd-eb26af7dfcc2">
|
||||
<metadata>
|
||||
<title>Business Ecosystem</title>
|
||||
<subject>TTMG 5001</subject>
|
||||
<description>How to manage your product's ecosystem</description>
|
||||
<creator>Richard Alam</creator>
|
||||
<contributor>Popen3</contributor>
|
||||
<language>en-US</language>
|
||||
<identifier>ttmg-5001-2</identifier>
|
||||
</metadata>
|
||||
<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"
|
||||
/>
|
||||
<event timestamp="1305560822952" module="PARTICIPANT" eventname="ParticipantJoinEvent">
|
||||
<role>MODERATOR</role>
|
||||
<userId>11</userId>
|
||||
|
12
record-and-playback/core/resources/raw/metadata.xml
Executable file
12
record-and-playback/core/resources/raw/metadata.xml
Executable 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>
|
16
record-and-playback/core/spec/recordandplayback/events_spec.rb
Executable file
16
record-and-playback/core/spec/recordandplayback/events_spec.rb
Executable 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
|
@ -34,15 +34,12 @@ FileUtils.cp("#{process_dir}/deskshare.flv", target_dir)
|
||||
FileUtils.cp("#{process_dir}/manifest.xml", target_dir)
|
||||
FileUtils.cp("#{process_dir}/dublincore.xml", target_dir)
|
||||
|
||||
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 #{scp_key} #{target_dir}/#{meeting_id}.zip #{scp_user}@#{scp_server}:#{scp_inbox}"
|
||||
puts cmd
|
||||
Open3.popen3(cmd) do | stdin, stdout, stderr|
|
||||
p $?.exitstatus
|
||||
command = "scp -i #{scp_key} #{target_dir}/#{meeting_id}.zip #{scp_user}@#{scp_server}:#{scp_inbox}"
|
||||
BigBlueButton.logger.info(command)
|
||||
Open3.popen3(command) do | stdin, stdout, stderr|
|
||||
BigBlueButton.logger.info("scp result=#{$?.exitstatus}")
|
||||
end
|
||||
|
@ -61,7 +61,7 @@ function getUrlParameters() {
|
||||
}
|
||||
});
|
||||
|
||||
var p = 0;
|
||||
var p = 0;
|
||||
$(xml).find("event").each(function(){
|
||||
var event = $(this);
|
||||
if (event.attr('eventname') === 'SharePresentationEvent'){
|
||||
@ -70,10 +70,10 @@ function getUrlParameters() {
|
||||
time : (event.attr('timestamp') - start) / 1000
|
||||
};
|
||||
presentations[p] = sharePresentationEvent;
|
||||
p++;
|
||||
p++;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var i = 0;
|
||||
$(xml).find("event").each(function(){
|
||||
var event = $(this);
|
||||
@ -85,7 +85,8 @@ function getUrlParameters() {
|
||||
slideTransitions[i] = transitionEvent;
|
||||
i++;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function onTimeUpdate(){
|
||||
@ -98,19 +99,19 @@ function getUrlParameters() {
|
||||
return;
|
||||
}
|
||||
|
||||
var lastTransition = slideTransitions[slideTransitions.length-1].time;
|
||||
if (lastTransition < now) {
|
||||
var slideIndex = parseInt(slideTransitions[slideTransitions.length-1].slide) + 1;
|
||||
var slideToShow = PRESENTATION + presentationName + '/slide-' + slideIndex + '.png';
|
||||
$('#imgSlide').attr('src', slideToShow);
|
||||
return;
|
||||
}
|
||||
var lastTransition = slideTransitions[slideTransitions.length-1].time;
|
||||
if (lastTransition < now) {
|
||||
var slideIndex = parseInt(slideTransitions[slideTransitions.length-1].slide) + 1;
|
||||
var slideToShow = PRESENTATION + presentationName + '/slide-' + slideIndex + '.png';
|
||||
$('#imgSlide').attr('src', slideToShow);
|
||||
return;
|
||||
}
|
||||
|
||||
$.each(presentations, function(index, value){
|
||||
var time = value.time;
|
||||
|
||||
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)) {
|
||||
var slideIndex = parseInt(value.slide) + 1;
|
||||
var slideToShow = PRESENTATION + presentationName + '/slide-' + slideIndex + '.png';
|
||||
var slideToShow = PRESENTATION + presentationName + '/slide-' + slideIndex + '.png';
|
||||
$('#imgSlide').attr('src', slideToShow);
|
||||
}
|
||||
});
|
||||
|
@ -20,7 +20,7 @@ simple_props = YAML::load(File.open('simple.yml'))
|
||||
recording_dir = bbb_props['recording_dir']
|
||||
process_dir = "#{recording_dir}/process/simple/#{meeting_id}"
|
||||
publish_dir = simple_props['publish_dir']
|
||||
playback_host = simple_prop['playback_host']
|
||||
playback_host = simple_props['playback_host']
|
||||
|
||||
target_dir = "#{recording_dir}/publish/simple/#{meeting_id}"
|
||||
if FileTest.directory?(target_dir)
|
||||
@ -40,10 +40,35 @@ FileUtils.cp_r("#{process_dir}/presentation", package_dir)
|
||||
|
||||
FileUtils.cp_r(package_dir, publish_dir)
|
||||
dir_list = Dir.entries(publish_dir) - ['.', '..']
|
||||
recordings = []
|
||||
dir_list.each do |d|
|
||||
if File::directory?("#{publish_dir}/#{d}")
|
||||
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
|
||||
|
||||
|
||||
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
|
Loading…
Reference in New Issue
Block a user