Fix names
This commit is contained in:
parent
8efff3b5ad
commit
d05661dc15
71
src/rec.sh
71
src/rec.sh
@ -1,71 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# NBMrec
|
||||
# nocturnal bird migration recorder daemon
|
||||
# by Samuel ORTION
|
||||
|
||||
RECORD_DIR="/mnt/DATA/media/records"
|
||||
RECORD_DATE=$(date +"%Y-%m-%d")
|
||||
RECORD_FILENAME=$(date +"%Y%m%d_%H%M%S")
|
||||
RECORD_FILEPATH="${RECORD_DIR}/${RECORD_DATE}/${RECORD_FILENAME}.wav"
|
||||
RECORD_DURATION=60
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [ -d <duration> ] [ -f <filename> ]"
|
||||
echo " -d <duration> : duration of the recording in seconds or 'night' for all night recording"
|
||||
echo " -f <filename> : filename of the recording"
|
||||
echo " -h : display this help"
|
||||
echo " -v : switch to verbose mode"
|
||||
}
|
||||
|
||||
# Get command line options
|
||||
while getopts ":hd:f:" opt; do
|
||||
case $opt in
|
||||
h)
|
||||
usage
|
||||
;;
|
||||
d)
|
||||
RECORD_DURATION=$OPTARG
|
||||
if [ "$RECORD_DURATION" == "night" ]; then
|
||||
RECORD_DURATION=32400
|
||||
fi
|
||||
;;
|
||||
f)
|
||||
RECORD_FILEPATH=$OPTARG
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
verbose=false
|
||||
|
||||
main() {
|
||||
# Create output folder
|
||||
if $verbose
|
||||
then
|
||||
echo "Creating record output folder"
|
||||
fi
|
||||
mkdir -p "$RECORD_DIR/$RECORD_DATE/"
|
||||
|
||||
# Perform recording
|
||||
if $verbose
|
||||
then
|
||||
echo "Recording $RECORD_FILENAME"
|
||||
fi
|
||||
rec -b 16 -r 48000 -c 1 -t wav $RECORD_FILEPATH trim 0 $RECORD_DURATION
|
||||
|
||||
if $verbose
|
||||
then
|
||||
echo "Done"
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user