lastfm_archive v0.7.2 LastfmArchive.Extract View Source

This module provides functions that interact with Lastfm API for data extraction and storage.

Link to this section Summary

Functions

Issues a request to Lastfm to extract scrobbled tracks for a user

Write binary data or Lastfm response to a configured directory on local filesystem for a Lastfm user

Link to this section Types

Link to this type lastfm_response() View Source
lastfm_response() :: {:ok, map()} | {:error, binary(), HTTPoison.Error.t()}

Link to this section Functions

Link to this function extract(user, page \\ 1, limit \\ 1, from \\ 0, to \\ 0) View Source
extract(binary(), integer(), integer(), integer(), integer()) ::
  lastfm_response()

Issues a request to Lastfm to extract scrobbled tracks for a user.

See Lastfm API documentation for details on the use of parameters.

Link to this function write(user, data, filename \\ "1") View Source
write(binary(), binary() | lastfm_response(), binary()) ::
  :ok | {:error, :file.posix()}

Write binary data or Lastfm response to a configured directory on local filesystem for a Lastfm user.

The data is compressed, encoded and stored in a file of given filename within the data directory, e.g. ./lastfm_data/user/ as configured below:

config :lastfm_archive,
  ...
  data_dir: "./lastfm_data/"