diff options
-rwxr-xr-x | bin/ipcam_capture.sh (renamed from tools/ipcam_capture.sh) | 2 | ||||
-rwxr-xr-x | bin/ipcam_motion_worker.sh (renamed from tools/ipcam_motion_worker.sh) | 2 | ||||
-rwxr-xr-x | bin/ipcam_rtsp2hls.sh (renamed from tools/ipcam_rtsp2hls.sh) | 0 | ||||
-rw-r--r-- | include/bash/include.bash (renamed from tools/lib.bash) | 0 | ||||
-rw-r--r-- | misc/scripts/home_linux_boards/homekit_ipcam_capture_restart.sh (renamed from misc/scripts/ipcam_capture_restart.sh) | 0 | ||||
-rw-r--r-- | misc/scripts/home_linux_boards/homekit_ipcam_rtsp2hls_restart.sh (renamed from misc/scripts/ipcam_rtsp2hls_restart.sh) | 0 | ||||
-rw-r--r-- | misc/scripts/home_linux_boards/homekit_make_netns_per_upstream.sh (renamed from misc/scripts/make_netns_per_upstream.sh) | 0 | ||||
-rw-r--r-- | misc/scripts/home_linux_boards/homekit_sunxi_h3_i2c_reset.sh (renamed from tools/sunxi-h3-i2c-reset.sh) | 0 | ||||
-rwxr-xr-x | misc/scripts/home_linux_boards/homekit_sunxi_setup_amixer.sh (renamed from tools/sunxi-setup-amixer.sh) | 0 | ||||
-rwxr-xr-x | misc/scripts/home_linux_boards/homekit_sync_recordings_to_remote.sh (renamed from tools/sync-recordings-to-remote.sh) | 0 | ||||
-rw-r--r-- | misc/scripts/remote_server/clickhouse_backup.sh (renamed from tools/clickhouse-backup.sh) | 0 | ||||
-rw-r--r-- | misc/scripts/remote_server/remove_old_recordings.sh (renamed from tools/remove-old-recordings.sh) | 0 | ||||
-rw-r--r-- | systemd/ipcam_capture@.service | 2 | ||||
-rw-r--r-- | systemd/ipcam_rtsp2hls@.service | 2 | ||||
-rwxr-xr-x | tools/process-motion-timecodes.py | 61 | ||||
-rwxr-xr-x | tools/rotate-video.sh | 2 | ||||
-rwxr-xr-x | tools/video-util.sh | 2 |
17 files changed, 6 insertions, 67 deletions
diff --git a/tools/ipcam_capture.sh b/bin/ipcam_capture.sh index 08b9093..b97c856 100755 --- a/tools/ipcam_capture.sh +++ b/bin/ipcam_capture.sh @@ -36,7 +36,7 @@ EOF validate_channel() { local c="$1" case "$c" in - 1 | 2) + 1|2) : ;; *) diff --git a/tools/ipcam_motion_worker.sh b/bin/ipcam_motion_worker.sh index c5f711d..603a407 100755 --- a/tools/ipcam_motion_worker.sh +++ b/bin/ipcam_motion_worker.sh @@ -5,7 +5,7 @@ set -e DIR="$( cd "$( dirname "$(realpath "${BASH_SOURCE[0]}")" )" &>/dev/null && pwd )" PROGNAME="$0" -. "$DIR/lib.bash" +. "$DIR/../include/bash/include.bash" curl_opts="-s --connect-timeout 10 --retry 5 --max-time 180 --retry-delay 0 --retry-max-time 180" allow_multiple= diff --git a/tools/ipcam_rtsp2hls.sh b/bin/ipcam_rtsp2hls.sh index c321820..c321820 100755 --- a/tools/ipcam_rtsp2hls.sh +++ b/bin/ipcam_rtsp2hls.sh diff --git a/tools/lib.bash b/include/bash/include.bash index 1d73ab2..1d73ab2 100644 --- a/tools/lib.bash +++ b/include/bash/include.bash diff --git a/misc/scripts/ipcam_capture_restart.sh b/misc/scripts/home_linux_boards/homekit_ipcam_capture_restart.sh index 85144da..85144da 100644 --- a/misc/scripts/ipcam_capture_restart.sh +++ b/misc/scripts/home_linux_boards/homekit_ipcam_capture_restart.sh diff --git a/misc/scripts/ipcam_rtsp2hls_restart.sh b/misc/scripts/home_linux_boards/homekit_ipcam_rtsp2hls_restart.sh index 61ee623..61ee623 100644 --- a/misc/scripts/ipcam_rtsp2hls_restart.sh +++ b/misc/scripts/home_linux_boards/homekit_ipcam_rtsp2hls_restart.sh diff --git a/misc/scripts/make_netns_per_upstream.sh b/misc/scripts/home_linux_boards/homekit_make_netns_per_upstream.sh index fb152fa..fb152fa 100644 --- a/misc/scripts/make_netns_per_upstream.sh +++ b/misc/scripts/home_linux_boards/homekit_make_netns_per_upstream.sh diff --git a/tools/sunxi-h3-i2c-reset.sh b/misc/scripts/home_linux_boards/homekit_sunxi_h3_i2c_reset.sh index e654dfb..e654dfb 100644 --- a/tools/sunxi-h3-i2c-reset.sh +++ b/misc/scripts/home_linux_boards/homekit_sunxi_h3_i2c_reset.sh diff --git a/tools/sunxi-setup-amixer.sh b/misc/scripts/home_linux_boards/homekit_sunxi_setup_amixer.sh index 5746514..5746514 100755 --- a/tools/sunxi-setup-amixer.sh +++ b/misc/scripts/home_linux_boards/homekit_sunxi_setup_amixer.sh diff --git a/tools/sync-recordings-to-remote.sh b/misc/scripts/home_linux_boards/homekit_sync_recordings_to_remote.sh index cf979d1..cf979d1 100755 --- a/tools/sync-recordings-to-remote.sh +++ b/misc/scripts/home_linux_boards/homekit_sync_recordings_to_remote.sh diff --git a/tools/clickhouse-backup.sh b/misc/scripts/remote_server/clickhouse_backup.sh index 6e938e4..6e938e4 100644 --- a/tools/clickhouse-backup.sh +++ b/misc/scripts/remote_server/clickhouse_backup.sh diff --git a/tools/remove-old-recordings.sh b/misc/scripts/remote_server/remove_old_recordings.sh index d376572..d376572 100644 --- a/tools/remove-old-recordings.sh +++ b/misc/scripts/remote_server/remove_old_recordings.sh diff --git a/systemd/ipcam_capture@.service b/systemd/ipcam_capture@.service index b1c363e..e195231 100644 --- a/systemd/ipcam_capture@.service +++ b/systemd/ipcam_capture@.service @@ -8,7 +8,7 @@ RestartSec=3 User=user Group=user EnvironmentFile=/etc/ipcam_capture.conf.d/%i.conf -ExecStart=/home/user/homekit/tools/ipcam_capture.sh --outdir $OUTDIR --creds $CREDS --ip $IP --port $PORT $ARGS +ExecStart=/home/user/homekit/bin/ipcam_capture.sh --outdir $OUTDIR --creds $CREDS --ip $IP --port $PORT $ARGS Restart=always [Install] diff --git a/systemd/ipcam_rtsp2hls@.service b/systemd/ipcam_rtsp2hls@.service index efcdd6a..9ce6cca 100644 --- a/systemd/ipcam_rtsp2hls@.service +++ b/systemd/ipcam_rtsp2hls@.service @@ -8,7 +8,7 @@ RestartSec=3 User=user Group=user EnvironmentFile=/etc/ipcam_rtsp2hls.conf.d/%i.conf -ExecStart=/home/user/homekit/tools/ipcam_rtsp2hls.sh --name %i --user $USER --password $PASSWORD --ip $IP --port $PORT $ARGS +ExecStart=/home/user/homekit/bin/ipcam_rtsp2hls.sh --name %i --user $USER --password $PASSWORD --ip $IP --port $PORT $ARGS Restart=on-failure RestartSec=3 diff --git a/tools/process-motion-timecodes.py b/tools/process-motion-timecodes.py deleted file mode 100755 index 7be7977..0000000 --- a/tools/process-motion-timecodes.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python3 -import os.path -from src.home.camera.util import dvr_scan_timecodes - -from argparse import ArgumentParser -from datetime import datetime, timedelta - -DATETIME_FORMAT = '%Y-%m-%d-%H.%M.%S' - - -def chunks(lst, n): - for i in range(0, len(lst), n): - yield lst[i:i + n] - - -def time2seconds(time: str) -> int: - time, frac = time.split('.') - frac = int(frac) - - h, m, s = [int(i) for i in time.split(':')] - - return round(s + m*60 + h*3600 + frac/1000) - - -def filename_to_datetime(filename: str) -> datetime: - filename = os.path.basename(filename).replace('record_', '').replace('.mp4', '') - return datetime.strptime(filename, DATETIME_FORMAT) - - -if __name__ == '__main__': - parser = ArgumentParser() - parser.add_argument('--source-filename', type=str, required=True, - help='recording filename') - parser.add_argument('--timecodes', type=str, required=True, - help='timecodes') - parser.add_argument('--padding', type=int, default=2, - help='amount of seconds to add before and after each fragment') - arg = parser.parse_args() - - if arg.padding < 0: - raise ValueError('invalid padding') - - fragments = dvr_scan_timecodes(arg.timecodes) - file_dt = filename_to_datetime(arg.source_filename) - - for fragment in fragments: - start, end = fragment - - start -= arg.padding - end += arg.padding - - if start < 0: - start = 0 - - duration = end - start - - dt1 = (file_dt + timedelta(seconds=start)).strftime(DATETIME_FORMAT) - dt2 = (file_dt + timedelta(seconds=end)).strftime(DATETIME_FORMAT) - filename = f'{dt1}__{dt2}.mp4' - - print(f'{start} {duration} {filename}') diff --git a/tools/rotate-video.sh b/tools/rotate-video.sh index 6d27b44..5ce4efe 100755 --- a/tools/rotate-video.sh +++ b/tools/rotate-video.sh @@ -5,7 +5,7 @@ set -e DIR="$( cd "$( dirname "$(realpath "${BASH_SOURCE[0]}")" )" &>/dev/null && pwd )" PROGNAME="$0" -. "$DIR/lib.bash" +. "$DIR/../include/bash/include.bash" usage() { diff --git a/tools/video-util.sh b/tools/video-util.sh index 0ee5560..6fe6109 100755 --- a/tools/video-util.sh +++ b/tools/video-util.sh @@ -5,7 +5,7 @@ set -e DIR="$( cd "$( dirname "$(realpath "${BASH_SOURCE[0]}")" )" &> /dev/null && pwd )" PROGNAME="$0" -. "$DIR/lib.bash" +. "$DIR/../include/bash/include.bash" input= output= |