Files
Megapixels/movie.sh.in
Pavel Machek 63a77bb557 Add robustness against out of disk space.
Shell is ugly programing language, and by continuing after error, we
were creating recording in wrong directory. Fix that up.
2024-05-10 10:10:26 +02:00

29 lines
666 B
Bash
Executable File

#!/bin/bash
# Copyright 2022, 2024 Pavel Machek, GPLv2+
SCRIPT_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
GIGA_DIR="$2"
DEST_NAME="$3"
FPS="$4"
MODE="$5"
echo script_dir $SCRIPT_DIR 1>&2
echo GIGA_DIR $GIGA_DIR 1>&2
echo DEST_NAME $DEST_NAME 1>&2
echo FPS $FPS dfps 1>&2
if [ "-$1" == "-start" ]; then
mkdir $GIGA_DIR/sm || echo Message: NOSPC
cd $GIGA_DIR/sm || exit 1
@LIBEXECDIR@/movie_audio_rec $FPS &
echo $! > $GIGA_DIR/audio.pid
elif [ "-$1" == "-stop" ]; then
kill `cat $2/audio.pid`
cd $GIGA_DIR
@LIBEXECDIR@/mpegize.py convert $GIGA_DIR/ $DEST_NAME $FPS $MODE
rm -r $GIGA_DIR
echo Message: Rec
else
echo "Unrecognized command"
fi