Add logic to backfill scrobbled_tracks

Chokes on duplicate primary keys
This commit is contained in:
Claudio Ortolina
2025-05-31 20:12:36 +01:00
parent a27b38f192
commit 750f0a74d1
4 changed files with 52 additions and 7 deletions
+5 -2
View File
@@ -51,11 +51,14 @@ defmodule LastFm.API do
|> post_request()
end
def get_recent_tracks(to_uts \\ nil, config) do
def get_recent_tracks(opts \\ [], config) do
to_uts = Keyword.get(opts, :to_uts)
limit = Keyword.get(opts, :limit, 50)
params =
config
|> base_params()
|> Keyword.merge(method: "user.getrecenttracks", limit: 50)
|> Keyword.merge(method: "user.getrecenttracks", limit: limit)
params = if to_uts, do: Keyword.put(params, :to, to_uts), else: params