bin: little script corrections

This commit is contained in:
xeruf 2022-05-03 11:29:48 +02:00
parent 93628b4a86
commit 7a4eba60cd
4 changed files with 8 additions and 6 deletions

View File

@ -2,6 +2,7 @@ $XDG_CONFIG_HOME/yadm
$XDG_CONFIG_HOME/doom
$XDG_CONFIG_HOME/git
$XDG_CONFIG_HOME/nvim
$XDG_CONFIG_HOME/espanso
$XDG_CONFIG_HOME/zsh/completion
$CONFIG_SHELLS
$HOME/.local/bin/scripts

View File

@ -18,4 +18,4 @@ ${run:-sudo --preserve-env=BORG_REPO BORG_PASSPHRASE="$($BORG_PASSCOMMAND)" borg
$(echo $DIRS_IGNORE_SAFE -x 'software-challenge/**/build' -x state/emacs -x state/go -x .local/lib -x .cpan -x *cache |
sed 's|-x \([^ ]\+\)|-e sh:**/\1|g') \
"$name" $(test $# -eq 0 && echo etc home root || test $# -eq 1 && echo $1) "${@:2}" 2>&1
sudo chown -R $USER:$USER "$BORG_REPO"
test -n "$run" || sudo chown -R $USER:$USER "$BORG_REPO"

View File

@ -9,7 +9,7 @@ then mp -q "$PLAYLISTS/focus.m3u"
else
(find -L $PLAYLISTS -iname "focus-$1.m3u" -print0 | grep --null-data . ||
find -L $PLAYLISTS -iname "$1.m3u*" -print0 | grep --null-data . ||
find -L $MUSIC $(echo "$@" | sed 's/\w\+/-iname *\0*/g') -prune -exec find {} -size +1M -type f -not -iregex ".*.\(jpe?g\|png\)" -print0 \; ) |
find -L $MUSIC $(echo "$@" | sed 's/\w\+/-iname *\0* /g') -prune -exec find {} -size +1M -type f -not -iregex ".*.\(jpe?g\|png\)" -print0 \; ) |
xargs -0 mp -q
fi
if test $(mpc playlist | wc -l) -gt 1; then

View File

@ -1,4 +1,4 @@
#!/bin/sh -e
#!/bin/sh
# [M]edia [P]lay
# Play given files on mpd, playing external files through symlinking and recursively resolving playlists
# depends: xargs realpath mpc
@ -11,7 +11,8 @@ then shift
test "$1" = "-v" && verbose=-v && set -x && shift
# TODO this is sooo slow...
for arg
do filepath="$({ find "$(dirname -- "$arg")" -maxdepth 1 -name "$(basename -- "$arg")*" -exec realpath {} + ||
do
filepath="$({ find "$(dirname -- "$arg")" -maxdepth 1 -name "$(basename -- "$arg")*" -exec realpath {} + ||
find "$MUSIC/$(dirname -- "$arg")" "$MUSIC/Playlists/$(dirname -- "$arg")" -maxdepth 1 \
-name "$(basename -- "$arg")*" -exec realpath {} +; } 2>/dev/null)"
test -n "$verbose" && echo "Scanning path '$filepath' $(