Small tool to continuously fetch current track information and pass it to simple, customizable hooks e.g. dumping into a text file for a now-playing-bar in livestreams or publishing it to your home assistant via MQTT. Bare-bones, with support for configuration via command line arguments, .env files and a typescript config file.
- MQTT - publish the current track info to a MQTT broker
- File Dump - write the current track info to a text file
- HTTP Server - expose the current track info via a simple HTTP endpoint
- GeekMagic - send the current track's album cover to a GeekMagic device
-
Get yourself a last.fm API-Key here (you do not need to enter a callback URL for this tool).
-
go into
packages/core, copy the.env.example-file and rename the copy to.env. enter your last.fm API-Key and your last.fm username. -
Install dependencies:
bun install-
copy the
config.example.tsfile inpackages/core/srctoconfig.tsand adjust the configuration to your needs. Every hook-package should expose a builder function that can be used to create a hook. The hook will be called with the current track info every time it changes. -
run the tool:
bun run --bun index.tsfrom the packages/core directory or (if you installed go-task) simply run
task devanywhere in the repository.
the following parameter are available
--interval <number>- the interval (in milliseconds) in which the current track info should be requested and updated (don't set this too low or you might run into API limits)--allow-inactive-tracks- whether the broker should pass inactive tracks to the hooks; if not set, the broker will only pass actively playing tracks to the hooks--help- show a help message
there are multiple ways to deploy and use this tool:
- simply run it on your local machine using
bun run - run it in a docker container using the provided Dockerfile (you can build and run the image using
task container:up) - compile it to a binary using
task buildand run it on your server
If you have written a cool hook, feel free to open a PR and I might add it to the repository!