View Source LastfmArchive.Behaviour.Archive behaviour (lastfm_archive v0.10.0)

Behaviour of a Lastfm archive.

The module also provides a struct that keeps metadata about the archive. An archive contains scrobbles data retrieved from Lastfm API. It can be based upon various storage implementation such as file systems and databases.

Link to this section Summary

Types

t()

Metadata descriping a Lastfm archive based on Dublin Core Metadata Initiative.

Callbacks

Archives all scrobbles data for a Lastfm user.

Returns metadata of an existing archive.

Writes latest metadata to file.

Functions

Data struct containing new and some default metadata of an archive.

Link to this section Types

@type client() :: LastfmArchive.LastfmClient.t()
@type options() :: keyword()
@type scrobbles() :: map()
@type t() :: %LastfmArchive.Behaviour.Archive{
  created: DateTime.t(),
  creator: binary(),
  date: Date.t(),
  description: binary(),
  extent: integer(),
  format: binary(),
  identifier: binary(),
  modified: nil | DateTime.t(),
  source: binary(),
  temporal: {integer(), integer()},
  title: binary(),
  type: atom()
}

Metadata descriping a Lastfm archive based on Dublin Core Metadata Initiative.

@type user() :: binary()

Link to this section Callbacks

Link to this callback

archive(t, options, client)

View Source
@callback archive(t(), options(), client()) :: {:ok, t()} | {:error, term()}

Archives all scrobbles data for a Lastfm user.

@callback describe(user(), options()) :: {:ok, t()} | {:error, term()}

Returns metadata of an existing archive.

Link to this callback

update_metadata(t, options)

View Source
@callback update_metadata(t(), options()) :: {:ok, t()} | {:error, term()}

Writes latest metadata to file.

Link to this section Functions

@spec new(user()) :: t()

Data struct containing new and some default metadata of an archive.

Other metadata fields such as temporal, modified can be populated based on the outcomes of archiving, i.e. the implementation of the callbacks of this behaviour.

Link to this function

new(archive, total, registered_time, last_scrobble_time)

View Source