fix: Switch to W64 for night long recording
This commit is contained in:
parent
5cf0864b75
commit
bf665bbb33
@ -1,6 +1,6 @@
|
|||||||
# NBMrec configuration file
|
# NBMrec configuration file
|
||||||
START_TIME=22:00
|
START_TIME=17:00
|
||||||
END_TIME=06:00
|
END_TIME=08:00
|
||||||
RECORD_DIR=/mnt/DATA/media/records
|
RECORD_DIR=/mnt/DATA/media/records
|
||||||
PREFIX=nbmrec
|
PREFIX=nbmrec
|
||||||
VERBOSE=false
|
VERBOSE=false
|
@ -19,8 +19,8 @@ install()
|
|||||||
sudo sed -i "s/<USER>/$USER/g" /etc/systemd/system/nbmrec.service
|
sudo sed -i "s/<USER>/$USER/g" /etc/systemd/system/nbmrec.service
|
||||||
sudo sed -i "s/<start_time>/$START_TIME/g" /etc/systemd/system/nbmrec.timer
|
sudo sed -i "s/<start_time>/$START_TIME/g" /etc/systemd/system/nbmrec.timer
|
||||||
|
|
||||||
sudo systemctl daemon-reload
|
# sudo systemctl daemon-reload
|
||||||
sudo systemctl enable --now nbmrec.timer
|
# sudo systemctl enable --now nbmrec.timer
|
||||||
}
|
}
|
||||||
|
|
||||||
uninstall()
|
uninstall()
|
||||||
|
2
run.sh
Executable file
2
run.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
screen -dmS nbmrec /usr/local/bin/nbmrec.sh
|
@ -11,12 +11,14 @@ RECORD_FILENAME="${PREFIX}_$(date +"%Y%m%d_%H%M%S").wav"
|
|||||||
RECORD_FILEPATH="${RECORD_DIR}/${RECORD_DATE}/${RECORD_FILENAME}"
|
RECORD_FILEPATH="${RECORD_DIR}/${RECORD_DATE}/${RECORD_FILENAME}"
|
||||||
START_TIME="22:00"
|
START_TIME="22:00"
|
||||||
END_TIME="06:00"
|
END_TIME="06:00"
|
||||||
RECORD_DURATION=$(( $(date -d "$END_TIME + 1 day" "+%s") - $(date -d "$START_TIME" "+%s") ))
|
START_TIMESTAMP=$(date -d "$START_TIME" "+%s")
|
||||||
|
END_TIMESTAMP=$(date -d "$END_TIME + 1 day" "+%s")
|
||||||
|
RECORD_DURATION=$(( $START_TIMESTAMP - $END_TIMESTAMP ))
|
||||||
VERBOSE=false
|
VERBOSE=false
|
||||||
|
|
||||||
# Load conf file if any
|
# Load conf file if any
|
||||||
if [ -f /usr/local/etc/nbmrec/nbmrec.conf ]; then
|
if [ -f /usr/local/etc/nbmrec/nbmrec.conf ]; then
|
||||||
source /usr/local/etc/nbmrec.conf
|
source /usr/local/etc/nbmrec/nbmrec.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RECORD_DURATION=$(( $(date -d "$END_TIME + 1 day" "+%s") - $(date -d "$START_TIME" "+%s") ))
|
RECORD_DURATION=$(( $(date -d "$END_TIME + 1 day" "+%s") - $(date -d "$START_TIME" "+%s") ))
|
||||||
@ -55,6 +57,7 @@ while getopts ":hd:f:" opt; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# Create output folder
|
# Create output folder
|
||||||
if $VERBOSE
|
if $VERBOSE
|
||||||
@ -68,8 +71,10 @@ main() {
|
|||||||
then
|
then
|
||||||
echo "Recording $RECORD_FILENAME"
|
echo "Recording $RECORD_FILENAME"
|
||||||
fi
|
fi
|
||||||
rec -b 16 -r 48000 -c 1 -t wav $RECORD_FILEPATH trim 0 $RECORD_DURATION
|
|
||||||
|
|
||||||
|
while [[ $(date "+%s") -le $END_TIMESTAMP ]]; do
|
||||||
|
rec -b 16 -r 48000 -c 1 -t w64 $RECORD_FILEPATH trim 0 $RECORD_DURATION > /tmp/nbmrec-rec.log
|
||||||
|
done
|
||||||
if $VERBOSE
|
if $VERBOSE
|
||||||
then
|
then
|
||||||
echo "Done"
|
echo "Done"
|
||||||
|
Loading…
Reference in New Issue
Block a user