cruxports/mpc/mpdiradd
2022-02-05 15:39:19 -05:00

19 lines
425 B
Bash

#!/usr/bin/env bash
# Description: Add files or directories to the mpd queue
#
# Dependencies: mpd mpc
#
# Shell: bash (for vim pattern matching)
# Author: John McQuah
MPDHOME="/home/mpd/"
target=$1
fullpath="$2/$target"
if [[ -d $target && -x $target ]]; then
argfind="base ${fullpath##$MPDHOME}"
mpc find $argfind | sort | mpc add
else
[[ $fullpath =~ $MPDHOME && -r $fullpath ]] && mpc add "${fullpath##$MPDHOME}"
fi