Various music-related tweaks/tips/scripts. Includes fuzzy selection of artist/genre/album script and albumart in the console script
Various MP3 and MPD tweaks, tips, tools, and scripts I have put together or found and then tweaked.
This README documents every Bash script in the repository root. Legacy scripts that were moved into old_versions/ are not covered here except where they matter for migration notes.
f_fix_covers.sh: Reconcile, search, select, and embed album art for MP3 directories.rerun_non_square_covers.sh: Re-run f_fix_covers.sh only on directories whose cover.jpg is not square.f_fix_lyrics.sh: Build missing .lrc and .txt lyric sidecars, with resumable queue support.bpmtoolshelper.sh: Write BPM tags while preserving original file timestamps.mp3gainhelper.sh: Run loudgain per directory while preserving timestamps and propagating failures.edit_current_mp3tags.sh: Print the currently playing local track path so another editor workflow can operate on it.yad_show_mpd.sh: Show a popup with current cover art and track name.terminal_covers.sh: Render current cover art directly in a terminal, with optional desktop notification.terminal_lyrics.sh: Render current lyrics in a terminal, preferring .lrc, then .txt, then a default file.show_covers_w3mimage.sh: Display current album art through w3mimg.sh.terminal_multiplexer.sh: Build a tmux music layout around ncmpcpp, cava, and terminal_covers.sh.mediakey.sh: Send play/pause/next/previous/stop actions through MPRIS with optional player targeting.mediakey_no_checking.sh: Faster mediakey variant with lighter player checks but the same action model.nowplaying_to_maubot.sh: Build a composite “now playing” image, set the desktop background, and post the current track to Maubot.stream_to_mpd.sh: Resolve a stream URL or playlist and send it to MPD, a playlist file, or local playback.update_playlists_for_mpd.sh: Convert Clementine .m3u playlists into MPD-friendly relative-path playlists.webserver_covers.sh: Mirror cover images into a webserver tree without exposing the entire music library.mpdcontrol was rewritten and now lives at https://github.com/uriel1998/mpdcontrol.old_versions/.Most scripts assume:
${HOME}/MusicMPD_HOST is already set, or exists in ${HOME}/.bashrccover.jpg or folder.jpgSeveral scripts also keep scratch files in ${XDG_CACHE_HOME:-$HOME/.config}/yadshow.
f_fix_covers.shRepairs album art for MP3 directories by comparing cover.jpg, folder.jpg, and embedded artwork, optionally prompting for a choice, searching online, and embedding the selected result back into the files.
Important behavior:
--safe prints intended actions without changing files.--checkall forces manual verification.--everything forces online search for every album.--remove clears embedded art before writing the selected cover.--autoembed embeds the selected cover into MP3 files.--loud or --verbose sends verbose diagnostics to stderr.Usage:
./f_fix_covers.sh -d /path/to/music [options]
Dependencies:
eyeD3glyrsacadyadfehimagemagickffprobecurl, wget, grep, sed, timeoutrerun_non_square_covers.shScans a root tree for cover.jpg files whose width and height differ, then reruns f_fix_covers.sh on those directories only.
Usage:
./rerun_non_square_covers.sh [--dry-run] ROOT_DIR
Dependencies:
identify from ImageMagickf_fix_covers.shf_fix_lyrics.shRecursively scans MP3 files and creates missing synchronized (.lrc) and plain-text (.txt) lyric sidecars.
Important behavior:
f_fix_lyrics.queue, in the repo root for resumable processing..lrc and .txt as separate artifacts: if only one exists, the other is still generated..txt from .lrc when only synchronized lyrics exist.--force disables the startup sidecar-pruning pass and rechecks all tracks in scope.Usage:
./f_fix_lyrics.sh [--loud] [--force] [--delay SECONDS] [--base DIRECTORY]
Dependencies:
exiftoolcurljqfind, grep, sed, awkbpmtoolshelper.shComputes BPM values with bpm-tag, writes them with eyeD3, and restores the original file timestamp afterward.
Behavior:
--skip skips files that already have a valid BPM tag.--save compares against an existing BPM and warns when it differs.--quiet reduces console output.Usage:
./bpmtoolshelper.sh [--save] [--skip] [--quiet]
Dependencies:
bpm-tageyeD3stat, touch, findmp3gainhelper.shRuns loudgain per directory while preserving file timestamps after modification.
Behavior:
MAX_JOBS controlling concurrency.--noclobber skips directories where every MP3 already has both ReplayGain track and album tags.loudgain job fails.Usage:
./mp3gainhelper.sh [--noclobber] [DIRECTORY ...]
Dependencies:
loudgainexiftoolfind, realpath, mktemp, touchedit_current_mp3tags.shLocates the currently playing local file across supported players and prints the resolved on-disk file path.
This is mainly a helper for tag-editing workflows that already know what to do with the returned path.
Usage:
./edit_current_mp3tags.sh
Dependencies:
audtool, qdbus, or MPD plus mpcyad_show_mpd.shShows the current cover art and track name in a YAD popup window.
Behavior:
defaultcover.jpg in the repo root when no cover is found.Usage:
./yad_show_mpd.sh
Dependencies:
yadmpcqdbus or audtoolimagemagickterminal_covers.shShows current cover art in a terminal, using one of several terminal-friendly image renderers.
Behavior:
--notify.timg, jp2a, img2txt.py, or asciiart in that order.Usage:
./terminal_covers.sh [--notify]
Dependencies:
mpcqdbus or audtooltimg, jp2a, img2txt.py, asciiartconvert and notify-sendterminal_lyrics.shShows lyrics for the current track in the terminal.
Behavior:
.lrc, then .txt, then default_lyrics.md..txt sidecar from .lrc if needed.rich renderer instead of leaking background processes.Usage:
./terminal_lyrics.sh
Dependencies:
richmpcqdbus or audtoolshow_covers_w3mimage.shWatches MPD for player events and passes the resolved cover image to w3mimg.sh.
Behavior:
cover.jpg, then folder.jpg, then falls back to defaultcover.jpg.${HOME}/Music as the library base.Usage:
./show_covers_w3mimage.sh
Dependencies:
mpcw3mimg.shterminal_multiplexer.shCreates or reattaches to a tmux session named MPD with panes for:
ncmpcppcavaterminal_covers.shUsage:
./terminal_multiplexer.sh
Dependencies:
tmuxwmctrlncmpcppcavaterminal_covers.shmediakey.shUses MPRIS to send playback controls to active players, with optional player selection.
Supported actions:
p: play/pause togglen: nextb: previouss: stopz: pauseSupported player selectors:
p: Pithosa: Audaciousm: MPDc: ClementineUsage:
./mediakey.sh [p|n|b|s|z] [PLAYER]
Dependencies:
qdbusmpc for MPD state checksmediakey_no_checking.shSimpler mediakey variant that assumes the selected player or active MPRIS players are available and skips some of the extra presence checks from mediakey.sh.
Usage:
./mediakey_no_checking.sh [p|n|b|s|z] [PLAYER]
Dependencies:
qdbusmpc for MPD state checksnowplaying_to_maubot.shBuilds a “now playing” composite image, sets it as the desktop background with feh, and posts the current track title to a Maubot webhook.
Behavior:
maubot_vars.env.default_artist.jpg and default_album.jpg.MAUBOT_HTTP_AUTH or MAUBOT_WEBHOOK_USER and MAUBOT_WEBHOOK_PASS.Required configuration in maubot_vars.env:
COVERSERVERMATRIXSERVERMPD_HOSTMAUBOT_WEBHOOK_INSTANCEUsage:
./nowplaying_to_maubot.sh
Dependencies:
mpccurljqwgetfehimagemagickstream_to_mpd.shTakes a stream URL or bookmark, resolves the underlying playable URL, and sends it to one of three destinations.
Destinations:
streamlinkUsage:
./stream_to_mpd.sh [--host PASSWORD@HOST] [--mpd|--playlist|--native] [--bookmarks] STREAM
Dependencies:
streamlinkcurlwgetgrepawkzenitympc when using MPD outputupdate_playlists_for_mpd.shConverts .m3u playlists from a Clementine playlist directory into MPD-style relative-path playlists.
Behavior:
PLAYLISTS and FORMPD from the environment when set.Radio in the filename.Usage:
./update_playlists_for_mpd.sh
Dependencies:
sedwebserver_covers.shMirrors only cover image files into a webserver tree while preserving directory structure.
Behavior:
*.jpg and *.png${HOME}/Music/ as the source and ${HOME}/www/covers/ as the target by defaultUsage:
./webserver_covers.sh
Dependencies:
rsync
The code in this repository has been to some degree written or altered by an AI tool with human supervision. This may include one or more of the following: documentation, locating bugs, or commit messages; in this repository it’s been bugsquashing and reorganizing and updating the documentation.
Steven Saus injects people with radioactivity for his day job, but only to serve the forces of good.
Mostly.