summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2012-11-01 16:19:44 +0100
committerFlorian Bruhin <git@the-compiler.org>2012-11-01 16:19:44 +0100
commita3381a1d7b689ec7bc414048c4e7dc43184a1ef2 (patch)
treeb15c60a4bbba7ab226712e4f8ad5515027723c60
parent5f9ac8c61bcbe64bad16ca33e4fe0511a38d0e1a (diff)
downloaddrg2flac-a3381a1d7b689ec7bc414048c4e7dc43184a1ef2.tar.gz
drg2flac-a3381a1d7b689ec7bc414048c4e7dc43184a1ef2.zip
Make images skippable
-rwxr-xr-xdrg2flac.sh22
1 files changed, 16 insertions, 6 deletions
diff --git a/drg2flac.sh b/drg2flac.sh
index fa0e8d1..64295c8 100755
--- a/drg2flac.sh
+++ b/drg2flac.sh
@@ -115,6 +115,7 @@ tmp=$(mktemp -d)
# Convert
for infile in "$@"; do
+ skipimage=0
echo "${cbold}===== $infile =====${cres}"
echo
echo "${cblue}Getting metadata${cres}"
@@ -126,11 +127,19 @@ for infile in "$@"; do
(( $? != 0 )) && { error "$infile" "getting the description"; continue ;}
drg2sbg -r 3 -o "$tmp/image" "$infile"
- (( $? != 0 )) && { error "$infile" "getting the image"; continue ;}
-
- echo "${cblue}Converting image${cres}"
- convert "$tmp/image" "$tmp/image.png"
- (( $? != 0 )) && { error "$infile" "converting the image"; continue ;}
+ if (( $? != 0 )); then
+ error "$infile" "getting the image"
+ echo "Converted file will have no image!" >&2
+ skipimage=1
+ else
+ echo "${cblue}Converting image${cres}"
+ convert "$tmp/image" "$tmp/image.png"
+ if (( $? != 0 )); then
+ error "$infile" "converting the image"
+ echo "Converted file will have no image!" >&2
+ skipimage=1
+ fi
+ fi
echo "${cblue}Converting drg to sbg${cres}"
drg2sbg -o "$tmp/sbg" "$infile"
@@ -143,10 +152,11 @@ for infile in "$@"; do
echo "${cblue}Converting wav to flac${cres}"
[[ -z "$outfile" ]] && outfile="${infile%.*}.flac"
[[ -z "$artist" ]] && artist="I-Doser"
+ (( $skipimage == 0 )) && imageopts="--picture=$tmp/image.png" || imageopts=
flacopts+=" --no-mid-side"
flac $flacopts -T "ARTIST=$artist" -T "TITLE=$title" \
-T ENCODING="converted by drg2flac using flac $flacopts" \
- --picture="$tmp/image.png" -o "$outfile" "$infile"
+ "$imageopts" -o "$outfile" "$infile"
(( $? != 0 )) && { error "$infile" "converting wav to flac"; continue ;}
echo "${cgreen}Done!${cres}"