move some scripts around, delete obsolete ones

This commit is contained in:
Evgeny Zinoviev 2023-06-11 03:30:12 +03:00
parent 0109d6c01d
commit 387c26e218
17 changed files with 6 additions and 67 deletions

View File

@ -36,7 +36,7 @@ EOF
validate_channel() {
local c="$1"
case "$c" in
1 | 2)
1|2)
:
;;
*)

View File

@ -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=

View File

@ -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]

View File

@ -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

View File

@ -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}')

View File

@ -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() {

View File

@ -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=