Don't log draw/cursor events as often

+ Shorter syntax for opening and closing files
This commit is contained in:
Daniel Petri Rocha 2021-12-06 19:19:52 +01:00
parent 5aff9c0923
commit 6b0f2e8877

View File

@ -145,7 +145,7 @@ def svg_render_shape_pencil(g, slide, shape)
end end
if shape[:data_points].length == 2 if shape[:data_points].length == 2
BigBlueButton.logger.info("Pencil #{shape[:shape_unique_id]}: Drawing single point") # BigBlueButton.logger.info("Pencil #{shape[:shape_unique_id]}: Drawing single point")
g['style'] = "stroke:none;fill:##{shape[:color]};visibility:hidden" g['style'] = "stroke:none;fill:##{shape[:color]};visibility:hidden"
circle = doc.create_element('circle', circle = doc.create_element('circle',
cx: shape_scale_width(slide, shape[:data_points][0]), cx: shape_scale_width(slide, shape[:data_points][0]),
@ -157,7 +157,7 @@ def svg_render_shape_pencil(g, slide, shape)
data_points = shape[:data_points].each data_points = shape[:data_points].each
if !shape[:commands].nil? if !shape[:commands].nil?
BigBlueButton.logger.info("Pencil #{shape[:shape_unique_id]}: Drawing from command string (#{shape[:commands].length} commands)") # BigBlueButton.logger.info("Pencil #{shape[:shape_unique_id]}: Drawing from command string (#{shape[:commands].length} commands)")
shape[:commands].each do |command| shape[:commands].each do |command|
case command case command
when 1 # MOVE_TO when 1 # MOVE_TO
@ -187,7 +187,7 @@ def svg_render_shape_pencil(g, slide, shape)
end end
end end
else else
BigBlueButton.logger.info("Pencil #{shape[:shape_unique_id]}: Drawing simple line (#{shape[:data_points].length / 2} points)") # BigBlueButton.logger.info("Pencil #{shape[:shape_unique_id]}: Drawing simple line (#{shape[:data_points].length / 2} points)")
x = shape_scale_width(slide, data_points.next) x = shape_scale_width(slide, data_points.next)
y = shape_scale_height(slide, data_points.next) y = shape_scale_height(slide, data_points.next)
path << "M#{x} #{y}" path << "M#{x} #{y}"
@ -332,7 +332,7 @@ def svg_render_shape_text(g, slide, shape)
height = shape_scale_height(slide, shape[:text_box_height]) height = shape_scale_height(slide, shape[:text_box_height])
font_size = shape_scale_height(slide, shape[:calced_font_size]) font_size = shape_scale_height(slide, shape[:calced_font_size])
BigBlueButton.logger.info("Text #{shape[:shape_unique_id]} width #{width} height #{height} font size #{font_size}") # BigBlueButton.logger.info("Text #{shape[:shape_unique_id]} width #{width} height #{height} font size #{font_size}")
g['style'] = "color:##{shape[:font_color]};word-wrap:break-word;visibility:hidden;font-family:Arial;font-size:#{font_size}px" g['style'] = "color:##{shape[:font_color]};word-wrap:break-word;visibility:hidden;font-family:Arial;font-size:#{font_size}px"
switch = doc.create_element('switch') switch = doc.create_element('switch')
@ -392,7 +392,7 @@ def svg_render_shape(canvas, slide, shape, image_id)
return return
end end
BigBlueButton.logger.info("Draw #{shape[:shape_id]} Shape #{shape[:shape_unique_id]} Type #{shape[:type]} from #{shape[:in]} to #{shape[:out]} undo #{shape[:undo]}") # BigBlueButton.logger.info("Draw #{shape[:shape_id]} Shape #{shape[:shape_unique_id]} Type #{shape[:type]} from #{shape[:in]} to #{shape[:out]} undo #{shape[:undo]}")
doc = canvas.document doc = canvas.document
g = doc.create_element('g', g = doc.create_element('g',
@ -501,7 +501,7 @@ end
def cursors_emit_event(rec, cursor) def cursors_emit_event(rec, cursor)
if cursor[:in] == cursor[:out] if cursor[:in] == cursor[:out]
BigBlueButton.logger.info('Cursor: not emitting, duration rounds to 0') # BigBlueButton.logger.info('Cursor: not emitting, duration rounds to 0')
return return
end end
@ -534,7 +534,7 @@ def cursors_emit_event(rec, cursor)
cursor_e = doc.create_element('cursor') cursor_e = doc.create_element('cursor')
cursor_e.content = "#{x} #{y}" cursor_e.content = "#{x} #{y}"
BigBlueButton.logger.info("Cursor #{cursor_e.content} at #{cursor[:in]}") # BigBlueButton.logger.info("Cursor #{cursor_e.content} at #{cursor[:in]}")
event << cursor_e event << cursor_e
rec << event rec << event
@ -983,7 +983,7 @@ def process_presentation(package_dir)
cursor[:out] = timestamp cursor[:out] = timestamp
cursors_emit_event(cursors_rec, cursor) cursors_emit_event(cursors_rec, cursor)
end end
BigBlueButton.logger.info("Cursor: visible #{cursor_visible}, #{cursor_x} #{cursor_y} (#{panzoom[:width]}x#{panzoom[:height]})") # BigBlueButton.logger.info("Cursor: visible #{cursor_visible}, #{cursor_x} #{cursor_y} (#{panzoom[:width]}x#{panzoom[:height]})")
cursor = { cursor = {
visible: cursor_visible, visible: cursor_visible,
x: cursor_x, x: cursor_x,
@ -1188,12 +1188,12 @@ begin
recording_dir = bbb_props['recording_dir'] recording_dir = bbb_props['recording_dir']
BigBlueButton.logger.info('Setting process dir') BigBlueButton.logger.info('Setting process dir')
@process_dir = "#{recording_dir}/process/presentation/#{@meeting_id}" @process_dir = "#{recording_dir}/process/presentation/#{@meeting_id}"
BigBlueButton.logger.info('setting publish dir') BigBlueButton.logger.info('Setting publish dir')
publish_dir = @presentation_props['publish_dir'] publish_dir = @presentation_props['publish_dir']
BigBlueButton.logger.info('setting playback url info') BigBlueButton.logger.info('Setting playback url info')
playback_protocol = bbb_props['playback_protocol'] playback_protocol = bbb_props['playback_protocol']
playback_host = bbb_props['playback_host'] playback_host = bbb_props['playback_host']
BigBlueButton.logger.info('setting target dir') BigBlueButton.logger.info('Setting target dir')
target_dir = "#{recording_dir}/publish/presentation/#{@meeting_id}" target_dir = "#{recording_dir}/publish/presentation/#{@meeting_id}"
@deskshare_dir = "#{recording_dir}/raw/#{@meeting_id}/deskshare" @deskshare_dir = "#{recording_dir}/raw/#{@meeting_id}/deskshare"
@ -1326,10 +1326,7 @@ begin
end end
end end
## Write the new metadata.xml ## Write the new metadata.xml
metadata_file = File.new("#{package_dir}/metadata.xml", 'w') File.open("#{package_dir}/metadata.xml", 'w') { |file| file.write(Nokogiri::XML(metadata.to_xml, &:noblanks).root) }
metadata = Nokogiri::XML(metadata.to_xml, &:noblanks)
metadata_file.write(metadata.root)
metadata_file.close
BigBlueButton.logger.info('Added playback to metadata.xml') BigBlueButton.logger.info('Added playback to metadata.xml')
# Create slides.xml # Create slides.xml
@ -1382,9 +1379,7 @@ begin
end end
exit 1 exit 1
end end
publish_done = File.new("#{recording_dir}/status/published/#{@meeting_id}-presentation.done", 'w') File.open("#{recording_dir}/status/published/#{@meeting_id}-presentation.done", 'w') { |file| file.write("Published #{@meeting_id}") }
publish_done.write("Published #{@meeting_id}")
publish_done.close
else else
BigBlueButton.logger.info("#{target_dir} is already there") BigBlueButton.logger.info("#{target_dir} is already there")
@ -1395,9 +1390,7 @@ rescue StandardError => e
e.backtrace.each do |traceline| e.backtrace.each do |traceline|
BigBlueButton.logger.error(traceline) BigBlueButton.logger.error(traceline)
end end
publish_done = File.new("#{recording_dir}/status/published/#{@meeting_id}-presentation.fail", 'w') File.open("#{recording_dir}/status/published/#{@meeting_id}-presentation.fail", 'w') { |file| file.write("Failed Publishing #{@meeting_id}") }
publish_done.write("Failed Publishing #{@meeting_id}")
publish_done.close
exit 1 exit 1
end end