You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/BACKEND_API.md
+53-1Lines changed: 53 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# MusicLib Backend API Contract v1.2
1
+
# MusicLib Backend API Contract v1.3
2
2
3
3
## Document Purpose
4
4
@@ -193,6 +193,15 @@ release_db_lock
193
193
- Symbolic links are **resolved to real paths** before DB insertion (`readlink -f`)
194
194
- Paths are **URL-decoded** if sourced from `.audpl` files (`uri=file://...`)
195
195
196
+
**K3b-specific paths** (written by the GUI, not by shell scripts):
197
+
198
+
| File | Purpose |
199
+
|---|---|
200
+
|`~/.config/musiclib/k3brc`| MusicLib's managed K3b configuration. Written by `generate_k3brc` at setup; patched on every panel control change. |
201
+
|`~/.config/k3brc`| K3b's live config. Deployed from `~/.config/musiclib/k3brc` by `deployK3brc()` before each K3b launch. Never written by setup directly. |
202
+
|`~/.config/musiclib/k3b.pid`| PID of the K3b process last launched by MusicLib. Written at launch, cleared on exit detection or PID mismatch at startup. |
203
+
|`~/.config/musiclib/backups/k3brc_bak_MMDDYYYY_N`| Dated backups of `~/.config/musiclib/k3brc` created on setup re-run. |
204
+
196
205
---
197
206
198
207
### 1.5 Configuration Reading
@@ -230,9 +239,23 @@ KDECONNECT_CMD # Path/command for kdeconnect-cli
K3B_READ_RETRIES # Sector read retry count before giving up (default: 5)
234
255
```
235
256
257
+
These keys are written to `~/.config/musiclib/musiclib.conf` (user overrides layer) by the CD Ripping panel when controls change. System defaults live in `/usr/lib/musiclib/config/musiclib.conf`. Shell scripts do not read or write these keys directly — they are read by `patch_k3brc()` in `musiclib_init_config.sh` and by the C++ `CDRippingPanel` class.
258
+
236
259
**Note**: GUI-only preferences (poll interval, system tray close/minimize behavior, start minimized) are stored in KConfig (`~/.config/musiclibrc`) rather than `musiclib.conf`, since they have no meaning to shell scripts.
237
260
238
261
These optional dependency flags are detected during `musiclib-cli setup` and used by the GUI to gracefully disable features when tools are unavailable. See Section 2.10 for setup wizard behavior.
**Caveat**: Watcher fires on lock file changes too. Use debounce timer (500ms) to avoid redundant reloads.
1258
1291
1292
+
### 3.4 CDRippingPanel Public Interface
1293
+
1294
+
`CDRippingPanel` exposes three members used by `MainWindow` for the Rip CD toolbar action:
1295
+
1296
+
| Member | Type | Purpose |
1297
+
|---|---|---|
1298
+
| `runDriftDetection()` | `bool` (public slot) | Compares managed keys between `~/.config/k3brc` and `~/.config/musiclib/k3brc`. Returns `true` if drift was detected (banner shown). Called by MainWindow before deciding whether to launch K3b. |
1299
+
| `patchAndDeployK3brc()` | `void` (public method) | Patches `~/.config/musiclib/k3brc` with current ConfWriter values, then copies it to `~/.config/k3brc`. Called by MainWindow immediately before launching K3b (Scenario A: no drift). |
1300
+
| `k3bExited()` | `Q_SIGNAL` | Emitted when the poll timer detects the K3b running→not-running transition. MainWindow connects to this to call `clearK3bPid()` and clean up `~/.config/musiclib/k3b.pid`. |
1301
+
1302
+
**Toolbar action launch scenarios:**
1303
+
1304
+
| Scenario | Condition | Behaviour |
1305
+
|---|---|---|
1306
+
| A — Fresh launch | K3b not running | Run drift check. If drift: show banner, return (user resolves via panel). If no drift: `patchAndDeployK3brc()`, launch K3b, write PID file. |
1307
+
| B — Already running (ours) | PID file exists and matches running process | Raise K3b window via `raiseWindowByClass("k3b")`. No deploy. |
1308
+
| C — Already running (external) | No PID file or PID mismatch | Raise K3b window. No deploy. Panel shows dimmed state via its own poll timer. |
1309
+
| D — Startup with K3b open | Detected at MainWindow init | PID match: treat as Scenario B. PID mismatch: clear stale PID file, no dialog. |
@@ -48,6 +49,7 @@ It sits between you and the Audacious audio player, and handles all the behind-t
48
49
-**Rates and Organizes**: Star-rate songs and see your ratings everywhere
49
50
-**Tracks Playback**: Records last-played history across devices—desktop (Audacious) and remote (mobile phone)
50
51
-**Syncs to Mobile**: Pushes playlists/files to Android or iOS devices via KDE Connect, and captures the last-played data from the old playlist when the new one is replaced. Logs actual played timestamps for tracks played from the desktop, and logs synthesized dates for playlists played on mobile
52
+
-**Rips CDs**: Manages K3b's rip configuration (format, bitrate, error correction) and deploys it before each session, so K3b is always ready with the settings you want
51
53
-**Integrates with KDE**: Works seamlessly with Plasma, Dolphin file manager, and system shortcuts
52
54
-**Manages Metadata**: Repairs and normalizes song tags automatically
53
55
@@ -541,6 +543,8 @@ Select from the Side Panel on the left to access the other panels:
541
543
542
544
**Maintenance Panel** — Perform database and tag maintenance operations like rebuilding the database, cleaning tags, or importing new music.
543
545
546
+
**CD Ripping Panel** — Configure K3b CD ripping settings (output format, bitrate/quality, error correction) and manage the ripping profile. Only available when K3b is installed and detected by setup. See the [CD Ripping](#cd-ripping) section for details.
547
+
544
548
**Settings** — (Opens new Window) Configure MusicLib paths, device IDs, and behavior options.
545
549
546
550
### Toolbar Elements (Top)
@@ -558,6 +562,8 @@ Select from the Side Panel on the left to access the other panels:
558
562
559
563
**Kid3** — Launches/activates Kid3 for currently playing track
560
564
565
+
**Rip CD** — Launches K3b to rip a CD using MusicLib's managed rip profile. If K3b is already open, raises its window instead. Disabled when K3b is not installed (tooltip explains how to enable it). See the [CD Ripping](#cd-ripping) section for full behavior.
566
+
561
567
**Dolphin** — Launches/activates Dolphin music folder for currently playing track
562
568
563
569
### Rating Songs
@@ -727,6 +733,65 @@ The core functionality (uploading playlists, last-played accounting) works the s
727
733
728
734
---
729
735
736
+
## CD Ripping
737
+
738
+
MusicLib integrates with **K3b** to manage your CD ripping workflow. When K3b is installed and detected during setup, MusicLib takes ownership of K3b's rip configuration — setting the output format, encoder settings, rip directory, and error correction mode — and deploys that profile to K3b before each session. You control everything from within MusicLib, so K3b is ready to rip the moment it opens.
739
+
740
+
**Supported output formats:** MP3, Ogg Vorbis, and FLAC.
741
+
742
+
### Setup
743
+
744
+
K3b must be installed before running `musiclib-cli setup` (or re-run setup with `--force` after installing it).
745
+
746
+
During setup, the wizard:
747
+
748
+
1. Detects the `k3b` command and sets `K3B_INSTALLED=true` in your config.
749
+
2. Scans your music library to determine the predominant format (MP3/Ogg/FLAC) and seeds `K3B_ENCODER_FORMAT` accordingly.
750
+
3. Generates `~/.config/musiclib/k3brc` — MusicLib's managed copy of K3b's configuration. If you already have K3b settings at `~/.config/k3brc`, the wizard asks whether to use them as the starting point or replace them with the system defaults.
751
+
752
+
If K3b is not installed, the CD Ripping panel is grayed out and the Rip CD toolbar button is disabled. A tooltip on both explains what to install and how to re-run setup.
753
+
754
+
### Ripping a CD
755
+
756
+
1. Insert a CD.
757
+
2. Click **Rip CD** in the toolbar (or select it via Configure Toolbars if not visible).
758
+
3. MusicLib patches K3b's configuration with your current rip profile and launches K3b.
759
+
4. Rip and eject the disc in K3b as normal. Output lands in your configured download directory.
760
+
5. Import the ripped files into MusicLib using **Add New Tracks** in the Maintenance Panel.
761
+
762
+
If K3b is already open (launched by MusicLib or opened separately), clicking Rip CD simply raises its window — no settings are re-deployed while K3b is running.
763
+
764
+
### CD Ripping Panel
765
+
766
+
Open the CD Ripping Panel from the Side Panel tab to configure the rip profile. All changes write to your `musiclib.conf` and are immediately applied to `~/.config/musiclib/k3brc`.
767
+
768
+
**Output format** — Choose MP3, Ogg Vorbis, or FLAC. The secondary controls change depending on your selection:
769
+
770
+
-**MP3** — Choose CBR (constant bitrate: 128/192/256/320 kbps), VBR (variable quality 0–9, where 0 is best), or ABR (average bitrate in kbps).
771
+
-**Ogg Vorbis** — Quality slider 0–10 (10 is best).
772
+
-**FLAC** — No sub-controls; FLAC is always lossless.
773
+
774
+
**Error correction** — Controls `cdparanoia` behavior: Off, Overlap, Never Skip, or Full Paranoia. Higher levels are slower but handle scratched discs better.
775
+
776
+
**Sector retry count** — How many times K3b retries a failed sector read before giving up.
777
+
778
+
**Rip output directory** — Shown as a read-only label sourced from your configured download directory. Change it via Settings.
779
+
780
+
**Reset to defaults** — Removes all CD ripping overrides from your user config so the system defaults take effect immediately.
781
+
782
+
The panel is dimmed while K3b is running. It re-enables automatically when K3b closes.
783
+
784
+
### Drift Detection
785
+
786
+
If you adjust rip settings directly inside K3b (rather than via the MusicLib panel), those changes live in `~/.config/k3brc` but not in MusicLib's managed copy. When MusicLib detects this mismatch — on panel open or when K3b closes — a banner appears with two options:
787
+
788
+
-**Keep K3b changes** — Imports K3b's settings back into MusicLib so the panel reflects what K3b was using.
789
+
-**Restore MusicLib profile** — Overwrites K3b's settings with MusicLib's current profile, discarding the in-K3b changes.
790
+
791
+
Resolving drift before launching a new rip session ensures K3b always starts with the settings you intend.
792
+
793
+
---
794
+
730
795
## Desktop Integration
731
796
732
797
### System Tray
@@ -1636,6 +1701,24 @@ A: The database stores absolute paths. If you move files, run `musiclib-cli buil
2. If not installed, install it (see Installation section) then re-run `musiclib-cli setup`
1708
+
3. Confirm `K3B_INSTALLED=true` is in your config: `grep K3B_INSTALLED ~/.config/musiclib/musiclib.conf`
1709
+
1710
+
**CD Ripping panel shows "K3b is not installed"**
1711
+
1712
+
Re-run setup after installing K3b: `musiclib-cli setup --force` (your existing config settings are preserved where possible).
1713
+
1714
+
**K3b opens with wrong rip settings**
1715
+
1716
+
MusicLib deploys its managed profile to `~/.config/k3brc` before each launch. If K3b shows unexpected settings on first open, close K3b, then check the CD Ripping panel for a drift banner. Use "Restore MusicLib profile" to push MusicLib's settings back to K3b, then try again.
1717
+
1718
+
**CD Ripping panel shows drift banner**
1719
+
1720
+
Settings were changed in K3b directly. Use **Keep K3b changes** to import them into MusicLib, or **Restore MusicLib profile** to discard the K3b changes and re-apply MusicLib's profile.
1721
+
1639
1722
### KDE Connect Issues
1640
1723
1641
1724
**Devices won't pair**
@@ -1779,7 +1862,7 @@ If you find a bug:
1779
1862
## Version History
1780
1863
1781
1864
-**v0.1 Alpha** (Feb 2026) — Initial release with GUI core, ratings, and mobile sync
1782
-
-Future versions will add KRunner, Plasma widgets, and advanced features
1865
+
-**v1.3** (Mar 2026) — K3b CD ripping integration: CD Ripping Panel, Rip CD toolbar action, drift detection, setup wizard K3b detection and k3brc generation
Copy file name to clipboardExpand all lines: docs/SCRIPTS_SUMMARY.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,7 @@ The dispatcher also standardizes error handling by mapping common failure modes
98
98
99
99
Read-only status and diagnostics script that summarizes the health and key metrics of the MusicLib ecosystem in a single, human-readable report. It is primarily invoked via `musiclib-cli status` to give you a “cockpit view” of the library without touching any state, making it safe to run anytime, including from cron, systemd timers, or monitoring tools.
100
100
101
-
The script loads configuration, verifies that critical paths (music repository, database file, mobile metadata directory, Conky output directory) exist, and then reports high-level stats such as total track count, unique albums, percentage of rated tracks, and the age of the last successful database rebuild, drawing from `musiclib.dsv` and log metadata. It also performs lightweight dependency checks (`exiftool`, `kid3-cli`, `kdeconnect-cli`, `rsgain`, `audtool`) and summarizes whether each is installed and reachable, flagging any missing tools as warnings.
101
+
The script loads configuration, verifies that critical paths (music repository, database file, mobile metadata directory, Conky output directory) exist, and then reports high-level stats such as total track count, unique albums, percentage of rated tracks, and the age of the last successful database rebuild, drawing from `musiclib.dsv` and log metadata. It also performs lightweight dependency checks (`exiftool`, `kid3-cli`, `kdeconnect-cli`, `rsgain`, `audtool`, `k3b`) and summarizes whether each is installed and reachable, flagging any missing tools as warnings.
102
102
103
103
For operational insight, `musiclib_status.sh` inspects the pending-operations queue, recent error entries from the shared log, and the size/rotation status of major log files, surfacing potential problems like a stuck rating queue, rapidly growing logs, or repeated tag-rebuild failures. When run with a `--json` flag (planned for Phase 0), it emits a structured JSON document mirroring the human-readable report, suitable for consumption by a future GUI, system dashboards, or external monitoring agents.
0 commit comments