conference_manager-ruby 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/.yardopts +2 -0
- data/Gemfile +3 -0
- data/README.rdoc +26 -0
- data/Rakefile +23 -0
- data/conference_magener-ruby.gemspec +30 -0
- data/lib/conference_manager/editor.rb +11 -0
- data/lib/conference_manager/editor_session.rb +11 -0
- data/lib/conference_manager/event.rb +24 -0
- data/lib/conference_manager/event_status.rb +10 -0
- data/lib/conference_manager/models/conference_manager_event.rb +248 -0
- data/lib/conference_manager/models/conference_manager_session.rb +248 -0
- data/lib/conference_manager/player.rb +11 -0
- data/lib/conference_manager/player_session.rb +11 -0
- data/lib/conference_manager/resource.rb +45 -0
- data/lib/conference_manager/session.rb +15 -0
- data/lib/conference_manager/session_status.rb +14 -0
- data/lib/conference_manager/start.rb +9 -0
- data/lib/conference_manager/streaming.rb +11 -0
- data/lib/conference_manager/web.rb +11 -0
- data/lib/conference_manager/webmap.rb +11 -0
- data/lib/conference_manager/webstats.rb +11 -0
- data/lib/conference_manager-ruby.rb +14 -0
- metadata +118 -0
data/.gitignore
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
= ConferenceManager Ruby Wrapping
|
2
|
+
|
3
|
+
A ruby gem to wrap the ConferenceManager functionality
|
4
|
+
|
5
|
+
|
6
|
+
= Installation
|
7
|
+
|
8
|
+
Add to your Gemfile:
|
9
|
+
|
10
|
+
gem 'conference_manager-ruby'
|
11
|
+
|
12
|
+
Then run:
|
13
|
+
|
14
|
+
bundle update
|
15
|
+
|
16
|
+
= Usage
|
17
|
+
|
18
|
+
In your model:
|
19
|
+
|
20
|
+
class Event < ActiveRecord::Base
|
21
|
+
acts_as_conference_manager_event
|
22
|
+
end
|
23
|
+
|
24
|
+
class Session < ActiveRecord::Base
|
25
|
+
acts_as_conference_manager_session
|
26
|
+
end
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'bundler'
|
5
|
+
rescue LoadError
|
6
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'rake'
|
10
|
+
|
11
|
+
=begin
|
12
|
+
require 'rdoc/task'
|
13
|
+
|
14
|
+
Rake::RDocTask.new do |rdoc|
|
15
|
+
rdoc.rdoc_dir = 'rdoc'
|
16
|
+
rdoc.title = "ConferenceManager Ruby Wrapping"
|
17
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
18
|
+
rdoc.rdoc_files.include('README.rdoc')
|
19
|
+
rdoc.rdoc_files.include('lib/**/*.rb', 'app/**/*.rb')
|
20
|
+
end
|
21
|
+
=end
|
22
|
+
|
23
|
+
Bundler::GemHelper.install_tasks
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "conference_manager-ruby"
|
3
|
+
s.version = "0.0.1"
|
4
|
+
s.authors = ["GING-UPM"]
|
5
|
+
s.summary = "Ruby wrapping for Conference Manager."
|
6
|
+
s.description = "Ruby wrapping for Conference Manager."
|
7
|
+
s.email = "vcc@dit.upm.es"
|
8
|
+
s.homepage = "http://github.com/ging/conference_manager-ruby"
|
9
|
+
s.files = `git ls-files`.split("\n")
|
10
|
+
|
11
|
+
# Gem dependencies
|
12
|
+
#
|
13
|
+
#s.add_runtime_dependency('rails', '3.1.0.rc4')
|
14
|
+
s.add_runtime_dependency('activeresource')
|
15
|
+
|
16
|
+
# Debugging
|
17
|
+
if RUBY_VERSION < '1.9'
|
18
|
+
s.add_development_dependency('ruby-debug', '~> 0.10.3')
|
19
|
+
end
|
20
|
+
|
21
|
+
# Specs
|
22
|
+
#s.add_development_dependency('rspec-rails', '~> 2.6.1')
|
23
|
+
# Fixtures
|
24
|
+
#s.add_development_dependency('factory_girl', '~> 1.3.2')
|
25
|
+
# Population
|
26
|
+
#s.add_development_dependency('forgery', '~> 0.3.6')
|
27
|
+
# Integration testing
|
28
|
+
#s.add_development_dependency('capybara', '~> 0.3.9')
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module ConferenceManager
|
2
|
+
class Event < Resource
|
3
|
+
|
4
|
+
self.element_name = "event"
|
5
|
+
self.site = domain
|
6
|
+
|
7
|
+
def enable_sip?
|
8
|
+
enable_sip == "true"
|
9
|
+
end
|
10
|
+
|
11
|
+
def enable_isabel?
|
12
|
+
enable_isabel == "true"
|
13
|
+
end
|
14
|
+
|
15
|
+
def enable_web?
|
16
|
+
enable_web =="true"
|
17
|
+
end
|
18
|
+
|
19
|
+
def enable_httplivestreaming?
|
20
|
+
enable-httplivestreaming == "true"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,248 @@
|
|
1
|
+
module ConferenceManager
|
2
|
+
module Models
|
3
|
+
module ConferenceManagerEvent
|
4
|
+
CM_ATTRIBUTES = ["name", "cm_mode", "start_date", "end_date", "web_bw", "isabel_bw", "sip_interface", "httplivestreaming_bw", "permalink"]
|
5
|
+
#in these arrays the number in kb is lower than in the comments because we pass the conference manager interface
|
6
|
+
#only the video bandwidth, and the total is about 50kb lower
|
7
|
+
WEB_BANDWIDTH = [100000, 200000, 400000] #equivalents: low (150K), medium (250K), high (450K)
|
8
|
+
WEB_CODEC = ["H264","H264","H263"] #equivalents: low (h.264), medium (h.264), high (sorenson)
|
9
|
+
RECORDING_BANDWIDTH = [0, 200000, 500000] #equivalents low (0) we don't use it, medium (250K), high (550K)
|
10
|
+
RECORDING_CODEC = ["H264","H264","H264"] #equivalents: low (H.264), medium (h.264), high (h.264)
|
11
|
+
|
12
|
+
WEB_BW_HASH_FOR_DROP_DOWN = {"100000"=> ["Low (150K H.264)", "0"], "200000" => ["Medium (250K H.264)", "1"], "400000"=>["High (450K Sorenson)", "2"]}
|
13
|
+
RECORDING_HASH_FOR_DROP_DOWN = {"0"=>["Medium (250K H.264)", "1"],"200000"=>["Medium (250K H.264)", "1"],"500000"=>["High (550K H.264)", "2"]}
|
14
|
+
|
15
|
+
def self.included(mod)
|
16
|
+
mod.extend(ClassMethods)
|
17
|
+
end
|
18
|
+
module ClassMethods
|
19
|
+
def acts_as_conference_manager_event
|
20
|
+
include ConferenceManager::Models::ConferenceManagerEvent::InstanceMethods
|
21
|
+
end
|
22
|
+
|
23
|
+
def included(base)
|
24
|
+
base.class_eval do
|
25
|
+
|
26
|
+
validate_on_create do |event|
|
27
|
+
if event.uses_conference_manager?
|
28
|
+
if event.recording_type == ::Event::RECORDING_TYPE.index(:manual)
|
29
|
+
end_date_after_adjust = event.end_date + ::Event::EXTRA_TIME_FOR_EVENTS_WITH_MANUAL_REC
|
30
|
+
else
|
31
|
+
end_date_after_adjust = event.end_date
|
32
|
+
end
|
33
|
+
cm_e =
|
34
|
+
ConferenceManager::Event.new(:name => event.name,
|
35
|
+
:mode => event.cm_mode,
|
36
|
+
:initDate => event.start_date,
|
37
|
+
:endDate => end_date_after_adjust,
|
38
|
+
:enable_web => "1",
|
39
|
+
:enable_isabel => "1",
|
40
|
+
:enable_sip => event.sip_interface?,
|
41
|
+
:enable_httplivestreaming => "0",
|
42
|
+
:isabel_bw => event.isabel_bw,
|
43
|
+
:web_bw => WEB_BANDWIDTH[event.web_bw],
|
44
|
+
:recording_bw => RECORDING_BANDWIDTH[event.recording_bw],
|
45
|
+
:httplivestreaming_bw => WEB_BANDWIDTH[event.web_bw],
|
46
|
+
:web_codec => WEB_CODEC[event.web_bw],
|
47
|
+
:recording_codec => RECORDING_CODEC[event.recording_bw],
|
48
|
+
:path => "attachments/conferences/#{event.permalink}")
|
49
|
+
begin
|
50
|
+
cm_e.save
|
51
|
+
event.cm_event_id = cm_e.id
|
52
|
+
rescue StandardError => e
|
53
|
+
event.errors.add_to_base(e.to_s)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
validate_on_update do |event|
|
59
|
+
if !event.past? && event.uses_conference_manager? && (event.changed & CM_ATTRIBUTES).any?
|
60
|
+
if event.recording_type == ::Event::RECORDING_TYPE.index(:manual)
|
61
|
+
end_date_after_adjust = event.end_date + ::Event::EXTRA_TIME_FOR_EVENTS_WITH_MANUAL_REC
|
62
|
+
else
|
63
|
+
end_date_after_adjust = event.end_date
|
64
|
+
end
|
65
|
+
new_params = { :name => event.name,
|
66
|
+
:mode => event.cm_mode,
|
67
|
+
:initDate => event.start_date,
|
68
|
+
:endDate => end_date_after_adjust,
|
69
|
+
:enable_web => "1",
|
70
|
+
:enable_isabel => "1",
|
71
|
+
:enable_sip => event.sip_interface?,
|
72
|
+
:enable_httplivestreaming => "0",
|
73
|
+
:isabel_bw => event.isabel_bw,
|
74
|
+
:web_bw => WEB_BANDWIDTH[event.web_bw],
|
75
|
+
:recording_bw => RECORDING_BANDWIDTH[event.recording_bw],
|
76
|
+
:httplivestreaming_bw => WEB_BANDWIDTH[event.web_bw],
|
77
|
+
:web_codec => WEB_CODEC[event.web_bw],
|
78
|
+
:recording_codec => RECORDING_CODEC[event.recording_bw],
|
79
|
+
:path => "attachments/conferences/#{event.permalink}" }
|
80
|
+
cm_event = event.cm_event
|
81
|
+
cm_event.load(new_params)
|
82
|
+
|
83
|
+
begin
|
84
|
+
cm_event.save
|
85
|
+
rescue StandardError =>e
|
86
|
+
event.errors.add_to_base(e.to_s)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
before_destroy do |event|
|
92
|
+
if event.uses_conference_manager?
|
93
|
+
# Delete event in conference Manager
|
94
|
+
begin
|
95
|
+
cm_event = ConferenceManager::Event.find(event.cm_event_id)
|
96
|
+
cm_event.destroy
|
97
|
+
rescue ActiveResource::ResourceNotFound => e
|
98
|
+
true
|
99
|
+
else
|
100
|
+
true
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
module InstanceMethods
|
110
|
+
# The conference manager mode
|
111
|
+
def cm_mode
|
112
|
+
case vc_mode_sym
|
113
|
+
when :telemeeting
|
114
|
+
'meeting'
|
115
|
+
when :teleconference
|
116
|
+
'conference'
|
117
|
+
when :teleclass
|
118
|
+
'class'
|
119
|
+
else
|
120
|
+
raise "Unknown Conference Manager mode: #{ vc_mode_sym }"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def uses_conference_manager?
|
125
|
+
case vc_mode_sym
|
126
|
+
when :telemeeting, :teleconference, :teleclass
|
127
|
+
true
|
128
|
+
else
|
129
|
+
false
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def cm_event
|
134
|
+
unless self.cm_event_id
|
135
|
+
return nil
|
136
|
+
end
|
137
|
+
begin
|
138
|
+
@cm_event ||= ConferenceManager::Event.find(self.cm_event_id)
|
139
|
+
rescue
|
140
|
+
nil
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def cm_event?
|
145
|
+
cm_event.present?
|
146
|
+
end
|
147
|
+
|
148
|
+
def web_url
|
149
|
+
cm_event.try(:web_url)
|
150
|
+
end
|
151
|
+
|
152
|
+
def sip_url
|
153
|
+
cm_event.try(:sip_url)
|
154
|
+
end
|
155
|
+
|
156
|
+
def isabel_url
|
157
|
+
cm_event.try(:isabel_url)
|
158
|
+
end
|
159
|
+
|
160
|
+
def httplivestreaming_url
|
161
|
+
cm_event.try(:httplivestreaming_url)
|
162
|
+
end
|
163
|
+
|
164
|
+
# Returns a String that contains a html with the video of the Isabel Web Gateway
|
165
|
+
%w( player editor streaming ).each do |obj|
|
166
|
+
eval <<-EOM
|
167
|
+
def #{ obj }(width = '640', height = '480', type = 'flash')
|
168
|
+
begin
|
169
|
+
cm_#{ obj } ||=
|
170
|
+
ConferenceManager::#{ obj.classify }.find(:#{ obj },
|
171
|
+
:params => { :width => width,
|
172
|
+
:height => height,
|
173
|
+
:type => type,
|
174
|
+
:event_id => cm_event_id })
|
175
|
+
cm_#{ obj }.html
|
176
|
+
rescue
|
177
|
+
nil
|
178
|
+
end
|
179
|
+
end
|
180
|
+
EOM
|
181
|
+
end
|
182
|
+
|
183
|
+
def web(username, width = '640', height = '480')
|
184
|
+
begin
|
185
|
+
cm_web ||=
|
186
|
+
ConferenceManager::Web.find(:web,
|
187
|
+
:params => { :username => username,
|
188
|
+
:width => width,
|
189
|
+
:height => height,
|
190
|
+
:event_id => cm_event_id })
|
191
|
+
cm_web.html
|
192
|
+
rescue
|
193
|
+
nil
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
def webstats
|
198
|
+
begin
|
199
|
+
cm_webstats ||=
|
200
|
+
ConferenceManager::Webstats.find(:webstat,
|
201
|
+
:params => { :event_id => cm_event_id })
|
202
|
+
cm_webstats.html
|
203
|
+
rescue
|
204
|
+
nil
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
def webmap
|
209
|
+
begin
|
210
|
+
cm_webmap ||=
|
211
|
+
ConferenceManager::Webmap.find(:webmap,
|
212
|
+
:params => { :event_id => cm_event_id })
|
213
|
+
cm_webmap.html
|
214
|
+
rescue
|
215
|
+
nil
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def start!
|
220
|
+
begin
|
221
|
+
ConferenceManager::Start.create(:event_id => cm_event_id)
|
222
|
+
rescue StandardError => e
|
223
|
+
errors.add_to_base(e.to_s)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
#method to ask the conference manager the id of the entry being recorded
|
228
|
+
#returns nil if nothing is being recorded
|
229
|
+
def get_entry_being_recorded
|
230
|
+
begin
|
231
|
+
@event_status ||= ConferenceManager::EventStatus.find("event-status", :params => { :event_id => cm_event_id})
|
232
|
+
unless @event_status.nil?
|
233
|
+
if @event_status.attributes["recording_session"]
|
234
|
+
ae = ::AgendaEntry.find_by_cm_session_id(@event_status.attributes["recording_session"])
|
235
|
+
if ae.event == self
|
236
|
+
return ae.id
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
return nil
|
241
|
+
rescue
|
242
|
+
nil
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
@@ -0,0 +1,248 @@
|
|
1
|
+
module ConferenceManager
|
2
|
+
module Models
|
3
|
+
module ConferenceManagerSession
|
4
|
+
CM_ATTRIBUTES = ["title", "cm_streaming", "cm_recording", "start_time", "end_time"]
|
5
|
+
PAST_UNCHANGEABLE_ATTRIBUTES = ["cm_streaming", "cm_recording", "start_time", "end_time"]
|
6
|
+
CURRENT_UNCHANGEABLE_ATTRIBUTES = ["cm_streaming", "cm_recording", "start_time"]
|
7
|
+
WAKE_UP_TIME = 2.minutes
|
8
|
+
SESSION_STATUS = {:init=>"Init",:recording=>"Recording",:recorded=>"Recorded",:published=>"Published"}
|
9
|
+
|
10
|
+
def self.included(mod)
|
11
|
+
mod.extend(ClassMethods)
|
12
|
+
end
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
def acts_as_conference_manager_session
|
16
|
+
include ConferenceManager::Models::ConferenceManagerSession::InstanceMethods
|
17
|
+
end
|
18
|
+
|
19
|
+
def included(base)
|
20
|
+
base.class_eval do
|
21
|
+
|
22
|
+
validate_on_create do |entry|
|
23
|
+
|
24
|
+
# Validation: Session must be future
|
25
|
+
if entry.errors.empty? && entry.event.uses_conference_manager? && entry.start_time < (Time.zone.now + WAKE_UP_TIME)
|
26
|
+
entry.errors.add_to_base(I18n.t('agenda.entry.error.past_times',
|
27
|
+
:min_date => I18n.l(Time.zone.now + WAKE_UP_TIME), :format => '%d %b %Y %H:%M'))
|
28
|
+
end
|
29
|
+
|
30
|
+
#Session creation on Conference Manager
|
31
|
+
if entry.errors.empty? && entry.event.uses_conference_manager?
|
32
|
+
|
33
|
+
cm_s =
|
34
|
+
ConferenceManager::Session.new(:name => "none",
|
35
|
+
:recording => entry.cm_recording?,
|
36
|
+
:streaming => entry.cm_streaming?,
|
37
|
+
:initDate=> ((entry.start_time - entry.event.start_date)*1000).to_i,
|
38
|
+
:endDate=> ((entry.end_time - entry.event.start_date)*1000).to_i,
|
39
|
+
:event_id => entry.event.cm_event_id)
|
40
|
+
begin
|
41
|
+
cm_s.save
|
42
|
+
entry.cm_session = cm_s
|
43
|
+
rescue => e
|
44
|
+
entry.errors.add_to_base(e.to_s)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
validate_on_update do |entry|
|
50
|
+
|
51
|
+
if entry.errors.empty? && entry.event.uses_conference_manager?
|
52
|
+
|
53
|
+
# Validation: In past sessions cannot be edited PAST_UNCHANGEABLE_ATTRIBUTES
|
54
|
+
if entry.end_time_was.present? && entry.end_time_was.past?
|
55
|
+
entry.errors.add_to_base(I18n.t('agenda.entry.error.attribute_unchangeable')) if (entry.changed & PAST_UNCHANGEABLE_ATTRIBUTES).any?
|
56
|
+
|
57
|
+
# Validation: In current sessions cannot be edited CURRENT_UNCHANGEABLE_ATTRIBUTES
|
58
|
+
elsif entry.end_time_was.present? && !(entry.end_time_was.past?) && entry.start_time_was.present? && Time.now.in_time_zone > (entry.start_time_was - WAKE_UP_TIME)
|
59
|
+
entry.errors.add_to_base(I18n.t('agenda.entry.error.attribute_unchangeable')) if (entry.changed & CURRENT_UNCHANGEABLE_ATTRIBUTES).any?
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
#Session update on Conference Manager
|
64
|
+
if !entry.past? && entry.errors.empty? && entry.event.uses_conference_manager? && (((entry.changed & CM_ATTRIBUTES).any?)||(entry.date_update_action.eql?"move_event")||(entry.date_update_action.eql?"start_date"))
|
65
|
+
if (!entry.date_update_action.eql?"move_event")
|
66
|
+
cm_s = entry.cm_session
|
67
|
+
new_params = { :name => entry.title,
|
68
|
+
:recording => entry.cm_recording?,
|
69
|
+
:streaming => entry.cm_streaming?,
|
70
|
+
:initDate=> ((entry.start_time - entry.event.start_date)*1000).to_i,
|
71
|
+
:endDate=> ((entry.end_time - entry.event.start_date)*1000).to_i,
|
72
|
+
:event_id => entry.event.cm_event_id }
|
73
|
+
|
74
|
+
if entry.cm_session?
|
75
|
+
cm_s.load(new_params)
|
76
|
+
else
|
77
|
+
entry.errors.add_to_base(I18n.t('event.error.cm_connection'))
|
78
|
+
end
|
79
|
+
|
80
|
+
begin
|
81
|
+
cm_s.save
|
82
|
+
rescue => e
|
83
|
+
if cm_s.present?
|
84
|
+
entry.errors.add_to_base(e.to_s)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
before_destroy do |entry|
|
92
|
+
#Delete session in Conference Manager if event is not in-person
|
93
|
+
if entry.event.uses_conference_manager?
|
94
|
+
begin
|
95
|
+
cm_s = entry.cm_session
|
96
|
+
cm_s.destroy
|
97
|
+
rescue => e
|
98
|
+
entry.errors.add_to_base(I18n.t('agenda.entry.error.delete'))
|
99
|
+
false
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
module InstanceMethods
|
109
|
+
def cm_session
|
110
|
+
begin
|
111
|
+
@cm_session ||=
|
112
|
+
ConferenceManager::Session.find(cm_session_id,
|
113
|
+
:params => { :event_id => event.cm_event_id })
|
114
|
+
rescue
|
115
|
+
nil
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def cm_session=(cms_s)
|
120
|
+
self.cm_session_id = cms_s.id
|
121
|
+
@cm_session = cms_s
|
122
|
+
end
|
123
|
+
|
124
|
+
def cm_session?
|
125
|
+
cm_session.present?
|
126
|
+
end
|
127
|
+
|
128
|
+
def status
|
129
|
+
begin
|
130
|
+
@session_status ||=
|
131
|
+
ConferenceManager::SessionStatus.find(:status,
|
132
|
+
:params => { :event_id => event.cm_event_id,
|
133
|
+
:session_id => cm_session_id})
|
134
|
+
rescue
|
135
|
+
nil
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def can_edit_hours?
|
140
|
+
!(event.uses_conference_manager? && past?)
|
141
|
+
end
|
142
|
+
|
143
|
+
#Return a String that contains a html with the video player for this session
|
144
|
+
#with the default width and height, 640x480
|
145
|
+
def player
|
146
|
+
player("640","480")
|
147
|
+
end
|
148
|
+
|
149
|
+
#Return a String that contains a html with the video player for this session
|
150
|
+
def player(width, height)
|
151
|
+
begin
|
152
|
+
@cm_player_session ||=
|
153
|
+
ConferenceManager::PlayerSession.find(:player,
|
154
|
+
:params => { :event_id => event.cm_event_id,
|
155
|
+
:session_id => cm_session.id,
|
156
|
+
:width => width,
|
157
|
+
:height => height})
|
158
|
+
@cm_player_session.html
|
159
|
+
rescue
|
160
|
+
nil
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
#Return a String that contains a html with the video editor for this session
|
165
|
+
def editor(width, height)
|
166
|
+
begin
|
167
|
+
@cm_player_session ||=
|
168
|
+
ConferenceManager::EditorSession.find(:player,
|
169
|
+
:params => { :event_id => event.cm_event_id,
|
170
|
+
:session_id => cm_session.id,
|
171
|
+
:width => width,
|
172
|
+
:height => height})
|
173
|
+
@cm_player_session.html
|
174
|
+
rescue
|
175
|
+
nil
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
#method that changes the recording status of this session
|
180
|
+
#remember that the rest of the sessions of this event will stop the recording if you init one
|
181
|
+
def change_status(new_status)
|
182
|
+
cm_status = status
|
183
|
+
new_params = {:event_id => event.cm_event_id,
|
184
|
+
:session_id => cm_session_id,
|
185
|
+
:status => new_status}
|
186
|
+
cm_status.load(new_params)
|
187
|
+
begin
|
188
|
+
cm_status.save
|
189
|
+
rescue => e
|
190
|
+
if cm_status.present?
|
191
|
+
errors.add_to_base(e.to_s)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
#method to check if the video has been published
|
197
|
+
#either by the user or because the event has finished
|
198
|
+
def check_published_recording
|
199
|
+
cm_status = status
|
200
|
+
debugger
|
201
|
+
puts "hola"
|
202
|
+
end
|
203
|
+
|
204
|
+
#method to get the session status
|
205
|
+
#it can be any in SESSION_STATUS
|
206
|
+
def session_status
|
207
|
+
cm_status = status
|
208
|
+
if cm_status
|
209
|
+
cm_status.attributes["status"]
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
#method to start the recording
|
214
|
+
#remember that the rest of the sessions of this event will stop the recording
|
215
|
+
def start_recording
|
216
|
+
cm_status = status
|
217
|
+
new_params = {:event_id => event.cm_event_id,
|
218
|
+
:session_id => cm_session_id,
|
219
|
+
:status => SESSION_STATUS[:recording]}
|
220
|
+
cm_status.load(new_params)
|
221
|
+
begin
|
222
|
+
cm_status.save
|
223
|
+
rescue => e
|
224
|
+
if cm_status.present?
|
225
|
+
errors.add_to_base(e.to_s)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
#method to stop the recording
|
231
|
+
def stop_recording
|
232
|
+
cm_status = status
|
233
|
+
new_params = {:event_id => event.cm_event_id,
|
234
|
+
:session_id => cm_session_id,
|
235
|
+
:status => SESSION_STATUS[:recorded]}
|
236
|
+
cm_status.load(new_params)
|
237
|
+
begin
|
238
|
+
cm_status.save
|
239
|
+
rescue => e
|
240
|
+
if cm_status.present?
|
241
|
+
errors.add_to_base(e.to_s)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module ConferenceManager
|
2
|
+
class Resource < ActiveResource::Base
|
3
|
+
class << self
|
4
|
+
def domain
|
5
|
+
Site.current.cm_domain.present? ? Site.current.cm_domain : "http://vcc-test.dit.upm.es:8080"
|
6
|
+
end
|
7
|
+
|
8
|
+
def subclasses
|
9
|
+
@subclasses ||= []
|
10
|
+
end
|
11
|
+
|
12
|
+
def inherited(subclass)
|
13
|
+
@subclasses = subclasses | Array(subclass)
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def reload
|
18
|
+
subclasses.each{ |subclass|
|
19
|
+
subclass.site = subclass.domain
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
# This is a single resource, like web or recording, but not events.
|
24
|
+
def singleton
|
25
|
+
@singleton = true
|
26
|
+
end
|
27
|
+
|
28
|
+
# redefine this two methods to remove .format extension
|
29
|
+
def collection_path(prefix_options = {}, query_options = nil)
|
30
|
+
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
|
31
|
+
@singleton ?
|
32
|
+
"#{prefix(prefix_options)}#{collection_name.singularize}#{query_string(query_options)}" :
|
33
|
+
"#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}"
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def element_path(id, prefix_options = {}, query_options = nil)
|
38
|
+
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
|
39
|
+
@singleton ?
|
40
|
+
"#{prefix(prefix_options)}#{collection_name.singularize}#{query_string(query_options)}" :
|
41
|
+
"#{prefix(prefix_options)}#{collection_name}/#{id}#{query_string(query_options)}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ConferenceManager
|
2
|
+
class Session < Resource
|
3
|
+
self.element_name = "session"
|
4
|
+
self.site = domain
|
5
|
+
self.prefix = "/events/:event_id/"
|
6
|
+
|
7
|
+
def recording?
|
8
|
+
recording == "true"
|
9
|
+
end
|
10
|
+
|
11
|
+
def streaming?
|
12
|
+
streaming == "true"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module ConferenceManager
|
2
|
+
module Models
|
3
|
+
autoload :ConferenceManagerEvent, 'conference_manager/models/conference_manager_event.rb'
|
4
|
+
autoload :ConferenceManagerSession, 'conference_manager/models/conference_manager_session.rb'
|
5
|
+
end
|
6
|
+
class Engine < Rails::Engine
|
7
|
+
initializer "conference_manager-ruby.models" do
|
8
|
+
ActiveSupport.on_load(:active_record) do
|
9
|
+
include ConferenceManager::Models::ConferenceManagerEvent
|
10
|
+
include ConferenceManager::Models::ConferenceManagerSession
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: conference_manager-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- GING-UPM
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-07-01 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
name: activeresource
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 49
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
- 10
|
46
|
+
- 3
|
47
|
+
version: 0.10.3
|
48
|
+
type: :development
|
49
|
+
name: ruby-debug
|
50
|
+
version_requirements: *id002
|
51
|
+
description: Ruby wrapping for Conference Manager.
|
52
|
+
email: vcc@dit.upm.es
|
53
|
+
executables: []
|
54
|
+
|
55
|
+
extensions: []
|
56
|
+
|
57
|
+
extra_rdoc_files: []
|
58
|
+
|
59
|
+
files:
|
60
|
+
- .gitignore
|
61
|
+
- .yardopts
|
62
|
+
- Gemfile
|
63
|
+
- README.rdoc
|
64
|
+
- Rakefile
|
65
|
+
- conference_magener-ruby.gemspec
|
66
|
+
- lib/conference_manager-ruby.rb
|
67
|
+
- lib/conference_manager/editor.rb
|
68
|
+
- lib/conference_manager/editor_session.rb
|
69
|
+
- lib/conference_manager/event.rb
|
70
|
+
- lib/conference_manager/event_status.rb
|
71
|
+
- lib/conference_manager/models/conference_manager_event.rb
|
72
|
+
- lib/conference_manager/models/conference_manager_session.rb
|
73
|
+
- lib/conference_manager/player.rb
|
74
|
+
- lib/conference_manager/player_session.rb
|
75
|
+
- lib/conference_manager/resource.rb
|
76
|
+
- lib/conference_manager/session.rb
|
77
|
+
- lib/conference_manager/session_status.rb
|
78
|
+
- lib/conference_manager/start.rb
|
79
|
+
- lib/conference_manager/streaming.rb
|
80
|
+
- lib/conference_manager/web.rb
|
81
|
+
- lib/conference_manager/webmap.rb
|
82
|
+
- lib/conference_manager/webstats.rb
|
83
|
+
has_rdoc: true
|
84
|
+
homepage: http://github.com/ging/conference_manager-ruby
|
85
|
+
licenses: []
|
86
|
+
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
version: "0"
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
hash: 3
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
version: "0"
|
110
|
+
requirements: []
|
111
|
+
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 1.6.2
|
114
|
+
signing_key:
|
115
|
+
specification_version: 3
|
116
|
+
summary: Ruby wrapping for Conference Manager.
|
117
|
+
test_files: []
|
118
|
+
|