- Rust 87.7%
- Nix 6.7%
- Hurl 4.4%
- Shell 1.2%
| api | ||
| nix | ||
| sandbox | ||
| src | ||
| .envrc | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| manifest.json | ||
| README.md | ||
Navidrome Smart Plugin
Analyze listening activity of the user and build personalized mixes with AudioMuse AI.
Requirements
- Navidrome
- AudioMuse AI
Algorithm
My Vibe
TODO: Design a better solution. The current implementation is too simple and produces overly random results.
Takes the last 15 songs, estimates the average mood, and seeds Alchemy with it.
Daily Mixes
- Build a weighted listening profile
Fetch listening history from the last 6 months.
For each song, calculate a preference weight:
w = ln(1 + sum(e^(-decay_rate * age)))
Use a half-life of 45 days:
decay_rate = ln(2) / 45
- Cluster the songs
Fetch the embedding for each song and build 6 clusters using the K-Means algorithm.
- Find similar tracks
Filter out unwanted tracks from the clusters.
For each cluster:
- Take N = min(top_songs, 17) songs (sorted by preference weight)
- Run Alchemy on these songs to get similar tracks
- Apply filters to similar tracks
- Take 50 - N similar tracks and add them to the mix.
- Save the playlist as Daily Mix #N
Roadmap
- My Vibe
- Daily Mixes
- Your Artist Mixes
Development
This project uses Nix as the primary build and development environment. Enter the development shell with:
nix develop
If you don't use Nix, inspect flake.nix to find the required build tools.
Build the plugin with Cargo:
cargo build --target wasm32-wasip1
Navidrome expects an .ndp file containing plugin.wasm and manifest.json.
Use the sandbox/build.sh script (available as build-plugin for Nix users)
to generate one:
build-plugin
The plugin is saved to sandbox/data/plugins/smart-plugin.ndp.
You can copy it to your server, but I recommend using sandbox/compose.yaml
as a test environment instead.
First, create a backup of your server:
navidrome backup create [-d <folder>]
Copy the backup to sandbox/data so Docker can access it:
cp ~/Downloads/navidrome_backup_*.db sandbox/data
Restore the backup:
docker compose -f sandbox/compose.yaml run --rm navidrome \
backup restore --backup-file /data/navidrome_backup_*.db
Start the dev server:
docker compose -f sandbox/compose.yaml up -d
Open localhost:4533, go to Plugins, and enable smart-plugin.
After each change, run build-plugin. Navidrome detects the update, but you
must re-enable the plugin manually.