summaryrefslogtreecommitdiffstats
path: root/drg2flac.sh
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2013-08-15 21:21:30 +0200
committerFlorian Bruhin <git@the-compiler.org>2013-08-15 21:21:30 +0200
commit7c3d88a4ba8748d60f65095a87958e69b49f42f8 (patch)
tree3496f5581d7a8de5bf079cd5a8fd2fb2750b973b /drg2flac.sh
parent8e36c1a030c61588941e0355027a8a6cdcc68098 (diff)
downloaddrg2flac-7c3d88a4ba8748d60f65095a87958e69b49f42f8.tar.gz
drg2flac-7c3d88a4ba8748d60f65095a87958e69b49f42f8.zip
Try not to die
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