open-pod/lib/openpod_web/views/feed_view.ex

25 lines
475 B
Elixir
Raw Normal View History

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
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