Add LastFm.Scrobble abstraction

This commit is contained in:
Claudio Ortolina
2025-05-07 08:38:35 +01:00
parent fcdae8f925
commit 8477517e5c
3 changed files with 18 additions and 7 deletions
+9
View File
@@ -0,0 +1,9 @@
defmodule LastFm.Scrobble do
defstruct [:track, :artist, :timestamp, :album, :album_artist, :mbid]
def encode(scrobble) do
scrobble
|> Map.from_struct()
|> Map.reject(fn {_key, value} -> is_nil(value) end)
end
end