Skip to content

MusicLib 1.60

Choose a tag to compare

@Harpo3 Harpo3 released this 08 Apr 18:16

Tag Schema System
Replaced the tag exclusion list with a declarative two-tier allowlist schema (tag_schema.conf). Schema defines [db_written] frames (sourced from the musiclib DB and written fresh on rebuild) and [file_preserved] frames (read from the file before strip and restored unchanged). Supports kid3 unified names, explicit TXXX descriptions, and raw ID3v2 frame codes. Tag functions in musiclib_utils_tag_functions.sh now use load_tag_schema() and an allowlist-driven is_frame_allowed() in place of the old exclusion-list logic.

Tag Backup & Restore

  • Per-file tag backups are now retained for 30 days after a successful rebuild, enabling recovery from unexpected frame loss or value corruption discovered after the fact.
  • New --keep-backup flag for tagclean and tagrebuild overrides the default (which previously deleted backups on success).
  • New musiclib_tagrestore.sh script: locates the most recent dated backup for a given MP3 and restores it with cp + cmp verification. Supports dry-run (-n), verbose (-v), and list-only (-l) modes.

Exiftool Stays-Open Daemon
Added a long-running exiftool -stay_open coproc daemon (start_exiftool_daemon, stop_exiftool_daemon, query_exiftool_daemon) to musiclib_build.sh. Each file scan now sends one request over named pipes instead of spawning a new exiftool process, eliminating the ~100 ms per-file interpreter startup cost on large library scans.

kid3 Config Auto-Sync
New sync_external_tool_config() function propagates POPM star-mapping, custom TXXX frame names, and UTF-8 text encoding into kid3rc automatically. Uses an mtime hash to skip re-application when the config is already current. Called at rating time and at install time so the kid3 GUI config stays aligned with musiclib.conf without manual reconfiguration.

GUI Tag Maintenance Enhancements

  • TagClean group: added Recursive, Verbose, and Keep-backup checkboxes; arguments are passed through to the script.
  • TagRebuild group: browse button now presents a file-or-directory picker menu; added Keep-backup checkbox and a "Restore Last Backup" button wired to launchTagRestore(); executing against the library root now shows a confirmation dialog with Cancel / Preview / Proceed options.

Copy Location to Clipboard
Added a "Copy location to clipboard" context-menu action to LibraryView. Copies the selected track's file path and echoes it to the status bar.


Improvements

  • POPM star-rating values (POPM_STAR1POPM_STAR5) are now configurable per installation via musiclib.conf (defaults: 1 / 64 / 128 / 196 / 255) without requiring code changes. musiclib_rate.sh consumes these variables with fallback defaults for older installs.
  • KID3_CONFIG_FILE added to musiclib.conf so all scripts share a single kid3 config path.
  • TXXX frames and USLT lyrics are now explicitly preserved across tag rebuilds: file-preserved TXXX frames are pre-read via kid3-cli before strip; lyrics are extracted from exiftool JSON and restored after rebuild.
  • COMM frame handling improved with language-coded fallback variants; kid3 "Grouping" reference corrected to "Work" (maps to TIT1 / Content Group Description).
  • Unicode preserved throughout tag operations; iconv transliteration removed; kid3 configured for UTF-8.
  • Added --restore-lastplayed flag to musiclib_build.sh: reads the LastTimePlayed TXXX value from existing tags via kid3-cli before rebuilding the DB entry and writes it back after, preserving play history on full database rebuilds.
  • Audacious running-state detection in smartplaylistpanel.cpp now reads /proc/<pid>/comm directly instead of spawning pgrep, eliminating stray PID output to the console.
  • musiclib_init_config.sh: added pre-detection of EXISTING_MUSIC_REPO from the Audacious config at install time; added a Python patch block to seed the initial kid3rc with custom frame names, UTF-8 encoding, and POPM star-rating mapping.

Bug Fixes

  • Fixed NEXT_ALBUM_ID counter initialization and cross-file tracking in musiclib_build.sh so album IDs are assigned consistently across a full library scan.
  • Fixed CUSTOM2 field resolution: now uses a three-tier priority — dedicated TXXX frame first, then a COMM frame with a recognized prefix, then falls back to empty — preventing stale or incorrect values from leaking through.

[2026-04-08 additions]

New Features

tagrestore CLI Command
Registered tagrestore in CommandHandler; delegates to musiclib_tagrestore.sh. Argument parsing and validation are handled entirely by the script. Version bumped to 1.60; MUSICLIB_VERSION cmake define injected into CLI and GUI targets so the version string and Backend API version (1.6) are read from the define rather than hardcoded.

Pending Add-Track Handler
New add_track case in musiclib_process_pending.sh: validates inputs, acquires a DB lock, reads metadata via kid3-cli, builds a DSV entry, writes to the DB, updates file tags, and fires a kdialog notification on success.

libmusiclib Stubs
Placeholder .cpp implementations added for utils, db_reader, json_parser, script_executor, and config_loader — scaffolding for the planned migration to a shared libmusiclib.so.

Improvements

Batched kid3-cli Tag Writes
musiclib_utils_tag_functions.sh: replaced per-tag individual kid3-cli calls with a local kid3_set_cmds array flushed in a single invocation — eliminates per-command Qt+taglib startup overhead for every write in Stage 4. musiclib_tagrestore.sh: batched the ID3v1/v2/APE remove into a single kid3-cli call instead of three separate ones.

Strict Mode in Shell Scripts
Added set -e / -u / -o pipefail to musiclib_audacious.sh, musiclib_baloo_sync.sh, musiclib_edit_field.sh, musiclib_rate.sh, and musiclib_remove_record.sh.

GUI Include Guards Converted to #pragma once
configuretoolbarsdialog, settingsdialog, albumwindow, mainwindow, confwriter, mobile_panel, main — all remaining #ifndef include guards replaced with #pragma once.

Library-Root Confirmation Dialog
maintenancepanel: added confirmation dialog (Cancel / Preview / Proceed) before a recursive tag-clean runs on the entire library root.

Desktop Icons Added
Application icons at 48×48, 128×128, and 256×256 px added to desktop/icons/.

Documentation

  • BACKEND_API.md bumped to v1.6: documents pending-ops wire format (§1.6), add_track operation type, progress line protocol (ACCOUNTING/UPLOAD prefixes), .pending_tracks and .failed recovery file schemas. Removed superseded JSON queue design. Corrected script/executable paths throughout.
  • DEVELOPMENT.md: corrected all paths from /usr/lib/musiclib/bin/ to bin/; updated executable paths to build/bin/.
  • MUSICLIB_USER_MANUAL.md: updated tagrestore usage examples, keyboard shortcut section, and workflow notes.
  • README.md: corrected KID3_CONFIG_FILE and POPM_STAR* config variable names; corrected path references.