Fixed recording duration

This commit is contained in:
Erick Kad-Bay 2016-11-29 15:51:56 -05:00
parent 44701c0cd9
commit 98802234a7
3 changed files with 10 additions and 3 deletions

View File

@ -140,8 +140,14 @@ class @Recordings
if !@owner
table_api.column(-1).visible(false)
for recording in data.recordings
totalMinutes = Math.round((new Date(recording.end_time) - new Date(recording.start_time)) / 1000 / 60)
recording.duration = totalMinutes
hours = Math.floor(recording.length/60)
minutes = recording.length % 60
recording.duration = if minutes>=60
hours+"hours and "+minutes+" minutes"
else if minutes>1
minutes+" minutes"
else
"< 1 minute"
data.recordings.sort (a,b) ->
return new Date(b.start_time) - new Date(a.start_time)
table_api.clear()

View File

@ -113,7 +113,7 @@ module BbbApi
res[:recordings].each do |recording|
pref_preview = {}
recording[:length] = recording[:playback][:format].is_a?(Hash) ? recording[:playback][:format][:length] : recording[:playback][:format].first[:length]
# create a playbacks attribute on recording for playback formats
recording[:playbacks] = if !recording[:playback] || !recording[:playback][:format]
[]

View File

@ -23,6 +23,7 @@ json.recordings do
json.start_time recording[:startTime]
json.end_time recording[:endTime]
json.published recording[:published]
json.length recording[:length]
json.previews do
json.array!(recording[:previews]) do |preview|
json.partial! 'preview', preview: preview