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
|
source ~/.dverc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
function on_finish() {
|
||||||
|
echo "Cleaning up temporary working files"
|
||||||
|
rm -f "${OUTDIR}"/*
|
||||||
|
cd "$CWD"
|
||||||
|
echo "Finished cleaning"
|
||||||
|
}
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
usage: $0 [options] filename
|
usage: $0 [options] filename
|
||||||
@ -76,6 +83,9 @@ if [ $# -lt 1 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CWD=`pwd`
|
||||||
|
trap on_finish EXIT
|
||||||
|
|
||||||
checkpaths
|
checkpaths
|
||||||
|
|
||||||
if ! mkdir -p ${OUTDIR}; then
|
if ! mkdir -p ${OUTDIR}; then
|
||||||
@ -89,7 +99,6 @@ if [[ "$1" == *".AVI" || "$1" == *".avi" ]]; then
|
|||||||
else
|
else
|
||||||
$ENC -i "$1" -map 0 -codec copy -f segment -segment_time $LEN -segment_format matroska -v ${VERBOSE} "${OUTDIR}/chunk-%03d.orig"
|
$ENC -i "$1" -map 0 -codec copy -f segment -segment_time $LEN -segment_format matroska -v ${VERBOSE} "${OUTDIR}/chunk-%03d.orig"
|
||||||
fi
|
fi
|
||||||
CWD=`pwd`
|
|
||||||
cd "$OUTDIR"
|
cd "$OUTDIR"
|
||||||
|
|
||||||
echo "Running parallel encoding jobs"
|
echo "Running parallel encoding jobs"
|
||||||
@ -108,7 +117,3 @@ done
|
|||||||
BASE=`basename "$1"`
|
BASE=`basename "$1"`
|
||||||
OUTFILE="${CWD}"/"${BASE%.*}${SUFFIX}"
|
OUTFILE="${CWD}"/"${BASE%.*}${SUFFIX}"
|
||||||
${ENC} -y -v ${VERBOSE} -f concat -i concat.txt -f matroska -map 0 -c copy "${OUTFILE}"
|
${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