handle errors properly
This commit is contained in:
parent
bb8f08f15c
commit
69853cb2b6
15
dve
15
dve
@ -15,6 +15,13 @@ if [ -f ~/.dverc ]; then
|
||||
source ~/.dverc
|
||||
fi
|
||||
|
||||
function on_finish() {
|
||||
echo "Cleaning up temporary working files"
|
||||
rm -f "${OUTDIR}"/*
|
||||
cd "$CWD"
|
||||
echo "Finished cleaning"
|
||||
}
|
||||
|
||||
function usage() {
|
||||
cat << EOF
|
||||
usage: $0 [options] filename
|
||||
@ -76,6 +83,9 @@ if [ $# -lt 1 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CWD=`pwd`
|
||||
trap on_finish EXIT
|
||||
|
||||
checkpaths
|
||||
|
||||
if ! mkdir -p ${OUTDIR}; then
|
||||
@ -89,7 +99,6 @@ if [[ "$1" == *".AVI" || "$1" == *".avi" ]]; then
|
||||
else
|
||||
$ENC -i "$1" -map 0 -codec copy -f segment -segment_time $LEN -segment_format matroska -v ${VERBOSE} "${OUTDIR}/chunk-%03d.orig"
|
||||
fi
|
||||
CWD=`pwd`
|
||||
cd "$OUTDIR"
|
||||
|
||||
echo "Running parallel encoding jobs"
|
||||
@ -108,7 +117,3 @@ done
|
||||
BASE=`basename "$1"`
|
||||
OUTFILE="${CWD}"/"${BASE%.*}${SUFFIX}"
|
||||
${ENC} -y -v ${VERBOSE} -f concat -i concat.txt -f matroska -map 0 -c copy "${OUTFILE}"
|
||||
|
||||
echo "Cleaning up temporary working files"
|
||||
rm -f "${OUTDIR}"/*
|
||||
cd "$CWD"
|
||||
|
Loading…
Reference in New Issue
Block a user