1
0
mirror of https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git synced 2025-09-09 15:40:45 +02:00

Fixed new stills/video target dir path (#1198)

This commit is contained in:
Seweryn Zeman
2019-10-17 21:44:04 +02:00
committed by jmtatsch
parent e08a5e5f85
commit 37cce78775
3 changed files with 8 additions and 9 deletions

View File

@@ -40,13 +40,13 @@ video_rtsp_f=15
save_snapshot=false
save_snapshot_dir=/system/sdcard/DCIM/motion/stills
save_snapshot_attr="0666"
max_snapshots=20
max_snapshot_days=20
# Videos
save_video=false
save_video_dir=/system/sdcard/DCIM/motion/videos
save_video_attr="0666"
max_videos=10
max_video_days=10
# Configure FTP snapshots and videos
ftp_snapshot=false

View File

@@ -34,7 +34,6 @@ start()
stop()
{
pid="$(cat "$PIDFILE" 2>/dev/null)"
current=$(status)
if [ "$pid" ]; then
kill "$pid"
rm "$PIDFILE" 1> /dev/null 2>&1

View File

@@ -72,12 +72,12 @@ if [ "$save_snapshot" = true ] ; then
(
debug_msg "Save snapshot to $save_snapshot_dir/$groupname/$filename.jpg"
if [ ! -d "$save_snapshot_dir" ]; then
mkdir -p "$save_snapshot_dir"
if [ ! -d "$save_snapshot_dir/$groupname" ]; then
mkdir -p "$save_snapshot_dir/$groupname"
fi
# Limit the number of snapshots
if [ "$(ls "$save_snapshot_dir" | wc -l)" -ge "$max_snapshots" ]; then
if [ "$(ls "$save_snapshot_dir" | wc -l)" -ge "$max_snapshot_days" ]; then
rm -f "$save_snapshot_dir/$(ls -ltr "$save_snapshot_dir" | awk 'NR==2{print $9}')"
fi
@@ -91,12 +91,12 @@ if [ "$save_video" = true ] ; then
(
debug_msg "Save video to $save_video_dir/$groupname/$filename.mp4"
if [ ! -d "$save_video_dir" ]; then
mkdir -p "$save_video_dir"
if [ ! -d "$save_video_dir/$groupname" ]; then
mkdir -p "$save_video_dir/$groupname"
fi
# Limit the number of videos
if [ "$(ls "$save_video_dir" | wc -l)" -ge "$max_videos" ]; then
if [ "$(ls "$save_video_dir" | wc -l)" -ge "$max_video_days" ]; then
rm -f "$save_video_dir/$(ls -ltr "$save_video_dir" | awk 'NR==2{print $9}')"
fi