Back to Oh My Posh

LastFM

website/docs/segments/music/lastfm.mdx

29.13.02.4 KB
Original Source

What

Show the currently playing song from a LastFM user.

:::caution Be aware that LastFM updates may be severely delayed when paused and songs may linger in the "now playing" state for a prolonged time.

Additionally, we are using HTTP requests to get the data, so you may need to adjust the http_timeout to your liking to get better results.

You must request an API key at the LastFM website. :::

Sample Configuration

import Config from "@site/src/components/Config.js";

<Config data={{ background: "p:sky", foreground: "p:white", powerline_symbol: "\ue0b0", options: { api_key: "<YOUR_API_KEY>", username: "<LASTFM_USERNAME>", http_timeout: 20000, }, style: "powerline", template: ' {{ .Icon }}{{ if ne .Status "stopped" }}{{ .Full }}{{ end }} ', type: "lastfm", }} />

Options

NameTypeDefaultDescription
playing_iconstring\uE602 text/icon to show when playing
stopped_iconstring\uF04D text/icon to show when stopped
api_keytemplate.your LastFM API key
usernamestring.your LastFM username
http_timeoutint20in milliseconds - the timeout for http request

Template (info)

:::note default template

template
{{ .Icon }}{{ if ne .Status \"stopped\" }}{{ .Full }}{{ end }}

:::

Properties

NameTypeDescription
.Statusstringplayer status (playing, paused, stopped)
.Artiststringcurrent artist
.Trackstringcurrent track
.Fullstringwill output Artist - Track
.Iconstringicon (based on .Status)