summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordacctal <donotcontactmevia@email.invalid>2026-07-16 03:06:15 +0000
committerdacctal <donotcontactmevia@email.invalid>2026-07-16 03:06:15 +0000
commit37a31aef0cd819dcb50f7b7dd8d9c385aff76864 (patch)
tree408846f267050af900512cb5decea2a66f102f53
barebones mush (in POSIX shell)
-rwxr-xr-xmush60
-rwxr-xr-xsmush4
2 files changed, 64 insertions, 0 deletions
diff --git a/mush b/mush
new file mode 100755
index 0000000..201c430
--- /dev/null
+++ b/mush
@@ -0,0 +1,60 @@
+#!/usr/bin/env sh
+mkdir -p ~/.config/mush
+if [ ! -f ~/.config/mush/config.sh ]; then
+ echo """#!/usr/bin/env sh
+# THIS FILE IS AN EXAMPLE.
+#
+# make sure you have all your music inside
+# the directory you choose.
+
+#MUSH_SONGS_DIR=\"/path/to/music\"""" >>~/.config/mush/config.sh
+fi
+
+if [ ! -f ~/.config/mush/config.sh ]; then
+ echo "your config file doesn't exist!!"
+ echo "go to: ~/.config/mush/"
+ echo "to configure mush"
+ exit 1
+fi
+
+source ~/.config/mush/config.sh
+MSD=$MUSH_SONGS_DIR
+MSD_ESC=$(printf '%s' "$MSD" | sed 's/[\/&\\]/\\&/g')
+
+play() {
+ mpv "$@" \
+ $SHUFFLE \
+ --msg-level=all=no,statusline=status \
+ --term-status-msg='♫ ${media-title}\n' \
+ --no-video \
+ $LOOP \
+ --audio-display=no
+}
+
+parse() {
+ ARGS=""
+ SONGS=""
+ for ARG in "$@"; do
+ case "$ARG" in
+ "-l"|"--loop"*)
+ export LOOP="--loop-playlist=inf"
+ ;;
+
+ "-s"|"--shuffle"*)
+ export SHUFFLE="--shuffle"
+ ;;
+
+ *)
+ export ARGS="$ARGS $ARG"
+ export SONGS="$SONGS $MSD/$(ls $MSD | grep $ARG)"
+ ;;
+ esac
+ done
+ SONGS_ESC=$(printf '%s' "$SONGS" | sed 's/[\/&\\]/\\&/g')
+ SONGS_ESC=$(printf '%s' "$SONGS_ESC" | sed 's/`/\\`/g')
+ SONGS="\"$(printf '%s' "$SONGS_ESC" | sed ":a;N;\$!ba; s/\n/\" \"$MSD_ESC\//g")\""
+ eval "set -- $SONGS"
+ play "$@"
+}
+
+parse "$@"
diff --git a/smush b/smush
new file mode 100755
index 0000000..b374396
--- /dev/null
+++ b/smush
@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+rm ~/songs.txt
+/home/dacc/dv/sh/mush/mush nzuum retrobit --shuffle --loop > ~/songs.txt
+rm ~/songs.txt