added Musmaster port
This commit is contained in:
@@ -7,6 +7,7 @@ For POSIX shell compatible scripts, see the [sh-goodies](https://codeberg.org/lu
|
|||||||
## List
|
## List
|
||||||
|
|
||||||
* [bmux](./bmux): a simple, dmux-like session manager in Bash on top of just dtach
|
* [bmux](./bmux): a simple, dmux-like session manager in Bash on top of just dtach
|
||||||
|
* [Musmaster](./mus): find and play music quickly in any directory (bash port of [mus.sh](https://codeberg.org/luxferre/sh-goodies/src/branch/master/mus.sh))
|
||||||
* [YouStore](./ys): a way to securely store any set of files/directories inside a video
|
* [YouStore](./ys): a way to securely store any set of files/directories inside a video
|
||||||
* [1DLife](./1dlife): Jon Millen's 1D Game of Life in pure Bash
|
* [1DLife](./1dlife): Jon Millen's 1D Game of Life in pure Bash
|
||||||
* [Elem](./elem): Stephen Wolfram's elementary cellular automatons in pure Bash
|
* [Elem](./elem): Stephen Wolfram's elementary cellular automatons in pure Bash
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Musmaster: find and play music in any directory (bash edition)
|
||||||
|
# Depends on find and fzf
|
||||||
|
# Created by Luxferre in 2026, released into the public domain
|
||||||
|
|
||||||
|
[[ -z "$PLAYER" ]] && PLAYER='mpg123'
|
||||||
|
[[ -z "$FTYPES" ]] && FTYPES='mp3 MP3'
|
||||||
|
if [[ -z "$TAGDUMP" ]]; then
|
||||||
|
TAGDUMP='mpg123-id3dump -n {} | grep -E "^(Title|Artist|Album|Year|Comment|Genre):" | sort -u'
|
||||||
|
fi
|
||||||
|
PREVIEWCMD="[ -d {} ] && ls -1 {} || ([ {} != 'Quit' ] && $TAGDUMP)"
|
||||||
|
mdir="$1"
|
||||||
|
[[ -z "$mdir" ]] && mdir='.'
|
||||||
|
declare -a fargs=() muslist dirlist tracks
|
||||||
|
for ext in $FTYPES; do
|
||||||
|
fargs+=('-name' "*.$ext" '-o')
|
||||||
|
done
|
||||||
|
unset 'fargs[-1]'
|
||||||
|
cd "$mdir"
|
||||||
|
while true; do
|
||||||
|
mapfile -t muslist < <(find . -type f \( "${fargs[@]}" \))
|
||||||
|
mapfile -t dirlist < <(dirname "${muslist[@]}" | sort -u)
|
||||||
|
IFS=$'\n' muslist=($(sort -u <<<"${muslist[*]} ${dirlist[*]}") Quit); unset IFS
|
||||||
|
src="$(printf '%s\n' "${muslist[@]}" | grep '\S' | fzf --tac --preview="$PREVIEWCMD" -0 -1)"
|
||||||
|
[[ "$src" = 'Quit' ]] && break
|
||||||
|
if [[ -n "$src" ]]; then
|
||||||
|
if [[ -d "$src" ]]; then
|
||||||
|
mapfile -t tracks < <(find "$src" -type f \( "${fargs[@]}" \) | sort -u)
|
||||||
|
$PLAYER "${tracks[@]}"
|
||||||
|
else
|
||||||
|
$PLAYER "$src"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user