|
1
|
|
|
# frozen_string_literal: true |
|
2
|
|
|
|
|
3
|
|
|
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
|
4
|
|
|
# |
|
5
|
|
|
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
|
6
|
|
|
# |
|
7
|
|
|
# This program is free software; you can redistribute it and/or modify it under the |
|
8
|
|
|
# terms of the GNU Lesser General Public License as published by the Free Software |
|
9
|
|
|
# Foundation; either version 3.0 of the License, or (at your option) any later |
|
10
|
|
|
# version. |
|
11
|
|
|
# |
|
12
|
|
|
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
|
13
|
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|
14
|
|
|
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
|
15
|
|
|
# |
|
16
|
|
|
# You should have received a copy of the GNU Lesser General Public License along |
|
17
|
|
|
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
|
18
|
|
|
|
|
19
|
|
|
module RecordingsHelper |
|
20
|
|
|
# Helper for converting BigBlueButton dates into the desired format. |
|
21
|
|
|
def recording_date(date) |
|
22
|
|
|
I18n.l date, format: "%B %d, %Y" |
|
23
|
|
|
end |
|
24
|
|
|
|
|
25
|
|
|
# Helper for converting BigBlueButton dates into a nice length string. |
|
26
|
|
|
def recording_length(playbacks) |
|
27
|
|
|
# Stats format currently doesn't support length. |
|
28
|
|
|
valid_playbacks = playbacks.reject { |p| p[:type] == "statistics" } |
|
29
|
|
|
return "0 min" if valid_playbacks.empty? |
|
30
|
|
|
|
|
31
|
|
|
len = valid_playbacks.first[:length] |
|
32
|
|
|
if len > 60 |
|
33
|
|
|
"#{(len / 60).to_i} h #{len % 60} min" |
|
34
|
|
|
elsif len.zero? |
|
35
|
|
|
"< 1 min" |
|
36
|
|
|
else |
|
37
|
|
|
"#{len} min" |
|
38
|
|
|
end |
|
39
|
|
|
end |
|
40
|
|
|
|
|
41
|
|
|
# Prevents single images from erroring when not passed as an array. |
|
42
|
|
|
def safe_recording_images(images) |
|
43
|
|
|
Array.wrap(images) |
|
44
|
|
|
end |
|
45
|
|
|
|
|
46
|
|
|
def room_uid_from_bbb(bbb_id) |
|
47
|
|
|
Room.find_by(bbb_id: bbb_id)[:uid] |
|
48
|
|
|
end |
|
49
|
|
|
|
|
50
|
|
|
# returns whether recording thumbnails are enabled on the server |
|
51
|
|
|
def recording_thumbnails? |
|
52
|
|
|
Rails.configuration.recording_thumbnails |
|
53
|
|
|
end |
|
54
|
|
|
end |
|
55
|
|
|
|