21 lines
607 B
Ruby
21 lines
607 B
Ruby
module ClipsHelper
|
|
def seconds_to_time(seconds)
|
|
if seconds >= 3600 then
|
|
Time.at(seconds.round).utc.strftime("%H:%M:%S") #=> "01:00:00"
|
|
else
|
|
Time.at(seconds.round).utc.strftime("%M:%S") #=> "01:00:00"
|
|
end
|
|
end
|
|
|
|
def get_video_aspect(video)
|
|
if video.metadata["width"] and video.metadata["height"]
|
|
width = video.metadata["width"].round
|
|
height = video.metadata["height"].round
|
|
common_fact = width.gcd(height)
|
|
width_div = width / common_fact
|
|
height_div = height / common_fact
|
|
return "#{width_div}:#{height_div}"
|
|
end
|
|
return ""
|
|
end
|
|
end
|