|
|
|
@ -1,13 +1,6 @@
|
|
|
|
|
#ft=sh
|
|
|
|
|
# vim: filetype=sh
|
|
|
|
|
#shellcheck shell=sh
|
|
|
|
|
|
|
|
|
|
if type nvim >/dev/null 2>/dev/null; then
|
|
|
|
|
export EDITOR=nvim
|
|
|
|
|
alias vim=nvim
|
|
|
|
|
else
|
|
|
|
|
export EDITOR=vim
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
source_env_file() {
|
|
|
|
|
if [ ! -f "${1}" ]; then
|
|
|
|
|
return
|
|
|
|
@ -36,15 +29,13 @@ get_bitrate() (
|
|
|
|
|
echo "[ERROR] unknown file: $1"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
if ! command -v exiftool >/dev/null; then
|
|
|
|
|
echo "[ERROR] exiftool not installed"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
command_installed exiftool
|
|
|
|
|
exiftool -AudioBitrate "$1" | awk '{print $4}'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
json_to_yaml() (
|
|
|
|
|
ARG=${1-}
|
|
|
|
|
command_installed bat dasel
|
|
|
|
|
if [ -z "${ARG}" ]; then
|
|
|
|
|
dasel --read json --write yaml | bat --language yaml
|
|
|
|
|
elif [ -f "${ARG}" ]; then
|
|
|
|
@ -56,6 +47,7 @@ json_to_yaml() (
|
|
|
|
|
|
|
|
|
|
yaml_to_json() (
|
|
|
|
|
ARG=${1-}
|
|
|
|
|
command_installed bat dasel
|
|
|
|
|
if [ -z "${ARG}" ]; then
|
|
|
|
|
dasel --read yaml --write json | bat --language json
|
|
|
|
|
elif [ -f "${ARG}" ]; then
|
|
|
|
@ -68,6 +60,7 @@ yaml_to_json() (
|
|
|
|
|
github_releases() (
|
|
|
|
|
USER=${1}
|
|
|
|
|
REPO=${2-}
|
|
|
|
|
command_installed curl
|
|
|
|
|
if [ -z "${REPO}" ]; then
|
|
|
|
|
USER=$(echo "${1}" | sed 's|/| |g' | awk '{print $1}')
|
|
|
|
|
REPO=$(echo "${1}" | sed 's|/| |g' | awk '{print $2}')
|
|
|
|
@ -79,6 +72,7 @@ github_releases() (
|
|
|
|
|
github_tags() (
|
|
|
|
|
USER=${1}
|
|
|
|
|
REPO=${2-}
|
|
|
|
|
command_installed curl jq
|
|
|
|
|
if [ -z "${REPO}" ]; then
|
|
|
|
|
USER=$(echo "${1}" | sed 's|/| |g' | awk '{print $1}')
|
|
|
|
|
REPO=$(echo "${1}" | sed 's|/| |g' | awk '{print $2}')
|
|
|
|
@ -90,11 +84,12 @@ github_tags() (
|
|
|
|
|
|
|
|
|
|
command_installed() (
|
|
|
|
|
set -ue
|
|
|
|
|
cmd=${1}
|
|
|
|
|
for cmd in "${@}"; do
|
|
|
|
|
if ! command -v "${cmd}" 1>&2 >/dev/null; then
|
|
|
|
|
echo "${cmd} not installed" 1>&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
min_jpg() (
|