New README and screenshots from a demo library

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
astar76 2026-10-24 16:27:37 -05:00
commit bdc6341b3d
6 changed files with 182 additions and 60 deletions

148
README.md
View file

@ -1,77 +1,87 @@
<div align="center">
<img src="assets/mulberry.svg" width="112" alt="Mulberry logo">
<img src="assets/mulberry.svg" width="104" alt="Mulberry">
# Mulberry
**A Material You music player for Linux, written in Rust.**
Strawberry's library and playlists with an expressive, colour-matched "now playing" panel.
Your library, tabbed playlists, synced lyrics and a colour-matched "now playing" panel,
in one small native app.
[Download](https://archlinux.tail7c4f5e.ts.net/git/astar76/Mulberry/releases/latest) ·
[Build from source](#build-from-source) ·
[Shortcuts](#keyboard-shortcuts)
![Mulberry playing a song with synced lyrics](docs/main.png)
</div>
This is the Rust rewrite of the original Python/PyQt6 Mulberry (kept next to this folder as `Mulberry-python`).
It keeps the same look, the same library database and the same features, and fixes a few things on the way.
## Highlights
![Right-click a field and set it on every selected track](docs/set-tag-menu.png)
- **Material You everywhere.** Colours come from your system accent, the album art or a colour you pick, in light or dark.
The cover is a spinning cookie wrapped in a live spectrum, the seek bar is wavy, the play button morphs.
- **Fix tags from the playlist.** Select tracks, right-click the *Album*, *Artist*, *Title*… cell of one of them and choose
**Set album to “…”**: the value is written into every selected file at once, with Undo.
- **Synced lyrics** from LRCLIB, NetEase, embedded tags or `.lrc` files; click a line to jump there.
- **Gapless playback, crossfade, equalizer and ReplayGain** through libmpv, plus YouTube/SoundCloud/Bandcamp links and internet radio.
- **Light on resources.** One native binary, GPU-drawn UI, animations capped at 30 fps (adjustable), no repaints while paused.
- **Lives in the tray.** Closing the window (or Ctrl+Q) keeps the music going; the tray icon brings the window back.
Media keys and shell widgets work through MPRIS.
## What's new in the Rust version
- **Set tag from the right-click menu (Strawberry style).** Select several tracks, right-click the **Album**, **Artist**,
**Title**, **Album artist**, **Genre**, **Composer**, **Year**, **Track** or **Disc** cell of any of them and pick
*Set album to “Disclaimer II”*. The value of the cell you clicked is written into the tags of **all selected files
immediately** (FLAC, Ogg/Opus, MP3, M4A, WAV, …), the library and every open playlist update, and a toast with **Undo**
restores the old values.
- **Seek bar no longer glitches.** The wavy bar used to integrate time itself and then get pulled back and forth by
coarse position reports from the player (and by stale reports right after a seek). Now one monotonic clock drives
everything: reports only nudge an estimate, the shown position never goes backwards, stale pre-seek reports are
ignored, and the wave phase comes from absolute time. The cover is uploaded to the GPU once and drawn as a textured
mesh, so nothing is rescaled per frame.
- **Light on the CPU.** Idle and paused means no repaints at all. While playing, animations run at the frame-rate cap
(Settings › Appearance, default 30 fps); one whole UI frame costs about 1 ms of CPU (`cargo test --release --test bench`).
- Single native binary (no Python, no Qt), GPU-drawn with egui, MPRIS + system tray + desktop notifications.
## Install
Needs Rust, `libmpv` (the `mpv` package) and, optionally, `ffmpeg`, `cdparanoia`, `yt-dlp` and `parec`.
```bash
./install.sh # builds the release binary, installs ~/.local/bin/mulberry + menu entry + icon
./install.sh --uninstall
```
Arch: `sudo pacman -S rust mpv ffmpeg cdparanoia yt-dlp libpulse`
Your existing library (`~/.local/share/mulberry/library.db`), playlists, covers and lyrics cache are used as they are.
Settings are imported once from the old `mulberry.conf` into `~/.config/mulberry/settings.json`.
![Set a tag on several tracks at once](docs/set-tag-menu.png)
## Features
**Look and feel**
- Material 3 colour roles from your system colours (`~/.config/kdeglobals` when present), from the album art, or from a
custom seed colour; light/dark follows the system or is forced.
- Hero panel: cookie-shaped spinning cover with a radial spectrum (decoded from the track itself and synced to the
playback position), wavy seek bar, morphing play button, synced lyrics (click a line to seek), Large / Compact / Hidden
layouts and a Focus mode (F11).
- Floating bass shape in the bottom-left corner and a block spectrum analyzer in the bottom bar.
**Library**
- Incremental background scanner over your music folders, stored in SQLite.
- Browse by album artist, artist, genre, year or album; search with `artist:` `album:` `genre:` `year:>2000` `rating:>3`.
- Smart lists (recently added, most played, loved, never played, random…), play counts, skips and 0–5 star ratings.
- Most audio formats (MP3, FLAC, Ogg/Opus, M4A/AAC/ALAC, WMA, APE, WavPack, WAV/AIFF, DSF, trackers, …); cue sheets play as separate tracks.
**Library and playback**
- SQLite collection with an incremental background scanner; group by album artist, artist, genre, year or album;
search with `artist:` `album:` `genre:` `year:>2000` `rating:>3`.
- Tabbed playlists with undo/redo, multi-select, drag and drop (also from the library tree and from the file manager),
column chooser/reordering/resizing, sorting, filtering, duplicate and missing-file removal, saved/pinned playlists.
- Play queue, *Play next*, *Stop after this track*, shuffle and repeat; smart playlists; play counts, skips, 0–5 star ratings.
- Import M3U/M3U8/PLS/XSPF/WPL/ASX/CUE, export M3U/M3U8/PLS/XSPF/WPL (single or all playlists).
- Gapless playback, crossfade (1–12 s), 10-band equalizer with presets, ReplayGain, output device selection, resume on start.
- YouTube, SoundCloud, Bandcamp… links (through `yt-dlp`) and internet radio with now-playing titles.
**Playlists**
- Tabs with undo/redo, multi-select, drag and drop (within a list, between tabs, from the library or the file manager).
- Column chooser, reordering, resizing, sorting and filtering; remove duplicates and missing files; saved playlists that reopen later.
- Play queue, *Play next*, *Stop after this track*, shuffle, repeat.
- Import M3U, M3U8, PLS, XSPF, WPL, ASX, CUE; export M3U, M3U8, PLS, XSPF, WPL, one list or all at once.
**Metadata**
- Tag editor for one or many files with cover embedding; MusicBrainz lookup (pick a match or auto-apply the best);
cover manager (iTunes, Deezer, Cover Art Archive, Last.fm); synced lyrics from LRCLIB, NetEase, embedded tags or `.lrc` files.
- Last.fm scrobbling, now-playing and Love (offline cache); ListenBrainz.
- Tag editor for one or many files, with cover embedding for every common format.
- MusicBrainz lookup (pick a match, or auto-apply the best) and a cover manager (iTunes, Deezer, Cover Art Archive, Last.fm).
- Last.fm and ListenBrainz scrobbling with an offline cache, and Love.
**Audio CD**: drive detection, TOC, MusicBrainz lookup, playback and ripping (cdparanoia + ffmpeg to FLAC/ALAC/Opus/Vorbis/MP3/WAV).
**Audio CD:** drive detection, track list with MusicBrainz names and cover, playback, and ripping to FLAC, ALAC, Opus, Vorbis, MP3 or WAV.
**Desktop**: MPRIS2 (media keys, Plasma/shell widgets), tray icon with close-to-tray, notifications with cover art, single instance.
**Desktop:** MPRIS2, tray icon, notifications with cover art, single instance (files you open join the running player),
focus mode (F11), compact and hidden now-playing layouts, a floating bass-reactive shape.
<table>
<tr>
<td><img src="docs/focus.png" alt="Focus mode"></td>
<td><img src="docs/settings.png" alt="Settings"></td>
</tr>
<tr><td align="center">Focus mode (F11)</td><td align="center">Settings</td></tr>
</table>
## Install
### From a release
Download `Mulberry-<version>-Linux-x86_64.tar.gz` from the [Releases page](https://archlinux.tail7c4f5e.ts.net/git/astar76/Mulberry/releases),
unpack it and run `./install.sh` inside. It installs to `~/.local` (no root).
### Build from source
You need Rust and `libmpv` (the `mpv` package).
```bash
git clone forgejo:astar76/Mulberry.git # or the https URL of this page
cd Mulberry
./install.sh # builds in release mode, installs the binary, menu entry and icon
./install.sh --uninstall # remove it again (keeps your data); --purge deletes data too
```
Optional tools unlock more: `ffmpeg` (visualizer analysis, CD encoding), `cdparanoia` (ripping),
`yt-dlp` (web links), `parec` from PulseAudio/PipeWire (visualizer for radio streams).
Arch: `sudo pacman -S rust mpv ffmpeg cdparanoia yt-dlp libpulse`.
## Keyboard shortcuts
@ -90,6 +100,8 @@ Settings are imported once from the old `mulberry.conf` into `~/.config/mulberry
| Ctrl+Z / Ctrl+Shift+Z | Undo / redo |
| Ctrl+L | Love the current track |
| Ctrl+O / Ctrl+Shift+O / Ctrl+U | Open files / folder / URL |
| Ctrl+H | Shuffle on/off |
| Ctrl+Q | Close (to the tray if enabled, else quit) |
| F5 / Ctrl+F5 | Update library / full rescan |
| F11 | Focus mode |
@ -102,18 +114,28 @@ Settings are imported once from the old `mulberry.conf` into `~/.config/mulberry
| Covers | `~/.local/share/mulberry/covers` |
| Thumbnails | `~/.cache/mulberry` |
Settings from older Python versions (`mulberry.conf`) and the old library database are picked up automatically.
## Development
```text
src/player.rs libmpv engine, gapless/crossfade, the monotonic position clock
src/library.rs SQLite collection and scanner
src/playlist.rs playlists, queue, shuffle, undo
src/tags.rs tag reading/writing (lofty), covers
src/spectrum.rs FFT visualizer
src/online.rs lyrics, covers, MusicBrainz, web links
src/mpris.rs src/tray.rs src/scrobble.rs src/cd.rs
src/ui/ hand-painted Material 3 widgets, hero, playlist view, sidebar, dialogs
tests/ tag round trips, playback clock, MPRIS/tray, offscreen UI tests
```
```bash
cargo run --release
cargo test --test tagwrite --test playback --test dbus # tag round trips, seek-bar clock, MPRIS/tray
MULBERRY_SCRATCH=/tmp/mb-scratch cargo test --test shots # offscreen screenshots (needs a scratch copy of the data dirs)
cargo test --test tagwrite --test playback --test stop --test dbus
MULBERRY_DOCS=docs cargo test --test docs_shots # regenerate the screenshots above
```
The UI tests render offscreen through `egui_kittest` (no window) against a scratch copy of the data directories, and the
tag tests only touch freshly generated files.
UI tests render offscreen with `egui_kittest` against a made-up library, so no window opens and your music is never touched.
Layout: `src/player.rs` (libmpv engine + position clock), `src/library.rs`, `src/playlist.rs`, `src/tags.rs` (lofty),
`src/spectrum.rs`, `src/online.rs`, `src/ui/*` (hand-painted Material 3 widgets, hero, playlist view, sidebar, dialogs).
Icons: Material Symbols (Apache 2.0). Licence: MIT.
Icons: Material Symbols (Apache 2.0). License: MIT.

BIN
docs/focus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

BIN
docs/main.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 257 KiB

Before After
Before After

BIN
docs/settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

100
tests/docs_shots.rs Normal file
View file

@ -0,0 +1,100 @@
//! Regenerates the README screenshots from a made-up library:
//! `MULBERRY_DOCS=docs cargo test --test docs_shots -- --nocapture`
use eframe::egui::{self, pos2, vec2, Event, Modifiers, PointerButton};
use egui_kittest::Harness;
use mulberry::app::{AddMode, App};
fn click(h: &mut Harness<'_, App>, pos: egui::Pos2, button: PointerButton, mods: Modifiers) {
h.input_mut().events.push(Event::ModifiersChanged(mods));
h.input_mut().events.push(Event::PointerMoved(pos));
h.step();
h.input_mut().events.push(Event::PointerButton { pos, button, pressed: true, modifiers: mods });
h.step();
h.input_mut().events.push(Event::PointerButton { pos, button, pressed: false, modifiers: mods });
h.step();
h.input_mut().events.push(Event::ModifiersChanged(Modifiers::NONE));
h.step();
}
fn settle(h: &mut Harness<'_, App>, n: usize) {
for _ in 0..n {
h.step();
std::thread::sleep(std::time::Duration::from_millis(40));
}
}
const LYRICS: &str = "[00:00.00]\n[00:08.00]Neon rain on the avenue\n[00:14.00]Every light a little louder\n[00:20.00]Every street a little new\n[00:26.00]Hold the signal, hold it true\n[00:32.00]Falling through the static bloom\n[00:38.00]Mulberry dusk in an empty room\n[00:44.00]Carry me home when the city sleeps\n[00:50.00]Under the glow that the evening keeps\n[00:56.00]Neon rain on the avenue\n[01:02.00]Every light a little louder\n";
#[test]
fn readme_screenshots() {
let out = std::env::var("MULBERRY_DOCS").unwrap_or_else(|_| "docs".into());
let sc = std::env::temp_dir().join(format!("mulberry-docs-{}", std::process::id()));
let music = sc.join("Music");
let albums: [(&str, &str, i32, Vec<&str>, &str, &str); 4] = [
("Velvet Arcade", "Nightglass", 2019, vec!["Neon Rain", "Glass Hearts", "Midnight Signal", "Afterglow", "Static Bloom"], "#7b4fd1", "#e85fb0"),
("Velvet Arcade", "Low Tide Radio", 2021, vec!["Harbour Lights", "Salt and Static", "Tape Hiss Lullaby", "Slow Current"], "#1d8f9c", "#8ee0b4"),
("Marlow Quay", "Paper Lanterns", 2017, vec!["First Light", "Lantern Season", "Wooden Bridges", "Quiet Hours"], "#d17a2f", "#f2c14e"),
("The Hollow Pines", "Understory", 2022, vec!["Root and Branch", "Moss", "Lichen Moon"], "#2f8a4d", "#b7e07a"),
];
for (artist, album, year, tracks, c1, c2) in &albums {
let dir = music.join(artist).join(album);
std::fs::create_dir_all(&dir).unwrap();
assert!(std::process::Command::new("magick").args(["-size", "700x700", &format!("gradient:{c1}-{c2}"), "-gravity", "center", "-fill", "white", "-pointsize", "64", "-annotate", "0", &album.replace(' ', "\n")]).arg(dir.join("cover.jpg")).status().unwrap().success());
for (i, t) in tracks.iter().enumerate() {
let p = dir.join(format!("{:02} {t}.flac", i + 1));
let mut args: Vec<String> = ["-v", "quiet", "-y", "-f", "lavfi", "-i", "sine=frequency=330:duration=200"].iter().map(|s| s.to_string()).collect();
for (k, v) in [("title", t.to_string()), ("artist", artist.to_string()), ("album", album.to_string()), ("date", year.to_string()), ("track", (i + 1).to_string()), ("genre", "Synthwave".to_string()), ("lyrics", LYRICS.to_string())] {
args.push("-metadata".into());
args.push(format!("{k}={v}"));
}
assert!(std::process::Command::new("ffmpeg").args(&args).arg(&p).status().unwrap().success());
}
}
std::fs::create_dir_all(sc.join("config/mulberry")).unwrap();
std::fs::write(
sc.join("config/mulberry/settings.json"),
format!("{{\"library/folders\":[\"{}\"],\"playback/resume\":false,\"online/auto_lyrics\":false,\"online/auto_covers\":false,\"lyrics/source\":\"embedded\",\"appearance/color_source\":\"album\",\"appearance/mode\":\"dark\",\"ui/sidebar_tab\":0,\"lastfm/enabled\":false}}", music.display()),
)
.unwrap();
std::env::set_var("MULBERRY_TEST", "1");
std::env::set_var("XDG_DATA_HOME", sc.join("data"));
std::env::set_var("XDG_CONFIG_HOME", sc.join("config"));
std::env::set_var("XDG_CACHE_HOME", sc.join("cache"));
let mut h = Harness::builder().with_size(vec2(1380.0, 860.0)).wgpu().build_eframe(|cc| App::new(cc, vec![]));
h.ctx.set_missing_glyph_policy(eframe::epaint::text::MissingGlyphPolicy::Tofu);
settle(&mut h, 60); // scan
h.state_mut().add_paths(vec![music.join("Velvet Arcade/Nightglass").to_string_lossy().into_owned()], AddMode::Play);
settle(&mut h, 40);
h.state_mut().seek(41.0);
settle(&mut h, 40);
// library tree: expand the first artist
click(&mut h, pos2(26.0, 168.0), PointerButton::Primary, Modifiers::NONE);
settle(&mut h, 8);
let save = |h: &mut Harness<'_, App>, name: &str| {
for _ in 0..4 {
h.step();
}
h.render().unwrap().save(format!("{out}/{name}.png")).unwrap();
};
save(&mut h, "main");
// two albums mixed in one playlist: select across them and right-click the Album cell of a Nightglass track
h.state_mut().add_paths(vec![music.join("Velvet Arcade").to_string_lossy().into_owned()], AddMode::New);
settle(&mut h, 40);
click(&mut h, pos2(480.0, 489.0 + 60.0), PointerButton::Primary, Modifiers::NONE);
click(&mut h, pos2(480.0, 489.0 + 150.0), PointerButton::Primary, Modifiers::SHIFT);
click(&mut h, pos2(1000.0, 489.0 + 150.0), PointerButton::Secondary, Modifiers::NONE);
h.input_mut().events.push(Event::PointerMoved(pos2(1300.0, 20.0)));
settle(&mut h, 4);
save(&mut h, "set-tag-menu");
h.input_mut().events.push(Event::Key { key: egui::Key::Escape, physical_key: Some(egui::Key::Escape), pressed: true, repeat: false, modifiers: Modifiers::NONE });
settle(&mut h, 3);
h.state_mut().do_action("focus");
settle(&mut h, 6);
save(&mut h, "focus");
h.state_mut().do_action("focus");
h.state_mut().do_action("settings");
settle(&mut h, 6);
save(&mut h, "settings");
}