Use streams for scrobbled tracks

This commit is contained in:
Claudio Ortolina
2024-11-04 22:21:31 +00:00
parent 7b8bb61705
commit 923b3f071d
4 changed files with 18 additions and 14 deletions
+10 -2
View File
@@ -17,11 +17,19 @@ defmodule LastFm.Feed do
:ets.delete_all_objects(__MODULE__)
:ets.insert(__MODULE__, data)
Phoenix.PubSub.broadcast(LastFm.PubSub, "feed:update", %{tracks: data})
Phoenix.PubSub.broadcast(LastFm.PubSub, "feed:update", %{tracks: tracks})
end
def all do
:ets.tab2list(__MODULE__)
m = [
{
{:_, :_},
[],
[{:element, 2, :"$_"}]
}
]
:ets.select(__MODULE__, m)
|> Enum.reverse()
end