-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmyplay
executable file
·39 lines (33 loc) · 900 Bytes
/
myplay
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
#!/bin/bash
whichDrive="TeamDrive"
function do_for_sigint() {
echo stopping
myDate="$(date "+%F-%T")"
# make a directory in video dir named from current date & time
mkdir ./video/"$myDate"
# move all video files into new directory
mv *.ogg ./video/"$myDate"
mv *.mkv ./video/"$myDate"
# create FQ path to new directory for drive upload
targetDir="$(pwd)/video/$myDate"
echo $targetDir
rclone copy $targetDir $whichDrive:Media/video/$myDate
# kill all children of process to prevent zombies
pkill -P $$
exit
}
#start up all USB webcams connected to system
# myTotalCameras="$(ls /dev/video* | wc -l)"
myTotalCameras="$(ls /dev/video*)"
vars=( $myTotalCameras )
for i in "${vars[@]}"
do
NUMBER=$(echo "$i" | sed 's/[^0-9]//g')
( ./play_video $NUMBER & )
done
#trap ^c to handle exit gracefully and make backup
while true
do
trap 'do_for_sigint' INT
done
exit