Skip to content
Snippets Groups Projects
Commit d97f413e authored by Pedro Beschorner Marin's avatar Pedro Beschorner Marin
Browse files

Fix note id

parent d8cb8573
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@ require 'logger'
require 'find'
require 'rubygems'
require 'net/http'
require 'fnv'
module BigBlueButton
class MissingDirectoryException < RuntimeError
......@@ -235,6 +236,11 @@ module BigBlueButton
r.split("-")[1].to_i / 1000
end
# Notes id will be an 8-sized hash string based on the meeting id
def self.get_notes_id(meeting_id)
FNV.new.fnv1a_32(meeting_id).to_s(16).rjust(8, '0')
end
def self.done_to_timestamp(r)
BigBlueButton.record_id_to_timestamp(File.basename(r, ".done"))
end
......
......@@ -21,7 +21,6 @@ require '../lib/recordandplayback'
require 'logger'
require 'trollop'
require 'yaml'
require 'fnv'
AUDIO_ARCHIVE_FORMAT = {
extension: 'opus',
......@@ -50,7 +49,7 @@ def archive_notes(meeting_id, notes_endpoint, notes_formats, raw_archive_dir)
BigBlueButton.logger.info("Archiving notes for #{meeting_id}")
notes_dir = "#{raw_archive_dir}/#{meeting_id}/notes"
FileUtils.mkdir_p(notes_dir)
notes_id = FNV.new.fnv1a_32(meeting_id).to_s(16)
notes_id = BigBlueButton.get_notes_id(meeting_id)
tmp_note = "#{notes_dir}/tmp_note.txt"
BigBlueButton.try_download("#{notes_endpoint}/#{notes_id}/export/txt", tmp_note)
......
......@@ -23,22 +23,20 @@ require '../lib/recordandplayback'
require 'logger'
require 'trollop'
require 'yaml'
require 'fnv'
def keep_etherpad_events(meeting_id, target_dir, notes_endpoint)
def keep_etherpad_events(meeting_id, events_etherpad, notes_endpoint)
BigBlueButton.logger.info("Keeping etherpad events for #{meeting_id}")
notes_id = FNV.new.fnv1a_32(meeting_id).to_s(16)
notes_id = BigBlueButton.get_notes_id(meeting_id)
# Always fetch for the audit format
BigBlueButton.try_download("#{notes_endpoint}/#{notes_id}/export/etherpad", "#{target_dir}/events.etherpad")
BigBlueButton.try_download("#{notes_endpoint}/#{notes_id}/export/etherpad", events_etherpad)
end
def keep_events(meeting_id, redis_host, redis_port, redis_password, target_dir, break_timestamp)
def keep_events(meeting_id, redis_host, redis_port, redis_password, events_xml, break_timestamp)
BigBlueButton.logger.info("Keeping events for #{meeting_id}")
redis = BigBlueButton::RedisWrapper.new(redis_host, redis_port, redis_password)
events_archiver = BigBlueButton::RedisEventsArchiver.new redis
events_xml = "#{target_dir}/events.xml"
events = events_archiver.store_events(meeting_id, events_xml, break_timestamp)
end
......@@ -84,17 +82,18 @@ target_dir = "#{events_dir}/#{meeting_id}"
if not FileTest.directory?(target_dir)
FileUtils.mkdir_p target_dir
keep_etherpad_events(meeting_id, target_dir, notes_endpoint)
events_etherpad = "#{target_dir}/events.etherpad"
keep_etherpad_events(meeting_id, events_etherpad, notes_endpoint)
events_xml = "#{target_dir}/events.xml"
if File.exist? raw_events_xml
# This is a recorded meetings. Therefore, copy the events.xml
# from raw directory instead of collecting the events from redis.
# (ralam July 5, 2019)
BigBlueButton.logger.info("Copying events from #{raw_events_xml}")
events_xml = "#{target_dir}/events.xml"
FileUtils.cp(raw_events_xml, events_xml)
else
keep_events(meeting_id, redis_host, redis_port, redis_password, target_dir, break_timestamp)
keep_events(meeting_id, redis_host, redis_port, redis_password, events_xml, break_timestamp)
# we need to delete the keys here because the sanity phase might not
# automatically happen for this recording
BigBlueButton.logger.info("Deleting redis keys")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment