summaryrefslogtreecommitdiffstats
path: root/drg2flac.sh
diff options
context:
space:
mode:
Diffstat (limited to 'drg2flac.sh')
-rwxr-xr-xdrg2flac.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/drg2flac.sh b/drg2flac.sh
index 1b46cc6..6a39bc4 100755
--- a/drg2flac.sh
+++ b/drg2flac.sh
@@ -55,8 +55,12 @@ Options:
EOT
}
+warn() {
+ echo "${cred}An error occured while $1${cres}" >&2
+}
+
error() {
- echo "${cred}An error occured while $2${cres}" >&2
+ warn "$2"
echo "${cred}Skipping file $1${cres}" >&2
}
@@ -125,29 +129,27 @@ for infile in "$@"; do
title=$(drg2sbg -r 2 "$infile")
if (( $? != 0 )); then
- error "$infile" "getting the title"
- continue
+ warn "getting the title"
else
flacargs+=("-T" "TITLE=$title")
fi
desc=$(drg2sbg -r 4 "$infile")
if (( $? != 0 )); then
- error "$infile" "getting the description"
- continue
+ warn "getting the description"
else
flacargs+=("-T" "DESCRIPTION=$desc")
fi
drg2sbg -r 3 -o "$tmp/image" "$infile"
if (( $? != 0 )); then
- error "$infile" "getting the image"
+ warn "getting the image"
else
echo
echo "${cblue}Converting image${cres}"
convert "$tmp/image" "$tmp/image.png"
if (( $? != 0 )); then
- error "$infile" "converting the image"
+ warn "converting the image"
else
flacargs+=("--picture=$tmp/image.png")
fi