bin/mp: preserve order of input arguments
This commit is contained in:
parent
6f5338edcf
commit
b8136717b9
|
@ -4,10 +4,10 @@
|
|||
# env: MUSIC
|
||||
PLAYLISTS="$MUSIC/Playlists"
|
||||
LINKS="$MUSIC/links"
|
||||
test "$1" = "-q" && quiet=-q && shift
|
||||
if test "$1" = "-r"
|
||||
then shift
|
||||
test "$1" = "-v" && verbose=-v && shift
|
||||
test "$1" = "-r" && shift || next=true
|
||||
{ for arg;
|
||||
for arg;
|
||||
do path="$(test -e "$arg" && realpath "$arg" ||
|
||||
( test -e "$MUSIC/$arg" && realpath "$MUSIC/$arg") ||
|
||||
( test -e "$PLAYLISTS/$arg" && realpath "$PLAYLISTS/$arg") )"
|
||||
|
@ -22,8 +22,10 @@ do path="$(test -e "$arg" && realpath "$arg" ||
|
|||
(*) mkdir -p "$LINKS" && ln -fs "$file" "$LINKS/$(basename "$file")" && echo "${LINKS#$MUSIC/}/$(basename "$file")";;
|
||||
esac done
|
||||
fi
|
||||
done && mpc -q update --wait; } | xargs --delim='\n' mpc insert
|
||||
|
||||
if test "$next"
|
||||
then test $(mpc status | wc -l) -gt 1 && mpc $quiet next || mpc $quiet play
|
||||
done
|
||||
else
|
||||
test "$1" = "-q" && quiet=-q && shift
|
||||
{ "$0" -r "$@" && mpc -q update --wait; } |
|
||||
xargs --delim='\n' mpc insert
|
||||
test $(mpc status | wc -l) -gt 1 && mpc $quiet next || mpc $quiet play
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue