Real `rclone sync --progress --stats 1s` output piped (non-TTY) contains two traps that made the mirror gauge show no progress: - after the byte-weighted `Transferred: 8 MiB / 80 MiB, 10%, …` line, rclone prints a unit-less file-count summary `Transferred: 0 / 6, 0%` on every tick; the parser accepted it and reset done/total/pct to 0 immediately after each real update - rclone does not newline-terminate the last `Transferring:` entry, so the next stats line arrives glued to a per-file line (` * file: 51% / 8 MiB, … -Transferred: 32 MiB / 80 MiB, 40%, …`), which parsed as garbage with pct 0 (after the first tick the only byte lines arrive this way) parse_rclone_stats now takes the text after the last `Transferred:` marker and requires byte units, so the count summary and glued variants are handled. Per-file lines are parsed into the mirror's "current file" display, and progress-block noise (Checks/Elapsed/Transferring/count summary) is consumed instead of spamming the log every second. Tests: replay of captured multi-tick rclone blocks (keeps 40%, never 0%), glued-line and summary rejection cases, plus a TestBackend render test asserting the mirror gauge, bytes and current file appear on the Sync tab.
dap-tui
A terminal UI for device sync of portable music players, rewritten from scratch in Rust on top of ratatui.
It mirrors the StorageBox masters library into your local music directory, then
syncs a device profile — the same pipeline as the Python dap-sync, now as a
living dashboard instead of a batch CLI.
Highlights
- Tokyo Night palette, rounded panels, gradient title rule, status & key bars.
- Devices sidebar — live mount status (green dot = mounted), firmware tags, last-sync age per device.
- 3 tabs — Dashboard (per-player overview + settings, storage usage when mounted, library + sync pipeline), Sync (live step pipeline + progress gauge), Logs (color-coded, follow mode).
- Live sync engine — streams
rcloneandrsyncoutput, parses progress (byte-weighted via--info=progress2), NFC-aware diffing for macOS→FAT32/Android devices, optionalfatsortfinalize for Mlove devices. - Abort-safe —
akills the running child process group cleanly; quitting while a sync runs aborts it first instead of leaving it orphaned. - Mount-aware — a path that exists but is not a real mount point is flagged and refused as a sync target, so a leftover mount directory can't silently receive a sync on the root filesystem.
- Reads the existing
~/.config/dap-sync/config.toml(compatible withdap-sync), persists last-sync state to~/.local/share/dap-sync/sync-state.toml.
Install / run
cargo build --release
./target/release/dap-tui # uses ~/.config/dap-sync/config.toml
./target/release/dap-tui --config /path/to/config.toml
./target/release/dap-tui --skip-mirror # skip the StorageBox → local mirror step
Keybindings
| Key | Action |
|---|---|
↑/↓ j/k |
move selection |
s / Enter |
sync selected device |
a |
abort running sync |
m |
mount / unmount device (udisks2, no sudo) |
Tab / 1-3 |
switch tab |
r |
reload config + refresh mounts |
f |
toggle log follow |
u / d |
scroll logs |
x |
clear logs |
? / h |
help overlay |
q / Esc |
quit |
Configuration
dap-tui reads the standard dap-sync config format:
[paths]
local_music_dir = "~/Music"
local_hoerspiele_dir = "~/hoerspiele"
[storagebox]
source = "storagebox:masters"
exclude = ["/Music/**", ".DS_Store", ".localized"]
[[devices]]
name = "iPod Rockbox"
firmware = "rockbox"
mount_point = "/media/sebastian/IPOD"
music_folder = "Music"
Firmware types: apple (podkit command), rockbox, android, sony
(rsync to a mounted volume), mlove (rsync + fatsort). Devices with
content_type = "hoerspiele" sync against the hoerspiele library.
How the sync pipeline works
- Mirror —
rclone sync(or localrsync) pulls the StorageBox source into the local library. - Diff — the device is scanned and compared to the source with NFC-normalised paths, size, and 2-second-rounded mtimes (FAT32 friendly).
- Sync — stale files are removed first, then
rsync --files-fromcopies only what changed, with live per-file progress. - Finalize (mlove) — unmounts the volume and runs
fatsortviasudo -nto keep FAT directory order stable. If passwordless sudo is not available the step is reported as a warning and the commands are printed.
Mounting
Devices are mounted/unmounted without sudo via udisks2:
m in the TUI mounts/unmounts the selected device, and a sync automatically
mounts the target first (resolved by mount-point label via lsblk). Only the
mlove fatsort step needs root (raw block device).
Mount status and sync targets are validated against the kernel mount table
(/proc/self/mountinfo), not just directory existence: if the configured
mount_point exists but is not actually mounted, dap-tui refuses to sync to
it rather than writing the library onto the root filesystem.
Development
cargo test # parser + config tests
cargo run