-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.sh
98 lines (85 loc) · 2.95 KB
/
app.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
# Purpose: Display pause prompt
function pause(){
local message="$@"
[ -z $message ] && message="Press [Enter] key to continue..."
read -p "$message" readEnterKey
}
# Purpose - Display main menu on screen
function show_menu(){
echo "==========================="
echo " MAIN MENU "
echo "==========================="
echo "1. Take a Picture"
echo "2. Take a Video"
echo "3. Stream Video"
echo "4. Take a Picture with Status"
echo "5. Exit"
}
# Purpose - Get info about username, OS used, uptime along with how many users, IPs, and hostnames
function take_picture(){
echo "-------------------------------------------------------"
echo " TAKING A PICTURE "
echo "-------------------------------------------------------"
eval python3 take_picture.py
echo "Your picture is saved in output.jpg"
# pause "Press [Enter] key to continue..."
pause
}
# Purpose - Briefly display hardware information
function take_video(){
echo "-------------------------------------------------------"
echo " TAKING A VIDEO "
echo " Press Ctrl+C to Stop "
echo "-------------------------------------------------------"
eval python3 take_video.py
eval clear
echo "Your video is saved in output.avi"
pause
}
# Purpose - Display memory size and free memory, statistical system memory information,
# including the list of applications that use the largest CPU performance
function stream_video(){
echo "-------------------------------------------------------"
echo " STREAMING VIDEO "
echo " Press q to Stop "
echo "-------------------------------------------------------"
eval sleep 3
eval python3 stream_video.py
eval clear
pause
}
function take_picture_with_status(){
echo "-------------------------------------------------------"
echo " TRY TAKING A PICTURE "
echo "-------------------------------------------------------"
eval sudo echo 0xffff > /sys/module/uvcvideo/parameters/trace
eval python3 take_picture.py
dmesg | tail -8
eval sudo echo 0 > /sys/module/uvcvideo/parameters/trace
echo "Your picture is saved in output.jpg"
pause
}
# Purpose - Get input via the keyboard and make a decision using case..esac
function read_input(){
local c
read -p "choose 1-5: " c
case $c in
1) take_picture ;;
2) take_video ;;
3) stream_video ;;
4) take_picture_with_status ;;
5) echo "Bye Bye...."; exit 0 ;;
*)
echo "Please select between 1 to 5 choice only."
pause
esac
}
# main logic
while true
do
clear
date # Display the date
show_menu # Display memu
read_input # Wait for user input
done