better tests

This commit is contained in:
Marc Wäckerlin
2015-03-31 13:59:17 +00:00
parent f46fdff9c9
commit 2bb4aacc76

View File

@@ -11,19 +11,18 @@ FLAGS["mp4"]="-vcodec libx264 -acodec aac -strict experimental -crf 19"
for f in $(find "$SRC" \( \( -name '.??*' -o -name '*.jpg' \) -prune \) -o -type f -print); do for f in $(find "$SRC" \( \( -name '.??*' -o -name '*.jpg' \) -prune \) -o -type f -print); do
for format in ${FORMATS}; do for format in ${FORMATS}; do
t="${f/$SRC/$DST/${format}}" t="${f/$SRC/$DST/${format}}"
t="${t%.*}.${f}" t="${t%.*}.${f}"
if test -s "${t}"; then if test -s "${t}"; then
continue; continue; # ignore if file exists and is not empty
fi fi
if ( ! test -s "${t}" ) && ( test -e "$t" ); then if test -e "$t"; then
rm "$t" rm "$t"; # remove existing empty file
fi fi
test -d "${t%/*}" || mkdir -p "${t%/*}" test -d "${t%/*}" || mkdir -p "${t%/*}"
avconv -i "$f" ${FLAGS[$f]} -filter:v yadif "$t" if ( ! avconv -i "$f" ${FLAGS[$f]} -filter:v yadif "$t"
if ( ! test -s "${t}" ) && ( test -e "$t" ); then || ! test -s "${t}") && test -e "$t"; then
rm "$t" rm "$t"; # remove file if conversion failed
fi fi
done done
done done