added Musmaster
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user