-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot-ip-webcam.sh
69 lines (59 loc) · 2.16 KB
/
boot-ip-webcam.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/data/data/com.termux/files/usr/bin/env bash
. ~/ipcamgram/ipcamgram-config
######### Termux boot #############
termux-wake-lock
termux-wifi-enable true
sleep 40
###################################
########### Start #################
bot_message "Ip Webcam start"
sleep 2
curl -u $LOGIN:$PASSWORD "$URL/settings/video_chunk_len?set=$VIDEO_TIME" && bot_message "Длительность:$VIDEO_TIMEмин"
sleep 2
curl -u $LOGIN:$PASSWORD "$URL/settings/video_size?set=$VIDEO_SIZE" && bot_message "Расширение:$VIDEO_SIZE"
sleep 2
curl -u $LOGIN:$PASSWORD "$URL/settings/quality?set=$QUALITY" && bot_message "Качество:$QUALITY%"
sleep 2
curl -u $LOGIN:$PASSWORD "$URL/focus" && bot_message "Фокус:ок"
sleep 2
curl -u $LOGIN:$PASSWORD "$URL/settings/mirror_flip?set=mirror,flip" && bot_message "Ориентация:ок"
sleep 2
curl -u $LOGIN:$PASSWORD "$URL/stopvideo?force=1" &> /dev/null
sleep 2
bot_message "$MY_IP"
find $IP_WEBCAM_DIR -type f -iname "*" -not -path "$DOWN_DIR/*" -exec mv {} $DOWN_DIR \;
###################################
(inotifywait -e close_write --format '%w%f' -m -q -r $IP_WEBCAM_DIR |\
(
while read
do
((var++))
if [ $var -eq 2 ]
then
if [ $NO_NET -eq 0 ] && ping -q -w1 -c1 149.154.167.51 &>/dev/null
then
bot_message "Выгружаю $REPLY"
echo "Выгружаю из $REPLY"
(~/ipcamgram/tgsend.sh $CHAT_ID $REPLY $CAPTION) &
else
echo "Нет доступа к Telegram"
mv -f $REPLY $DOWN_DIR/
NO_NET=1
fi
var=0
elif [ $(ls $DOWN_DIR | wc -l) -ge 1 ] && [ $NO_NET -eq 1 ] && ping -q -w1 -c1 149.154.167.51 &>/dev/null
then
echo "Выгружаю из $DOWN_DIR"
bot_message "Выгружаю $DOWN_DIR"
(~/ipcamgram/tgsend.sh $CHAT_ID $DOWN_DIR/"*" $CAPTION) &
NO_NET=0
fi
done
)) &
########### Start #################
sleep 5
curl -u $LOGIN:$PASSWORD "$URL/startvideo?force=1&mode=$MODE&tag=$VIDEO_NAME"
sleep 2
STATUS=$(curl -u $LOGIN:$PASSWORD "$URL/videostatus" | jq --raw-output ".fname") && bot_message "$STATUS запись"
sleep 5
###################################