Using a hack to get better sleep deay times

use read command insted of sleep
This commit is contained in:
bradley.richins
2021-03-21 19:19:50 -06:00
parent 79ed3e4048
commit e8dcd77065

59
rokuc
View File

@@ -111,6 +111,11 @@ function scan4dev()
fi fi
} }
function delay()
{
read -p "" -t $1
}
VERBOS=0 VERBOS=0
POSITIONAL=() POSITIONAL=()
while [[ $# -gt 0 ]] while [[ $# -gt 0 ]]
@@ -200,61 +205,61 @@ if [[ $LAUNCH == "plex" ]]; then
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/13535"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/13535"'
fi fi
sleep 4 delay 4
elif [[ $LAUNCH == "netflix" ]]; then elif [[ $LAUNCH == "netflix" ]]; then
curl -d "" "http://${ADDRESS}:8060/launch/12" curl -d "" "http://${ADDRESS}:8060/launch/12"
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/12"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/12"'
fi fi
sleep 4 delay 4
elif [[ $LAUNCH == "youtube" ]]; then elif [[ $LAUNCH == "youtube" ]]; then
curl -d "" "http://${ADDRESS}:8060/launch/837" curl -d "" "http://${ADDRESS}:8060/launch/837"
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/837"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/837"'
fi fi
sleep 4 delay 4
elif [[ $LAUNCH == "hulu" ]]; then elif [[ $LAUNCH == "hulu" ]]; then
curl -d "" "http://${ADDRESS}:8060/launch/2285" curl -d "" "http://${ADDRESS}:8060/launch/2285"
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/2285"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/2285"'
fi fi
sleep 4 delay 4
elif [[ $LAUNCH == "hdmi1" ]]; then elif [[ $LAUNCH == "hdmi1" ]]; then
curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi1" curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi1"
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi1"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi1"'
fi fi
sleep 4 delay 4
elif [[ $LAUNCH == "hdmi2" ]]; then elif [[ $LAUNCH == "hdmi2" ]]; then
curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi2" curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi2"
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi2"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi2"'
fi fi
sleep 4 delay 4
elif [[ $LAUNCH == "hdmi3" ]]; then elif [[ $LAUNCH == "hdmi3" ]]; then
curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi3" curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi3"
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi3"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi3"'
fi fi
sleep 4 delay 4
elif [[ $LAUNCH == "hdmi4" ]]; then elif [[ $LAUNCH == "hdmi4" ]]; then
curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi4" curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi4"
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi4"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/tvinput.hdmi4"'
fi fi
sleep 4 delay 4
elif [[ $LAUNCH == "av1" ]]; then elif [[ $LAUNCH == "av1" ]]; then
curl -d "" "http://${ADDRESS}:8060/launch/tvinput.av1" curl -d "" "http://${ADDRESS}:8060/launch/tvinput.av1"
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/tvinput.av1"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/tvinput.av1"'
fi fi
sleep 4 delay 4
elif [[ $LAUNCH == "tv" ]]; then elif [[ $LAUNCH == "tv" ]]; then
curl -d "" "http://${ADDRESS}:8060/launch/tvinput.dtv" curl -d "" "http://${ADDRESS}:8060/launch/tvinput.dtv"
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/tvinput.dtv"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/tvinput.dtv"'
fi fi
sleep 4 delay 4
fi fi
# Command handler [-c|--command] args # Command handler [-c|--command] args
@@ -266,7 +271,7 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Play"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Play"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
home|"#") home|"#")
@@ -274,7 +279,7 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Home"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Home"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
select|ok|".") select|ok|".")
@@ -282,7 +287,7 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Select"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Select"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
vol+|v+|vup|"+") vol+|v+|vup|"+")
@@ -290,7 +295,7 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/VolumeUp"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/VolumeUp"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
vol-|v-|vdown|"-") vol-|v-|vdown|"-")
@@ -298,7 +303,7 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/VolumeDown"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/VolumeDown"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
mute|m) mute|m)
@@ -306,7 +311,7 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/VolumeMute"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/VolumeMute"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
off|power-off|shutdown|O) off|power-off|shutdown|O)
@@ -314,7 +319,7 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/PowerOff"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/PowerOff"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
on|power-on|startup|I) on|power-on|startup|I)
@@ -322,7 +327,7 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/PowerOn"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/PowerOn"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
back|k) back|k)
@@ -330,7 +335,7 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Back"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Back"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
u|up|^) u|up|^)
@@ -338,7 +343,7 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Up"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Up"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
d|down|v) d|down|v)
@@ -346,7 +351,7 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Down"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Down"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
l|left|"<") l|left|"<")
@@ -354,7 +359,7 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Left"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Left"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
r|right|">") r|right|">")
@@ -362,35 +367,35 @@ for key in $com; do
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Right"' echo 'curl -d "" "http://${ADDRESS}:8060/launch/keypress/Right"'
fi fi
sleep .5 delay .5
shift shift
;; ;;
s.5) s.5)
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'wait 0.5 seconds' echo 'wait 0.5 seconds'
fi fi
sleep .5 delay .5
shift shift
;; ;;
s1) s1)
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'wait 1 second' echo 'wait 1 second'
fi fi
sleep 1 delay 1
shift shift
;; ;;
s2) s2)
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'wait 2 seconds' echo 'wait 2 seconds'
fi fi
sleep 2 delay 2
shift shift
;; ;;
s5) s5)
if (( $VERBOS == 1 )); then if (( $VERBOS == 1 )); then
echo 'wait 5 seconds' echo 'wait 5 seconds'
fi fi
sleep 5 delay 5
shift shift
;; ;;
esac esac