Toru
API for generating customizable image embeds of last.fm activity
Install / Use
/learn @kiosion/ToruREADME
Demos 🚧
<div align="center"> <a href="https://last.fm/user/kiosion" target="_blank"><img src="https://toru.kio.dev/api/v1/kiosion?theme=dark" alt="Last.fm Activity" width="380px" /></a> <a href="https://last.fm/user/kiosion" target="_blank"><img src="https://toru.kio.dev/api/v1/kiosion?theme=light" alt="Last.fm Activity" width="380px" /></a> </div>Usage 🔧
Simply add the following snippet to your Github profile readme (or anywhere else you'd like to embed your last.fm activity):
<img src="https://toru.kio.dev/api/v1/{your_lfm_username}" alt="Last.fm Activity" />
You can append ?res=json to get a JSON response:
GET https://toru.kio.dev/api/v1/{your_lfm_username}?res=json
->
{
status: 200,
data: {
url: "https://last.fm/music/X",
title: "X",
streamable: false,
playing: true,
cover_art: {
mime_type: "image/png",
data: "X"
},
artist: "X",
album: "X"
}
}
You can also connect to the Websocket endpoint - recieved frames will be of the "data" field above. Minute-interval pings are required to stay connected.
wss://toru.kio.dev/api/v1/ws/{your_lfm_username}
Options ⚙️
Toru has a few parameters you can customize through query parameters:
Theme
The theme can be specified with theme=<str>. Available themes are:
- dark/light
- shoji
- dracula
- nord
- solarized
- monokai
Border radius
The border radius of the embed can be specified as an integer with border_radius
Cover radius
The border radius of the album art can be specified as an integer with cover_radius
Blurred background
A blurred background can be enabled using blur:
<a href="https://last.fm/user/kiosion" target="_blank"><img src="https://toru.kio.dev/api/v1/kiosion?theme=nord&blur" alt="Last.fm Activity" width="380px" /></a>
Border width
The width of the borders can be specified (or removed by setting to '0') with border_width:
<a href="https://last.fm/user/kiosion" target="_blank"><img src="https://toru.kio.dev/api/v1/kiosion?theme=dracula&border_width=0" alt="Last.fm Activity" width="380px" /></a>
Custom SVG asset
You can alternativly specify a custom SVG asset with svg_url=<str>. Toru will fill in the artist name, track title, album title, and cover art resource using the following template strings:
- Cover art ->
${cover_art}(should be the 'src' attr, as it's sent as a b64-encoded image string) - Artist ->
${artist} - Album ->
${album} - Track ->
${title}
Building / Testing 🔨
- Clone the repo
- Run
make installto pull & compile needed dependencies
Running
- Make sure you have an
.envfile in the project root, withLFM_TOKENset to your last.fm API key, and optionallyPORTset to the port you want to run the dev server on (default is 4000) - Run
make devto run the livereload dev server, andmake testto run all unit tests.
Building a release
- Environment variables
LFM_TOKENandPORTare required to build a release make releasecompiles environment variables and builds a docker image with the releasemake runstops any previuosly running docker container, and runs the new release
Contributing 🤝
Feel free to open an issue or pull request if you have suggestions or find any bugs!
Related Skills
node-connect
334.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
334.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.1kCommit, push, and open a PR
