Compare commits
No commits in common. "5b6d3539872527613e5c66f42310fa773d64fde6" and "7dafdfef40c993b42f7d87da3eda2c173a149309" have entirely different histories.
5b6d353987
...
7dafdfef40
11 changed files with 69 additions and 129 deletions
35
bypass.sh
Normal file
35
bypass.sh
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
[[ ! -f "./config.env" ]] && printf "error: file \'config.env\' does not exist\n" && exit 1
|
||||||
|
source "./config.env"
|
||||||
|
|
||||||
|
url="/bypass"
|
||||||
|
index="$1"
|
||||||
|
if [[ "$index" ]] && [ "$index" -eq "$index" ] 2> /dev/null; then
|
||||||
|
if [ "$index" -lt 0 ]; then
|
||||||
|
index=0
|
||||||
|
elif [ "$index" -gt 7 ]; then
|
||||||
|
index=7
|
||||||
|
fi
|
||||||
|
url="$url/$index"
|
||||||
|
fi
|
||||||
|
|
||||||
|
function checkVariable() {
|
||||||
|
[[ "$1" ]] && return 0
|
||||||
|
printf "error: variable"
|
||||||
|
[[ "$2" ]] && printf " \'$2\'"
|
||||||
|
printf " is not set\n"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
checkVariable "$PBC_PROTOCOL" "PBC_PROTOCOL"
|
||||||
|
checkVariable "$PBC_HOST" "PBC_HOST"
|
||||||
|
checkVariable "$PBC_PORT" "PBC_PORT"
|
||||||
|
|
||||||
|
url="$PBC_PROTOCOL://$PBC_HOST:$PBC_PORT$url"
|
||||||
|
|
||||||
|
printf "sending POST request: \'$url\'...${FONT_BOLD}"
|
||||||
|
[ "$(curl -X POST -s -f -w "\n%{http_code}" "$url" | tail -n1)" -ne 200 ] && printf " error!\n" || printf " done!\n"
|
12
config.env
12
config.env
|
@ -1,8 +1,6 @@
|
||||||
export TERM=xterm
|
FONT_BOLD=$(tput bold)
|
||||||
|
FONT_NORMAL=$(tput sgr0)
|
||||||
|
|
||||||
export FONT_BOLD=$(tput bold)
|
PBC_PROTOCOL="http"
|
||||||
export FONT_NORMAL=$(tput sgr0)
|
PBC_HOST="192.168.1.24"
|
||||||
|
PBC_PORT="3000"
|
||||||
export PBC_PROTOCOL="http"
|
|
||||||
export PBC_HOST="192.168.1.24"
|
|
||||||
export PBC_PORT="3000"
|
|
8
pedalboard.sh
Normal file
8
pedalboard.sh
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
[[ ! -f "./config.env" ]] && printf "error: file \'config.env\' does not exist\n" && exit 1
|
||||||
|
source "./config.env"
|
||||||
|
|
22
send-midi.sh
22
send-midi.sh
|
@ -1,22 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
||||||
# license: MIT
|
|
||||||
|
|
||||||
dir="$(dirname $(realpath "$0"))"
|
|
||||||
|
|
||||||
. "$dir/config.env"
|
|
||||||
|
|
||||||
function checkVariable() {
|
|
||||||
[[ -z "$1" ]] && printf "${FONT_BOLD}error: ${FONT_NORMAL}no $2 given\n" && exit 1
|
|
||||||
! [ "$1" -eq "$1" ] 2> /dev/null && printf "${FONT_BOLD}error: ${FONT_NORMAL}given $2 \'$1\' is not a number\n" && exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
checkVariable "$1" "midi channel"
|
|
||||||
checkVariable "$2" "midi controller"
|
|
||||||
checkVariable "$3" "value"
|
|
||||||
|
|
||||||
url="$(""$dir"/url.sh" "/midi")"
|
|
||||||
|
|
||||||
printf "> sending POST request to \'$url\'...${FONT_BOLD}"
|
|
||||||
[ "$(curl -X POST -s -f -w "\n%{http_code}" "$url" -d "channel=$1" -d "controller=$2" -d "value=$3" | tail -n1)" -ne 200 ] && printf " error!\n" || printf " done!\n"
|
|
|
@ -1,17 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
||||||
# license: MIT
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
dir="$(dirname $(realpath "$0"))"
|
|
||||||
|
|
||||||
. "$dir/config.env"
|
|
||||||
|
|
||||||
[[ -z "$1" ]] && printf "${FONT_BOLD}error: ${FONT_NORMAL}no pedalboard id given\n" && exit 1
|
|
||||||
|
|
||||||
url="$(""$dir"/url.sh" "/pedalboards" "$1")"
|
|
||||||
|
|
||||||
printf "> sending POST request to \'$url\'...${FONT_BOLD}"
|
|
||||||
[ "$(curl -X POST -s -f -w "\n%{http_code}" "$url" | tail -n1)" -ne 200 ] && printf " error!\n" || printf " done!\n"
|
|
32
start-pedalboard.sh
Executable file → Normal file
32
start-pedalboard.sh
Executable file → Normal file
|
@ -1,50 +1,50 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>>>
|
||||||
# license: MIT
|
# license: MIT
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[[ "$EUID" != "0" ]] && printf "error: permission denied\n" && exit 1
|
[[ "$EUID" != "0" ]] && printf "error: permission denied\n" && exit 1
|
||||||
|
|
||||||
. "$(dirname $(realpath $0))/config.env"
|
source "./config.env"
|
||||||
|
|
||||||
printf "${FONT_BOLD}>>> starting pedalboard...${FONT_NORMAL}\n"
|
printf "${FONT_BOLD}> starting pedalboard...${FONT_NORMAL}\n"
|
||||||
|
|
||||||
. "/usr/local/pisound/scripts/common/common.sh"
|
source "/usr/local/pisound/scripts/common/common.sh"
|
||||||
|
|
||||||
flash_leds 10
|
flash_leds 10
|
||||||
sleep 0.25
|
sleep 0.25
|
||||||
flash_leds 10
|
flash_leds 10
|
||||||
|
|
||||||
printf "> " && "/etc/velvettear/scripts/cpu-governor.sh" "performance"
|
printf ">>> " && "/etc/velvettear/scripts/cpu-governor.sh" "performance"
|
||||||
|
|
||||||
printf "> starting MODEP..."
|
printf ">>> starting MODEP..."
|
||||||
patchbox module activate modep &> /dev/null
|
patchbox module activate modep &>>> /dev/null
|
||||||
printf " done!\n"
|
printf " done!\n"
|
||||||
|
|
||||||
up="$(journalctl -u modep-touchosc2midi | tail -n1)"
|
up="$(journalctl -u modep-touchosc2midi | tail -n1)"
|
||||||
while [[ "$up" != *"Waiting for first package from touchOSC"* ]]; do
|
while [[ "$up" != *"Waiting for first package from touchOSC"* ]]; do
|
||||||
printf "> waiting for touchosc2midi to come up...\n"
|
printf ">>> waiting for touchosc2midi to come up...\n"
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
up="$(journalctl -u modep-touchosc2midi | tail -n1)"
|
up="$(journalctl -u modep-touchosc2midi | tail -n1)"
|
||||||
done
|
done
|
||||||
printf "> sending message to touchosc2midi to wake it up...\n"
|
printf ">>> sending message to touchosc2midi to wake it up...\n"
|
||||||
oscsend localhost 12101 / m 000000b0
|
oscsend localhost 12101 / m 000000b0
|
||||||
|
|
||||||
if [[ ! -e "/etc/systemd/system/pbc.service" ]]; then
|
if [[ ! -e "/etc/systemd/system/pbc.service" ]]; then
|
||||||
printf "> symlinking \'pbc.service\' to \'/etc/systemd/system\'..."
|
printf ">>> symlinking \'pbc.service\' to \'/etc/systemd/system\'..."
|
||||||
ln -s "/opt/pbc/pbc.service" "/etc/systemd/system/pbc.service" &> /dev/null
|
ln -s "/opt/pbc/pbc.service" "/etc/systemd/system/pbc.service" &>>> /dev/null
|
||||||
printf " done!\n"
|
printf " done!\n"
|
||||||
printf "> reloading systemd services..."
|
printf ">>> reloading systemd services..."
|
||||||
systemctl daemon-reload &> /dev/null
|
systemctl daemon-reload &>>> /dev/null
|
||||||
printf " done!\n"
|
printf " done!\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "> starting pbc..."
|
printf ">>> starting pbc..."
|
||||||
systemctl start pbc &> /dev/null
|
systemctl start pbc &>>> /dev/null
|
||||||
printf " done!\n"
|
printf " done!\n"
|
||||||
|
|
||||||
flash_leds 100
|
flash_leds 100
|
||||||
|
|
||||||
printf "${FONT_BOLD}>>> started pedalboard after "$SECONDS" seconds${FONT_NORMAL}\n"
|
printf "${FONT_BOLD}> started pedalboard after "$SECONDS" seconds${FONT_NORMAL}\n"
|
8
stop-pedalboard.sh
Executable file → Normal file
8
stop-pedalboard.sh
Executable file → Normal file
|
@ -7,11 +7,11 @@ set -e
|
||||||
|
|
||||||
[[ "$EUID" != "0" ]] && printf "error: permission denied\n" && exit 1
|
[[ "$EUID" != "0" ]] && printf "error: permission denied\n" && exit 1
|
||||||
|
|
||||||
. "$(dirname $(realpath $0))/config.env"
|
source "./config.env"
|
||||||
|
|
||||||
printf "${FONT_BOLD}>>> stopping pedalboard...${FONT_NORMAL}\n"
|
printf "${FONT_BOLD}> stopping pedalboard...${FONT_NORMAL}\n"
|
||||||
|
|
||||||
. "/usr/local/pisound/scripts/common/common.sh"
|
source "/usr/local/pisound/scripts/common/common.sh"
|
||||||
|
|
||||||
flash_leds 10
|
flash_leds 10
|
||||||
sleep 0.25
|
sleep 0.25
|
||||||
|
@ -33,4 +33,4 @@ printf "> " && "/etc/velvettear/scripts/cpu-governor.sh" "powersave"
|
||||||
|
|
||||||
flash_leds 100
|
flash_leds 100
|
||||||
|
|
||||||
printf "${FONT_BOLD}>>> stopped pedalboard after "$SECONDS" seconds${FONT_NORMAL}\n"
|
printf "${FONT_BOLD}> stopped pedalboard after "$SECONDS" seconds${FONT_NORMAL}\n"
|
|
@ -1,15 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
||||||
# license: MIT
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
dir="$(dirname $(realpath "$0"))"
|
|
||||||
|
|
||||||
. "$dir/config.env"
|
|
||||||
|
|
||||||
url="$(""$dir"/url.sh" "/bypass" "$1")"
|
|
||||||
|
|
||||||
printf "> sending POST request to \'$url\'...${FONT_BOLD}"
|
|
||||||
[ "$(curl -X POST -s -f -w "\n%{http_code}" "$url" | tail -n1)" -ne 200 ] && printf " error!\n" || printf " done!\n"
|
|
|
@ -1,15 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
||||||
# license: MIT
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
dir="$(dirname $(realpath "$0"))"
|
|
||||||
|
|
||||||
. "$dir/config.env"
|
|
||||||
|
|
||||||
url="$(""$dir"/url.sh" "/systemd" "$1")"
|
|
||||||
|
|
||||||
printf "> sending POST request to \'$url\'...${FONT_BOLD}"
|
|
||||||
[ "$(curl -X POST -s -f -w "\n%{http_code}" "$url" -d "state=toggle" | tail -n1)" -ne 200 ] && printf " error!\n" || printf " done!\n"
|
|
32
url.sh
32
url.sh
|
@ -1,32 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
||||||
# license: MIT
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
[[ -z "$1" ]] && printf "${FONT_BOLD}error:${FONT_NORMAL} no endpoint given\n" && exit 1
|
|
||||||
url="$1"
|
|
||||||
[[ "$url" != "/"* ]] && url="/$url"
|
|
||||||
|
|
||||||
if [[ "$2" ]]; then
|
|
||||||
index="$2"
|
|
||||||
[[ "$index" != "/"* ]] && index="/$index"
|
|
||||||
fi
|
|
||||||
url="$url$index"
|
|
||||||
|
|
||||||
function checkVariable() {
|
|
||||||
[[ "$1" ]] && return 0
|
|
||||||
printf "error: variable"
|
|
||||||
[[ "$2" ]] && printf " \'$2\'"
|
|
||||||
printf " is not set\n"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
checkVariable "$PBC_PROTOCOL" "PBC_PROTOCOL"
|
|
||||||
checkVariable "$PBC_HOST" "PBC_HOST"
|
|
||||||
checkVariable "$PBC_PORT" "PBC_PORT"
|
|
||||||
|
|
||||||
url="$PBC_PROTOCOL://$PBC_HOST:$PBC_PORT$url"
|
|
||||||
|
|
||||||
printf "$url"
|
|
Loading…
Reference in a new issue