Lastfm.Archive behaviour (lastfm_archive v0.9.0) View Source

A behaviour module for implementing 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.

Functions

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

Callbacks

Describes the status of an existing archive.

Creates a new and empty archive and records metadata.

Write scrobbles data to an existing archive.

Link to this section Types

Specs

options() :: keyword()

Specs

scrobbles() :: map()

Specs

t() :: %Lastfm.Archive{
  created: DateTime.t(),
  creator: binary(),
  date: Date.t(),
  description: binary(),
  extent: integer(),
  format: binary(),
  identifier: binary(),
  modified: DateTime.t(),
  source: binary(),
  temporal: {integer(), integer()},
  title: binary(),
  type: atom()
}

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

Specs

user() :: binary()

Link to this section Functions

Specs

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 section Callbacks

Specs

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

Describes the status of an existing archive.

Link to this callback

update_metadata(t, options)

View Source

Specs

update_metadata(t(), options()) :: {:ok, t()} | {:error, term()}

Creates a new and empty archive and records metadata.

Link to this callback

write(t, scrobbles, options)

View Source

Specs

write(t(), scrobbles(), options()) :: :ok | {:error, term()}

Write scrobbles data to an existing archive.