|
| 1 | +# |
| 2 | +# This file is part of yi-hack-v5 (https://github.com/alienatedsec/yi-hack-v5). |
| 3 | +# Copyright (c) 2021-2023 alienatedsec - v5 specific |
| 4 | +# |
| 5 | +# This program is free software: you can redistribute it and/or modify |
| 6 | +# it under the terms of the GNU General Public License as published by |
| 7 | +# the Free Software Foundation, version 3. |
| 8 | +# |
| 9 | +# This program is distributed in the hope that it will be useful, but |
| 10 | +# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | +# General Public License for more details. |
| 13 | +# |
| 14 | +# You should have received a copy of the GNU General Public License |
| 15 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | +# |
| 17 | +# Launch - version 0.3.8 |
| 18 | +# |
| 19 | +#!/bin/sh |
| 20 | + |
| 21 | +kill_all() { |
| 22 | + # Kills all running instances of app1 and app2 |
| 23 | + killall wd_rtsp.sh |
| 24 | + killall rRTSPServer |
| 25 | + killall h264grabber |
| 26 | +} |
| 27 | + |
| 28 | +launch_apps() { |
| 29 | + # Launches app1 and app2 with different commands |
| 30 | + if [ "$execute_audio" = true ]; then |
| 31 | + h264grabber -r audio -m "$model" -f & |
| 32 | + fi |
| 33 | + |
| 34 | + if [ "$settings" = "high" ]; then |
| 35 | + debug_flag="" |
| 36 | + if [ "$debug_mode" = true ]; then |
| 37 | + debug_flag="-d 7" |
| 38 | + fi |
| 39 | + h264grabber -r high -m "$model" -f & |
| 40 | + rRTSPServer -r high -a "$enable_audio" -p 554 -u -w $debug_flag & |
| 41 | + fi |
| 42 | + |
| 43 | + if [ "$settings" = "low" ]; then |
| 44 | + debug_flag="" |
| 45 | + if [ "$debug_mode" = true ]; then |
| 46 | + debug_flag="-d 7" |
| 47 | + fi |
| 48 | + h264grabber -r low -m "$model" -f & |
| 49 | + rRTSPServer -r low -a "$enable_audio" -p 554 -u -w $debug_flag & |
| 50 | + fi |
| 51 | + |
| 52 | + if [ "$settings" = "both" ]; then |
| 53 | + debug_flag="" |
| 54 | + if [ "$debug_mode" = true ]; then |
| 55 | + debug_flag="-d 7" |
| 56 | + fi |
| 57 | + h264grabber -r low -m "$model" -f & |
| 58 | + h264grabber -r high -m "$model" -f & |
| 59 | + rRTSPServer -r both -a "$enable_audio" -p 554 -u -w $debug_flag & |
| 60 | + fi |
| 61 | + |
| 62 | +} |
| 63 | + |
| 64 | + |
| 65 | +# Read model name from file |
| 66 | +model=$(cat /home/app/.camver) |
| 67 | +version_cam=$(cat /home/yi-hack-v5/version) |
| 68 | +version_sd=$(cat /tmp/sd/yi-hack-v5/version) |
| 69 | +echo "Using model: $model" |
| 70 | +echo "Version on cam: $version_cam" |
| 71 | +echo "Version on sd: $version_sd" |
| 72 | + |
| 73 | +read -p "Specify the operation (k for kill, l for launch): " operation |
| 74 | + |
| 75 | +if [ "$operation" = "k" ] || [ "$operation" = "K" ]; then |
| 76 | + kill_all |
| 77 | +elif [ "$operation" = "l" ] || [ "$operation" = "L" ]; then |
| 78 | + read -p "Specify the settings (high, low, or both): " settings |
| 79 | + read -p "Enable audio? (y/n): " audio_choice |
| 80 | + |
| 81 | + if [ "$audio_choice" = "y" ] || [ "$audio_choice" = "Y" ]; then |
| 82 | + execute_audio=true |
| 83 | + enable_audio="yes" |
| 84 | + else |
| 85 | + execute_audio=false |
| 86 | + enable_audio="no" |
| 87 | + fi |
| 88 | + |
| 89 | + read -p "Execute in debug mode? (y/n): " debug_choice |
| 90 | + |
| 91 | + if [ "$debug_choice" = "y" ] || [ "$debug_choice" = "Y" ]; then |
| 92 | + debug_mode=true |
| 93 | + else |
| 94 | + debug_mode=false |
| 95 | + fi |
| 96 | + |
| 97 | + launch_apps |
| 98 | +else |
| 99 | + echo "Invalid operation." |
| 100 | +fi |
0 commit comments