Add LastFm feed for a given user

This commit is contained in:
Claudio Ortolina
2024-11-04 09:17:01 +00:00
parent c9beef6bdd
commit 1abcc5e6ad
8 changed files with 202 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
defmodule LastFm.Supervisor do
use Supervisor
def start_link(init_arg) do
Supervisor.start_link(__MODULE__, init_arg, name: __MODULE__)
end
@impl true
def init(_init_arg) do
:ok = LastFm.Feed.create_table!()
children = [
{LastFm.Refresh, %{user: "cloud8421", api_key: api_key()}}
]
Supervisor.init(children, strategy: :one_for_one)
end
defp api_key do
Application.get_env(:music_library, LastFm, [])
|> Keyword.get(:api_key)
end
end