Extend Last.fm Feed album/artist functions
This commit is contained in:
+6
-6
@@ -41,26 +41,26 @@ defmodule LastFm.Feed do
|
||||
def all_artists do
|
||||
m = [
|
||||
{
|
||||
{:"$1", %{artist: :"$2"}},
|
||||
{:"$1", %{scrobbled_at_label: :"$2", artist: :"$3"}},
|
||||
[],
|
||||
[:"$2"]
|
||||
[%{scrobbled_at_uts: :"$1", scrobbled_at_label: :"$2", artist: :"$3"}]
|
||||
}
|
||||
]
|
||||
|
||||
:ets.select_reverse(__MODULE__, m) |> Enum.uniq()
|
||||
:ets.select_reverse(__MODULE__, m) |> Enum.uniq_by(fn pair -> pair.artist end)
|
||||
end
|
||||
|
||||
@spec all_albums() :: [LastFm.Album.t()]
|
||||
def all_albums do
|
||||
m = [
|
||||
{
|
||||
{:"$1", %{album: :"$2"}},
|
||||
{:"$1", %{scrobbled_at_label: :"$2", album: :"$3", cover_url: :"$4"}},
|
||||
[],
|
||||
[:"$2"]
|
||||
[%{scrobbled_at_uts: :"$1", scrobbled_at_label: :"$2", album: :"$3", cover_url: :"$4"}]
|
||||
}
|
||||
]
|
||||
|
||||
:ets.select_reverse(__MODULE__, m) |> Enum.uniq()
|
||||
:ets.select_reverse(__MODULE__, m) |> Enum.uniq_by(fn pair -> pair.album end)
|
||||
end
|
||||
|
||||
@spec subscribe() :: :ok
|
||||
|
||||
Reference in New Issue
Block a user