Skip to main content

Last.fm Plugin

Showcase your musical taste by displaying your top artists, albums, tracks, or tags from Last.fm.

Dependencies

To use this plugin you'll need requests. You can install dōteki and this dependency with:

pip install doteki[lastfm]

Configuration

The Last.fm plugin can be customized with these settings:

  • username (required): Your Last.fm username.
  • type: Type of data to display. Accepted values are "artists", "albums", "tracks", and "tags". Default: "artists".
  • n: Number (positive integer) of items to display. Default: 1.
  • period: Time period to retrieve data from. Accepted values are "overall", "7day", "1month", "3month", "6month", and "12month". Default: "7day".
  • include_links: Whether to link to Last.fm pages on the name of artists, albums… Default: true.

The API key needs to be provided through the DOTEKI_LASTFM_API_KEY environment variable (read How to set environment variables). Create a free Last.fm API account here.

Usage

To use the Last.fm plugin, set up a section with this plugin name, your Last.fm username and optional settings:

doteki.toml
[sections.top_artist]
plugin = "lastfm"
username = "your_lastfm_username"

This configuration will return your most-listened artist from the last seven days.

Examples

Top 3 artists of the last month

doteki.toml
[sections.lastfm]
plugin = "lastfm"
type = "artists" # Default value.
username = "your_lastfm_username"
n = 3
period = "1month"
preset = "numbered_list"

This configuration will display your top 3 artists from the last month, each as an item in a numbered list, like this:

Top 3 all-time songs

doteki.toml

[sections.lastfm]
plugin = "lastfm"
type = "tracks"
username = "your_lastfm_username"
n = 3
period = "12month"
preset = "comma_and"
inline = true
README.md
The three tracks I've listened to the most this year are <!-- lastfm start --><!-- lastfm end -->.

This configuration will display your all-time top 3 songs:

The three tracks I've listened to the most this year are Matt Maltese - Widows, yeule - cyber meat, and Indigo De Souza - You Can Be Mean.

doteki.toml
[sections.lastfm]
plugin = "lastfm"
username = "your_lastfm_username"
type = "albums"
n = 3
period = "1month"
include_links = false

This configuration will display your top 3 albums from the last month, each as an item in a Markdown list, without links:

  • Deafheaven - Sunbather (10th Anniversary Remix / Remaster)
  • Jónsi & Alex - Riceboy Sleeps
  • Dedekind Cut - Tahoe

Most listened track of the week

doteki.toml
[sections.lastfm]
plugin = "lastfm"
username = "your_lastfm_username"
type = "tracks"
n = 1
period = "7day"
inline = true
README.md
I've been listening to <!-- lastfm start --><!-- lastfm end --> on repeat.

After running dōteki, you'll get: