Merge pull request #4194 from kepstin/bbb-20-rec-fixes

Have presentation recording script remember current slide
This commit is contained in:
Richard Alam 2017-08-02 17:24:11 -04:00 committed by GitHub
commit e16a2711de

View File

@ -717,27 +717,38 @@ def processSlideEvents
if(node[:timestamp].to_f > $rec_events.last[:stop_timestamp].to_f) if(node[:timestamp].to_f > $rec_events.last[:stop_timestamp].to_f)
next next
end end
eventname = node['eventname'] eventname = node['eventname']
if eventname == "SharePresentationEvent"
$presentation_name = node.xpath(".//presentationName")[0].text()
else
slide_timestamp = node[:timestamp] slide_timestamp = node[:timestamp]
if eventname == "DeskshareStartedEvent"
deskshare_slide = true
slide_number = -1
elsif eventname == "DeskshareStoppedEvent"
deskshare_slide = false
# TODO: Watch out for NPE
slide_number = getLastProcessedSlide(index).xpath(".//slide")[0].text().to_i
else
slide_number = node.xpath(".//slide")[0].text().to_i
end
slide_start = ( translateTimestamp(slide_timestamp) / 1000 ).round(1) slide_start = ( translateTimestamp(slide_timestamp) / 1000 ).round(1)
orig_slide_start = ( slide_timestamp.to_f / 1000 ).round(1) orig_slide_start = ( slide_timestamp.to_f / 1000 ).round(1)
if eventname == "SharePresentationEvent"
$presentation_name = node.xpath(".//presentationName")[0].text()
slide_number = $presentation_current_slide[$presentation_name].to_i
BigBlueButton.logger.info("Switching to presentation #{$presentation_name}, saved slide is #{slide_number}")
elsif eventname == 'GotoSlide'
slide_number = node.xpath(".//slide")[0].text().to_i
BigBlueButton.logger.info("Switching to slide #{slide_number} in presentation #{$presentation_name}")
elsif eventname == "DeskshareStartedEvent"
deskshare_slide = true
slide_number = -1
BigBlueButton.logger.info("Started deskshare; slide area is cleared")
elsif eventname == "DeskshareStoppedEvent"
deskshare_slide = false
slide_number = $presentation_current_slide[$presentation_name].to_i
BigBlueButton.logger.info("Stopped deskshare; restoring slide #{slide_number} in presentation #{$presentation_name}")
else
BigBlueButton.logger.warn("Unhandled event #{eventname} in processSlideEvents")
next
end
slide_number = slide_number < 0 ? 0 : slide_number slide_number = slide_number < 0 ? 0 : slide_number
$presentation_current_slide[$presentation_name] = slide_number
slide_src = deskshare_slide ? slide_src = deskshare_slide ?
"presentation/deskshare/slide-1.png" : "presentation/deskshare/slide-1.png" :
"presentation/#{$presentation_name}/slide-#{slide_number + 1}.png" "presentation/#{$presentation_name}/slide-#{slide_number + 1}.png"
@ -780,13 +791,6 @@ def processSlideEvents
# If it is, add it to the list with all the data. # If it is, add it to the list with all the data.
$slides_compiled[[slide_src, slide_size[1], slide_size[0]]] = [[slide_start], [slide_end], $global_slide_count, slide_text, [orig_slide_start], [orig_slide_end], $presentation_name, slide_number] $slides_compiled[[slide_src, slide_size[1], slide_size[0]]] = [[slide_start], [slide_end], $global_slide_count, slide_text, [orig_slide_start], [orig_slide_end], $presentation_name, slide_number]
$global_slide_count = $global_slide_count + 1 $global_slide_count = $global_slide_count + 1
else
# If not, append new in and out times to the old entry
# But if the previous slide_end is equal to the current slide_start, we just pop the previous slide_end and push the current one
# It will avoid the duplication of the thumbnails on the playback
if($slides_compiled[[slide_src, slide_size[1], slide_size[0]]][1].last == slide_start)
$slides_compiled[[slide_src, slide_size[1], slide_size[0]]][1].pop
$slides_compiled[[slide_src, slide_size[1], slide_size[0]]][1] << slide_end
else else
$slides_compiled[[slide_src, slide_size[1], slide_size[0]]][0] << slide_start $slides_compiled[[slide_src, slide_size[1], slide_size[0]]][0] << slide_start
$slides_compiled[[slide_src, slide_size[1], slide_size[0]]][1] << slide_end $slides_compiled[[slide_src, slide_size[1], slide_size[0]]][1] << slide_end
@ -799,7 +803,6 @@ def processSlideEvents
puts "#{slide_src} : #{slide_start} -> #{slide_end}" puts "#{slide_src} : #{slide_start} -> #{slide_end}"
end end
end end
end
def processShapesAndClears def processShapesAndClears
# Create shapes.svg file from the events.xml # Create shapes.svg file from the events.xml
@ -1067,6 +1070,7 @@ $prev_time = "NaN"
$ss = {} $ss = {}
$clearPageTimes = {} $clearPageTimes = {}
$presentation_current_slide = {}
$slides_compiled = {} $slides_compiled = {}
$slides_raw = {} $slides_raw = {}
$undos = {} $undos = {}