diff options
| -rwxr-xr-x | mush | 60 | ||||
| -rwxr-xr-x | smush | 4 |
2 files changed, 64 insertions, 0 deletions
@@ -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 "$@" @@ -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 |
