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