added Musmaster

This commit is contained in:
Luxferre
2026-04-25 19:48:49 +03:00
parent 63bfbb66a3
commit eb1c64731c
2 changed files with 37 additions and 0 deletions
+1
View File
@@ -18,3 +18,4 @@
* [BlueShift](./blueshift.sh): a high-density steganographic tool for hiding any data file inside a PNG image
* [abmux](./abmux.sh): a simple terminal session switcher on top of abduco, fzf and expect
* [dmux](./dmux.sh): a simple terminal session switcher on top of dtach and fzf
* [Musmaster](./mus.sh): a simple fzf-based music catalog wrapper
Executable
+36
View File
@@ -0,0 +1,36 @@
#!/bin/sh
# Musmaster: find and play music in any directory
# Depends on find and fzf
# Created by Luxferre in 2026, released into the public domain
[ -z "$PLAYER" ] && PLAYER='mpg123'
[ -z "$FTYPES" ] && FTYPES='mp3 MP3'
mdir="$1"
[ -z "$mdir" ] && mdir='.'
set --
for ext in $FTYPES; do
if [ $# -eq 0 ]; then
set -- -name "*.$ext"
else
set -- "$@" -o -name "*.$ext"
fi
done
cd "$mdir"
echo "Indexing music..."
muslist="$(find . -type f \( "$@" \))"
dirlist="$(find . -type f \( "$@" \) -print0 | xargs -0 dirname | sort -u)"
muslist="$(printf '%s\n%s' "$muslist" "$dirlist" | sort -u)"
echo "Indexing complete"
while true; do
src="$(printf '%s\nQuit' "$muslist" | fzf --tac -0 -1)"
[ -d "$src" ] && src="$(find "$src" -type f \( "$@" \) | sort -u)"
[ "$src" = 'Quit' ] && break
if [ -n "$src" ]; then
printf '%s' "$src" | while read -r track; do
$PLAYER "$track"
done
fi
done