From 57ad5f2e1b0168c34574cafc07bfa606fb2f55e0 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 31 Jan 2022 10:36:25 +0100 Subject: [PATCH] bin: various corrections --- .local/bin/scripts/b | 2 +- .local/bin/scripts/latest | 2 +- .local/bin/scripts/moul | 4 +++- .local/bin/scripts/mp | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.local/bin/scripts/b b/.local/bin/scripts/b index 37371e6..346f8cf 100755 --- a/.local/bin/scripts/b +++ b/.local/bin/scripts/b @@ -32,7 +32,7 @@ fileinfo() { $elevate file -E "$arg" #probe="$($elevate ffprobe "$arg" 2>&1)" #echo $probe | grep -v -e '00:00:00.04' -e 'ansi' && - $elevate ffprobe "$arg" 2>&1 | grep "bitrate: ....\? " | sed 's/, start:[^,]\+,/,/' || + $elevate ffprobe -hide_banner "$arg" 2>&1 | grep "bitrate: ....\? " | sed 's/, start:[^,]\+,/,/' || stat --format "%A %s $( size="$($elevate unzip -l "$arg" 2>/dev/null | tail -1)" && echo "(uncompressed $(echo $size | cut -d' ' -f1 | numfmt --to=iec-i --suffix=B))" diff --git a/.local/bin/scripts/latest b/.local/bin/scripts/latest index 7c4983e..713c485 100755 --- a/.local/bin/scripts/latest +++ b/.local/bin/scripts/latest @@ -1,7 +1,7 @@ #!/bin/sh -e # Displays the latest files in the given directory or pwd test "$1" = "-a" && all=true && shift -for f in "${@:-PWD}" +for f in "${@:-$PWD}" do test $# -gt 1 && highlight "$f" find "$f" -maxdepth 4 -type f -printf '%.16T+ %P\n' | sort -r | $(test "$all" && echo "less" || echo "head") diff --git a/.local/bin/scripts/moul b/.local/bin/scripts/moul index ac0cd69..8dcbbd8 100755 --- a/.local/bin/scripts/moul +++ b/.local/bin/scripts/moul @@ -13,7 +13,9 @@ then fi if grep -e "^LABEL=$arg[^\w/]" /etc/fstab -then mount -L "$@"; exit $? +then # have to mount twice as the first one might be creating the directory + mount -L "$@" 2>/dev/null || mount -L "$@" + exit $? fi if grep -e "[^\w=/]$arg[^\w/]" /etc/fstab then mount "$@"; exit $? diff --git a/.local/bin/scripts/mp b/.local/bin/scripts/mp index 5c78470..0284b3a 100755 --- a/.local/bin/scripts/mp +++ b/.local/bin/scripts/mp @@ -35,7 +35,7 @@ then shift done else test "$1" = "-q" && quiet=-q && shift - test -n "$(mpc playlist)" && next=-q + test -n "$(mpc playlist)" -a "$(mpc status | wc -l)" -gt 1 && next=-q test "$1" = "--seek" && seek=-q ( "$0" -r "$@" && mpc -q update --wait ) | #tee /tmp/mp 2>&1 xargs --delim='\n' mpc insert