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