2020-06-08 23:37:11 +02:00
|
|
|
defmodule OpenpodWeb.FeedView do
|
|
|
|
use OpenpodWeb, :view
|
2020-05-22 22:04:15 +02:00
|
|
|
|
|
|
|
def format_length(length) do
|
2020-05-24 23:01:58 +02:00
|
|
|
min = length / 60 |> trunc()
|
2020-05-24 23:13:17 +02:00
|
|
|
sec = length - (min * 60) |> Integer.to_string |> String.pad_leading(2, "0")
|
2020-05-22 22:04:15 +02:00
|
|
|
"#{min}:#{sec}"
|
|
|
|
end
|
2020-07-04 08:47:23 +02:00
|
|
|
|
|
|
|
def base_url(conn) do
|
|
|
|
scheme = conn
|
|
|
|
|> Map.fetch!(:scheme)
|
|
|
|
|> Atom.to_string
|
|
|
|
|
|
|
|
host = conn
|
|
|
|
|> Map.fetch!(:host)
|
|
|
|
|
|
|
|
port = conn
|
|
|
|
|> Map.fetch!(:port)
|
|
|
|
|> Integer.to_string
|
|
|
|
|
|
|
|
"#{scheme}://#{host}:#{port}"
|
|
|
|
end
|
2020-05-22 22:04:15 +02:00
|
|
|
end
|