bbbevents 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 402bf3f128e1214280f944e01ee9d205f5957e9b032982a095e61204e679a8a4
4
+ data.tar.gz: 109f47bab718e9bb1a0479fced8383bcfc6192f418c9ca42c7943cc41e6aa19c
5
+ SHA512:
6
+ metadata.gz: 8c4f90600b6b3d85d9ebb7325e0a6279fc9d7f94ec1ee20d91448f3aca4014ae16a356cd75d74a84b99851cd7e329f5dd7d670e38aff1554f9bdc1f410567117
7
+ data.tar.gz: '0733278cf563072dc656c51bfceb823491800b4b9089764a835600fa95ee21bec84147c07055840bf08332492a6aca77ccebc8a65497f865bfb90a33fa635c4e'
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
14
+ # testing csv file
15
+ /spec/testing.csv
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ sudo: false
2
+
3
+ language: ruby
4
+
5
+ rvm:
6
+ - 2.5.1
7
+
8
+ before_install: gem install bundler -v 1.15.4
9
+
10
+ deploy:
11
+ provider: rubygems
12
+ api_key: ${RUBYGEMS_API_KEY}
13
+ on:
14
+ tags: true
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in bbbevents.gemspec
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # bbbevents
2
+
3
+ ![Travis CI](https://api.travis-ci.org/blindsidenetworks/bbb-events.svg?branch=master)
4
+
5
+ bbbevents is a simple ruby gem that makes it easier to parse data from a recordings events.xml file.
6
+
7
+ This gem is currently being used on the recording server to parse events and build meeting dashboards.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'bbbevents'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ ## Usage
22
+
23
+ ### Recordings
24
+ ```ruby
25
+ require 'bbbevents'
26
+
27
+ # Parse the recording's events.xml.
28
+ recording = BBBEvents.parse("events.xml")
29
+
30
+ # Access recording data.
31
+ recording.metadata
32
+ recording.meeting_id
33
+
34
+ # Retrieve start, finish time objects or total duration in seconds.
35
+ recording.start
36
+ recording.finish
37
+ recording.duration
38
+
39
+ # Returns a list of Attendee objects.
40
+ recording.attendees
41
+ recording.moderators
42
+ recording.viewers
43
+
44
+ # Returns a list of Poll objects.
45
+ recording.polls
46
+ recording.published_polls
47
+ recording.unpublished_polls
48
+
49
+ # Returns a list of upload files (names only).
50
+ recording.files
51
+
52
+ # Generate a CSV file with the data.
53
+ recording.create_csv("data.csv")
54
+
55
+ ```
56
+
57
+ ### Attendees
58
+ ```ruby
59
+ # Grab attendee info.
60
+ attendee.name
61
+ attendee.moderator?
62
+
63
+ # Fetch initial join, last leave, or total duration.
64
+ attendee.duration
65
+ attendee.joined
66
+ attendee.left
67
+
68
+ # Fetch all recorded join/leave times.
69
+ attendee.joins
70
+ attendee.leaves
71
+
72
+ # View attendee engagement.
73
+ attendee.engagement
74
+
75
+ # => {
76
+ # :chats => 11,
77
+ # :talks => 7,
78
+ # :raisehand => 2,
79
+ # :emojis => 5,
80
+ # :poll_votes => 2,
81
+ # :talk_time => 42
82
+ # }
83
+ ```
84
+
85
+ ### Polls
86
+ ```ruby
87
+ # Determine if poll is published.
88
+ poll.published?
89
+
90
+ # Determine when the poll started.
91
+ poll.start
92
+
93
+ # Returns an Array contain possible options.
94
+ poll.options
95
+
96
+ # Returns a Hash maping user_id's to their poll votes.
97
+ poll.votes
98
+ ```
99
+
100
+ ## License
101
+
102
+ The gem is available as open source under the terms of the [LGPL 3.0 License](https://www.gnu.org/licenses/lgpl-3.0.txt).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bbbevents.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "bbbevents/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bbbevents"
8
+ spec.version = BBBEvents::VERSION
9
+ spec.authors = ["Blindside Networks"]
10
+ spec.email = ["ffdixon@blindsidenetworks.com"]
11
+
12
+ spec.summary = %q{Easily parse data from a BigBlueButton recording's events.xml.}
13
+ spec.description = %q{Easily parse data from a BigBlueButton recording's events.xml.}
14
+ spec.homepage = "https://www.blindsidenetworks.com"
15
+ spec.license = "LGPL 3.0"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.15"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.4"
27
+
28
+ # Gem dependecies.
29
+ spec.add_dependency "activesupport"
30
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bbbevents"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,72 @@
1
+ module BBBEvents
2
+ class Attendee
3
+ attr_accessor :id, :name, :moderator, :joins, :leaves, :duration, :recent_talking_time, :engagement
4
+
5
+ MODERATOR_ROLE = "MODERATOR"
6
+ VIEWER_ROLE = "VIEWER"
7
+
8
+ def initialize(join_event)
9
+ @id = join_event["userId"]
10
+ @name = join_event["name"]
11
+ @moderator = (join_event["role"] == MODERATOR_ROLE)
12
+
13
+ @joins = []
14
+ @leaves = []
15
+ @duration = 0
16
+
17
+ @recent_talking_time = 0
18
+
19
+ @engagement = {
20
+ chats: 0,
21
+ talks: 0,
22
+ raisehand: 0,
23
+ emojis: 0,
24
+ poll_votes: 0,
25
+ talk_time: 0,
26
+ }
27
+ end
28
+
29
+ def moderator?
30
+ moderator
31
+ end
32
+
33
+ # Grab the initial join.
34
+ def joined
35
+ @joins.first
36
+ end
37
+
38
+ # Grab the last leave.
39
+ def left
40
+ @leaves.last
41
+ end
42
+
43
+ def csv_row
44
+ e = @engagement
45
+ [
46
+ @name,
47
+ @moderator,
48
+ e[:chats],
49
+ e[:talks],
50
+ e[:emojis],
51
+ e[:poll_votes],
52
+ e[:raisehand],
53
+ seconds_to_time(@engagement[:talk_time]),
54
+ joined.strftime(DATE_FORMAT),
55
+ left.strftime(DATE_FORMAT),
56
+ seconds_to_time(@duration),
57
+ ].map(&:to_s)
58
+ end
59
+
60
+ def to_json
61
+ hash = {}
62
+ instance_variables.each { |var| hash[var[1..-1]] = instance_variable_get(var) }
63
+ hash.to_json
64
+ end
65
+
66
+ private
67
+
68
+ def seconds_to_time(seconds)
69
+ [seconds / 3600, seconds / 60 % 60, seconds % 60].map { |t| t.floor.to_s.rjust(2, "0") }.join(':')
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,16 @@
1
+ require 'bbbevents/version'
2
+
3
+ module BBBEvents
4
+ TIME_FORMAT = "%H:%M:%S"
5
+ DATE_FORMAT = "%m/%d/%Y %H:%M:%S"
6
+ UNKNOWN_DATE = "??/??/????"
7
+
8
+ def self.parse(events_xml)
9
+ Recording.new(events_xml)
10
+ end
11
+ end
12
+
13
+ require 'bbbevents/attendee'
14
+ require 'bbbevents/events'
15
+ require 'bbbevents/poll'
16
+ require 'bbbevents/recording'
@@ -0,0 +1,104 @@
1
+ module BBBEvents
2
+ module Events
3
+ RECORDABLE_EVENTS = [
4
+ "participant_join_event",
5
+ "participant_left_event",
6
+ "conversion_completed_event",
7
+ "public_chat_event",
8
+ "participant_status_change_event",
9
+ "participant_talking_event",
10
+ "poll_started_record_event",
11
+ "user_responded_to_poll_record_event",
12
+ "add_shape_event",
13
+ ]
14
+
15
+ EMOJI_WHITELIST = %w(away neutral confused sad happy applause thumbsUp thumbsDown)
16
+ RAISEHAND = "raiseHand"
17
+ POLL_PUBLISHED_STATUS = "poll_result"
18
+
19
+ private
20
+
21
+ # Log a users join.
22
+ def participant_join_event(e)
23
+ id = e["userId"]
24
+
25
+ @attendees[id] = Attendee.new(e) unless @attendees.key?(id)
26
+ @attendees[id].joins << Time.at(timestamp_conversion(e["timestamp"]))
27
+ end
28
+
29
+ # Log a users leave.
30
+ def participant_left_event(e)
31
+ return unless attendee = @attendees[e["userId"]]
32
+
33
+ left = Time.at(timestamp_conversion(e["timestamp"]))
34
+ attendee.leaves << left
35
+ end
36
+
37
+ # Log the uploaded file name.
38
+ def conversion_completed_event(e)
39
+ @files << e["originalFilename"]
40
+ end
41
+
42
+ # Log a users public chat message
43
+ def public_chat_event(e)
44
+ return unless attendee = @attendees[e["senderId"]]
45
+
46
+ attendee.engagement[:chats] += 1 if attendee
47
+ end
48
+
49
+ # Log user status changes.
50
+ def participant_status_change_event(e)
51
+ return unless attendee = @attendees[e["userId"]]
52
+ status = e["value"]
53
+
54
+ if attendee
55
+ if status == RAISEHAND
56
+ attendee.engagement[:raisehand] += 1
57
+ elsif EMOJI_WHITELIST.include?(status)
58
+ attendee.engagement[:emojis] += 1
59
+ end
60
+ end
61
+ end
62
+
63
+ # Log number of speaking events and total talk time.
64
+ def participant_talking_event(e)
65
+ return unless attendee = @attendees[e["participant"]]
66
+
67
+ if e["talking"] == "true"
68
+ attendee.engagement[:talks] += 1
69
+ attendee.recent_talking_time = timestamp_conversion(e["timestamp"])
70
+ else
71
+ attendee.engagement[:talk_time] += timestamp_conversion(e["timestamp"]) - attendee.recent_talking_time
72
+ end
73
+ end
74
+
75
+ # Log all polls with metadata, options and votes.
76
+ def poll_started_record_event(e)
77
+ id = e["pollId"]
78
+
79
+ @polls[id] = Poll.new(e)
80
+ @polls[id].start = timestamp_conversion(e["timestamp"])
81
+ end
82
+
83
+ # Log user responses to polls.
84
+ def user_responded_to_poll_record_event(e)
85
+ user_id = e["userId"]
86
+ return unless attendee = @attendees[user_id]
87
+
88
+ if poll = @polls[e["pollId"]]
89
+ poll.votes[user_id] = poll.options[e["answerId"].to_i]
90
+ end
91
+
92
+ attendee.engagement[:poll_votes] += 1
93
+ end
94
+
95
+ # Log if the poll was published.
96
+ def add_shape_event(e)
97
+ if e["type"] == POLL_PUBLISHED_STATUS
98
+ if poll = @polls[e["id"]]
99
+ poll.published = true
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,22 @@
1
+ module BBBEvents
2
+ class Poll
3
+ attr_accessor :id, :start, :published, :options, :votes
4
+
5
+ def initialize(poll_event)
6
+ @id = poll_event["pollId"]
7
+ @published = false
8
+ @options = JSON.parse(poll_event["answers"]).map { |opt| opt["key"] }
9
+ @votes = {}
10
+ end
11
+
12
+ def published?
13
+ @published
14
+ end
15
+
16
+ def to_json
17
+ hash = {}
18
+ instance_variables.each { |var| hash[var[1..-1]] = instance_variable_get(var) }
19
+ hash.to_json
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,133 @@
1
+ require 'csv'
2
+ require 'json'
3
+ require 'active_support/core_ext/hash'
4
+
5
+ module BBBEvents
6
+ CSV_HEADER = %w(name moderator chats talks emojis poll_votes raisehand talk_time join left duration)
7
+ NO_VOTE_SYMBOL = "-"
8
+
9
+ class Recording
10
+ include Events
11
+
12
+ attr_accessor :metadata, :meeting_id, :timestamp, :start, :finish, :duration, :files
13
+
14
+ def initialize(events_xml)
15
+ filename = File.basename(events_xml)
16
+ raise "#{filename} is not a file or does not exist." unless File.file?(events_xml)
17
+
18
+ raw_recording_data = Hash.from_xml(File.read(events_xml))
19
+
20
+ raise "#{filename} is not a valid xml file (unable to parse)." if raw_recording_data.nil?
21
+ raise "#{filename} is missing recording key." unless raw_recording_data.key?("recording")
22
+
23
+ recording_data = raw_recording_data["recording"]
24
+ events = recording_data["event"]
25
+
26
+ @metadata = recording_data["metadata"]
27
+ @meeting_id = recording_data["meeting"]["id"]
28
+ @timestamp = extract_timestamp(@meeting_id)
29
+
30
+ @first_event = events.first["timestamp"].to_i
31
+ @last_event = events.last["timestamp"].to_i
32
+
33
+ @start = Time.at(@timestamp / 1000)
34
+ @finish = Time.at(timestamp_conversion(@last_event))
35
+ @duration = (@finish - @start).to_i
36
+
37
+ @attendees = {}
38
+ @polls = {}
39
+ @files = []
40
+
41
+ process_events(events)
42
+
43
+ @attendees.values.each do |att|
44
+ att.leaves << @finish if att.joins.length > att.leaves.length
45
+ att.duration = total_duration(att)
46
+ end
47
+ end
48
+
49
+ # Take only the values since we no longer need to index.
50
+ def attendees
51
+ @attendees.values
52
+ end
53
+
54
+ # Retrieve a list of all the moderators.
55
+ def moderators
56
+ attendees.select(&:moderator?)
57
+ end
58
+
59
+ # Retrieve a list of all the viewers.
60
+ def viewers
61
+ attendees.reject(&:moderator?)
62
+ end
63
+
64
+ # Take only the values since we no longer need to index.
65
+ def polls
66
+ @polls.values
67
+ end
68
+
69
+ # Retrieve a list of published polls.
70
+ def published_polls
71
+ polls.select(&:published?)
72
+ end
73
+
74
+ # Retrieve a list of unpublished polls.
75
+ def unpublished_polls
76
+ polls.reject(&:published?)
77
+ end
78
+
79
+ # Export recording data to a CSV file.
80
+ def create_csv(filepath)
81
+ CSV.open(filepath, "wb") do |csv|
82
+ csv << CSV_HEADER.map(&:capitalize) + (1..polls.length).map { |i| "Poll #{i}" }
83
+ @attendees.each do |id, att|
84
+ csv << att.csv_row + polls.map { |poll| poll.votes[id] || NO_VOTE_SYMBOL }
85
+ end
86
+ end
87
+ end
88
+
89
+ def to_json
90
+ {
91
+ metadata: @metadata,
92
+ meeting_id: @meeting_id,
93
+ duration: @duration,
94
+ start: @start,
95
+ finish: @finish,
96
+ attendees: attendees.map(&:to_json),
97
+ files: @files,
98
+ polls: polls.map(&:to_json),
99
+ }.to_json
100
+ end
101
+
102
+ private
103
+
104
+ # Process all the events in the events.xml file.
105
+ def process_events(events)
106
+ events.each do |e|
107
+ event = e["eventname"].underscore
108
+ send(event, e) if RECORDABLE_EVENTS.include?(event)
109
+ end
110
+ end
111
+
112
+ # Extracts the timestamp from a meeting id.
113
+ def extract_timestamp(meeting_id)
114
+ meeting_id.split("-").last.to_i
115
+ end
116
+
117
+ # Converts the BigBlueButton timestamps to proper time.
118
+ def timestamp_conversion(base)
119
+ (base.to_i - @first_event + @timestamp) / 1000
120
+ end
121
+
122
+ # Calculates an attendee's duration.
123
+ def total_duration(att)
124
+ return 0 unless att.joins.length == att.leaves.length
125
+ total = 0
126
+
127
+ att.joins.length.times do |i|
128
+ total += att.leaves[i] - att.joins[i]
129
+ end
130
+ total
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,3 @@
1
+ module BBBEvents
2
+ VERSION = "1.0.0"
3
+ end
data/lib/bbbevents.rb ADDED
@@ -0,0 +1 @@
1
+ require "bbbevents/base"
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bbbevents
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Blindside Networks
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-08-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: activesupport
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Easily parse data from a BigBlueButton recording's events.xml.
70
+ email:
71
+ - ffdixon@blindsidenetworks.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - LICENSE
81
+ - README.md
82
+ - Rakefile
83
+ - bbbevents.gemspec
84
+ - bin/console
85
+ - bin/setup
86
+ - lib/bbbevents.rb
87
+ - lib/bbbevents/attendee.rb
88
+ - lib/bbbevents/base.rb
89
+ - lib/bbbevents/events.rb
90
+ - lib/bbbevents/poll.rb
91
+ - lib/bbbevents/recording.rb
92
+ - lib/bbbevents/version.rb
93
+ homepage: https://www.blindsidenetworks.com
94
+ licenses:
95
+ - LGPL 3.0
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.7.6
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: Easily parse data from a BigBlueButton recording's events.xml.
117
+ test_files: []