open-pod/lib/openpod_web/controllers/page_controller.ex
danilo silva 054d875b66 feat: fetching data from archive.org at compile time
fetching data from archive.org at compile time to populate the
"chi-siamo" page
2020-11-14 22:52:41 +00:00

26 lines
670 B
Elixir

defmodule OpenpodWeb.PageController do
use OpenpodWeb, :controller
Application.ensure_all_started(:hackney)
@base_url Application.get_env(:openpod, :base_url)
@podders Application.get_env(:openpod, :podders)
|> Enum.map(fn podcast ->
Openpod.Provider.Archive.Parser.by_identifier(podcast)
|> Map.get(:podcast)
|> Map.put(:podcast_url, "#{@base_url}/podcast/#{podcast}")
end)
def index(conn, _params) do
render(conn, "index.html")
end
def howto(conn, _params) do
render(conn, "howto.html")
end
def chi(conn, _params) do
render(conn, "chi.html", podders: @podders)
end
end