bbbot-ruby 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/.rvmrc +6 -0
- data/LICENSE +23 -0
- data/README.rdoc +3 -0
- data/Rakefile +20 -0
- data/bbbot-ruby.gemspec +15 -0
- data/extras/bbb-bot.jar +0 -0
- data/lib/bigbluebutton_bot.rb +60 -0
- metadata +55 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2011 Leonardo Crauss Daronco
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
7
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
8
|
+
subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
15
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
|
+
|
20
|
+
This software is developed at:
|
21
|
+
GT-Mconf: Multiconference system for interoperable web and mobile
|
22
|
+
PRAV Labs - UFRGS - Porto Alegre - Brazil
|
23
|
+
http://www.inf.ufrgs.br/prav/gtmconf
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubygems/package_task'
|
3
|
+
require 'rdoc/task'
|
4
|
+
|
5
|
+
RDoc::Task.new do |rdoc|
|
6
|
+
rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'lib/**/*.rb')
|
7
|
+
rdoc.main = "README.rdoc"
|
8
|
+
rdoc.title = "bbbot-ruby Docs"
|
9
|
+
rdoc.rdoc_dir = 'rdoc'
|
10
|
+
end
|
11
|
+
|
12
|
+
eval("$specification = begin; #{IO.read('bbbot-ruby.gemspec')}; end")
|
13
|
+
Gem::PackageTask.new $specification do |pkg|
|
14
|
+
pkg.need_tar = true
|
15
|
+
pkg.need_zip = true
|
16
|
+
end
|
17
|
+
|
18
|
+
task :notes do
|
19
|
+
puts `grep -r 'OPTIMIZE\\|FIXME\\|TODO' lib/`
|
20
|
+
end
|
data/bbbot-ruby.gemspec
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'bbbot-ruby'
|
5
|
+
s.version = '0.0.1'
|
6
|
+
s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
|
7
|
+
s.summary = 'Ruby wrapper for bbbot (https://github.com/mconf/bbbot-ruby)'
|
8
|
+
s.description = s.summary
|
9
|
+
s.authors = ['Leonardo Crauss Daronco']
|
10
|
+
s.email = ['leonardodaronco@gmail.com']
|
11
|
+
s.homepage = "https://github.com/mconf/bbbot-ruby"
|
12
|
+
s.bindir = "bin"
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.require_paths = ["lib"]
|
15
|
+
end
|
data/extras/bbb-bot.jar
ADDED
Binary file
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class BigBlueButtonBot
|
2
|
+
BOT_FILENAME = "../extras/bbb-bot.jar"
|
3
|
+
@@pids = []
|
4
|
+
|
5
|
+
def initialize(api, meeting, salt="", count=1, timeout=20)
|
6
|
+
server = parse_server_url(api.url)
|
7
|
+
|
8
|
+
# note: fork + exec with these parameters was the only solution found to run the command in background
|
9
|
+
# and be able to wait for it (kill it) later on (see BigBlueButtonBot.finalize)
|
10
|
+
pid = Process.fork do
|
11
|
+
bot_file = File.join(File.dirname(__FILE__), BOT_FILENAME)
|
12
|
+
exec("java", "-jar", "#{bot_file}", "-s", "#{server}", "-p", "#{salt}", "-m", "#{meeting}", "-n", "#{count}")
|
13
|
+
|
14
|
+
# other options that didn't work:
|
15
|
+
# IO::popen("java -jar #{bot_file} -s \"#{server}\" -m \"#{meeting}\" -n #{count} >/dev/null")
|
16
|
+
# exec(["java", "-jar #{bot_file} -s \"#{server}\" -m \"#{meeting}\" -n #{count} >/dev/null"])
|
17
|
+
# exec("java -jar #{bot_file} -s \"#{server}\" -m \"#{meeting}\" -n #{count} >/dev/null")
|
18
|
+
# Process.exit!
|
19
|
+
end
|
20
|
+
@@pids << pid
|
21
|
+
|
22
|
+
wait_bot_startup(api, meeting, count, timeout)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.finalize
|
26
|
+
@@pids.each do |pid|
|
27
|
+
p = Process.kill("TERM", pid)
|
28
|
+
Process.detach(pid)
|
29
|
+
end
|
30
|
+
@@pids.clear
|
31
|
+
end
|
32
|
+
|
33
|
+
def parse_server_url(full_url)
|
34
|
+
uri = URI.parse(full_url)
|
35
|
+
uri_s = uri.scheme + "://" + uri.host
|
36
|
+
uri_s = uri_s + ":" + uri.port.to_s if uri.port != uri.default_port
|
37
|
+
uri_s
|
38
|
+
end
|
39
|
+
|
40
|
+
# wait until the meeting is running with a certain number of participants
|
41
|
+
def wait_bot_startup(api, meeting, participants, timeout=20)
|
42
|
+
Timeout::timeout(timeout) do
|
43
|
+
stop_wait = false
|
44
|
+
while !stop_wait
|
45
|
+
sleep 1
|
46
|
+
|
47
|
+
# find the meeting and hope it is running
|
48
|
+
response = api.get_meetings
|
49
|
+
selected = response[:meetings].reject!{ |m| m[:meetingID] != meeting }
|
50
|
+
if selected and selected.size > 0 and selected[0][:running]
|
51
|
+
|
52
|
+
# check how many participants are in the meeting
|
53
|
+
pass = selected[0][:moderatorPW]
|
54
|
+
response = api.get_meeting_info(meeting, pass)
|
55
|
+
stop_wait = response[:participantCount] >= participants
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bbbot-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Leonardo Crauss Daronco
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-03 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: Ruby wrapper for bbbot (https://github.com/mconf/bbbot-ruby)
|
15
|
+
email:
|
16
|
+
- leonardodaronco@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files:
|
20
|
+
- README.rdoc
|
21
|
+
- LICENSE
|
22
|
+
files:
|
23
|
+
- .gitignore
|
24
|
+
- .rvmrc
|
25
|
+
- LICENSE
|
26
|
+
- README.rdoc
|
27
|
+
- Rakefile
|
28
|
+
- bbbot-ruby.gemspec
|
29
|
+
- extras/bbb-bot.jar
|
30
|
+
- lib/bigbluebutton_bot.rb
|
31
|
+
homepage: https://github.com/mconf/bbbot-ruby
|
32
|
+
licenses: []
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubyforge_project:
|
51
|
+
rubygems_version: 1.8.10
|
52
|
+
signing_key:
|
53
|
+
specification_version: 3
|
54
|
+
summary: Ruby wrapper for bbbot (https://github.com/mconf/bbbot-ruby)
|
55
|
+
test_files: []
|