38 lines
1 KiB
Bash
38 lines
1 KiB
Bash
#!/bin/sh
|
|
|
|
player="$AUDIOPLAYER"
|
|
|
|
if [ -f "$1" ] && [ -n "$(echo "$1" | sed -r "s|\\.[^\\.]+$||")" ]; then
|
|
media="$1"
|
|
else
|
|
formats="$AUDIO_FORMATS"
|
|
formats="$(echo "$formats" | tr ',' '|')"
|
|
|
|
regex=".*\\.($formats)"
|
|
|
|
multimedia="$(find "$HOME" -regextype posix-extended -regex "$regex" \
|
|
-not -regex "$TRASH.*" | sed "s|^$HOME/||")"
|
|
multimedia=""${multimedia}"$(find "$DEVICES_FOLDER" \
|
|
-not -regex "$TRASH.*" -regextype posix-extended -regex "$regex")"
|
|
|
|
media="$(echo "${multimedia}" | dmenu -i -l 9)"
|
|
|
|
[ "$(echo "$media" | grep -E "$DEVICES_FOLDER/.*" | wc -l)" -eq 0 ] &&
|
|
media="$HOME/$media"
|
|
fi
|
|
|
|
if [ "$media" != "$HOME/" ]; then
|
|
mksh $HOME/bin/cmusd.sh > /dev/null 2>&1
|
|
sleep 1
|
|
|
|
mksh -c "$player -C 'view tree'"
|
|
mksh -c "$player -C clear"
|
|
mksh -c "$player -C \"view queue\""
|
|
mksh -c "$player -C clear"
|
|
# sleep 1
|
|
mksh -c "$player -C \"add $media\""
|
|
sleep 1
|
|
mksh -c "$player -C player-next"
|
|
mksh -c "$player -C player-play"
|
|
# mksh -c "$player -C win-remove"
|
|
fi
|