1.4.4 changes yippee
This commit is contained in:
parent
eba9ccc504
commit
eccc30ea85
35
flacconv
35
flacconv
|
@ -1,19 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
VERSION=1.4.3
|
||||
RED="$(tput setaf 9)" || RED="$(tput setf 4)"
|
||||
GREEN="$(tput setaf 10)" || GREEN="$(tput setf 2)"
|
||||
YELLOW="$(tput setaf 11)" || YELLOW="$(tput setf 6)"
|
||||
RESET="$(tput sgr0)"
|
||||
VERSION=1.4.4
|
||||
RED="$(printf '\033[38;5;9m')"
|
||||
GREEN="$(printf '\033[38;5;10m')"
|
||||
YELLOW="$(printf '\033[38;5;11m')"
|
||||
RESET="$(printf '\033[m')"
|
||||
set -euf
|
||||
BN="${0##*/}"
|
||||
NL='
|
||||
'
|
||||
export POSIXLY_CORRECT=1
|
||||
|
||||
if [ "${NO_COLOR:-}" ]; then
|
||||
RED=
|
||||
GREEN=
|
||||
YELLOW=
|
||||
RESET=
|
||||
RED="" GREEN="" YELLOW="" RESET=""
|
||||
fi
|
||||
|
||||
errecho() {
|
||||
|
@ -95,7 +94,7 @@ process_file() {
|
|||
bname="${infile##*/}"
|
||||
|
||||
# tagnames will be used for all non-metaflac operations, as it allows for multiline comment shit
|
||||
tagnames="$(metaflac --export-tags-to=- "$infile" | grep -F '=' | cut -d '=' -f 1 | uniq)"
|
||||
tagnames="$(metaflac --export-tags-to=- "$infile" | grep -E '^[A-Z]+=' | cut -d '=' -f 1 | sort | uniq)"
|
||||
|
||||
# check if flac has a picture, if not, set RMPIC
|
||||
metaflac --export-picture-to=- "$infile" 1>/dev/null 2>&1 || RMPIC=1
|
||||
|
@ -132,16 +131,12 @@ process_file() {
|
|||
# build opus comment chain, can't "import" tags like with flac
|
||||
set --
|
||||
[ "$tagnames" ] && while read -r name; do
|
||||
tmptag="$(metaflac --show-tag="$name" "$infile")"
|
||||
if [ "${tmptag#*=}" ]; then
|
||||
tagcount="$(printf '%s' "$tmptag"| grep -c "^$name=")" # multi-value tags funsies
|
||||
i=2 # must be 2 because there's a blank 1st record
|
||||
while [ $i -le $((tagcount + 1)) ]; do
|
||||
# this awk is kinda cool, I like it
|
||||
set -- "$@" "--comment" "$(printf '%s' "$tmptag" | awk -v RS="^$name=|\n$name=" "FNR==$i{print \"$name=\" \$0 }")"
|
||||
i=$((i + 1))
|
||||
done
|
||||
fi
|
||||
tag="$(metaflac --show-tag="$name" "$infile")"
|
||||
# need a while loop here to handle tags with multiple values
|
||||
while [ "$tag" != "${tag#*$name=}" ]; do # check if we're on last one
|
||||
tag="${tag#*$name=}" # trim prefix
|
||||
set -- "$@" "--comment" "$name=${tag%%$NL$name=*}" # set to val without suffix*
|
||||
done
|
||||
done <<-EOF
|
||||
$tagnames
|
||||
EOF
|
||||
|
|
Loading…
Reference in New Issue