Skip to content

Commit

Permalink
Ask for the RTMP keyset
Browse files Browse the repository at this point in the history
  • Loading branch information
strugee committed Nov 3, 2024
1 parent 25a52ef commit c04d22d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 1 addition & 2 deletions bin/seagl-setup-app
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ function get_config_value() {
}

if [ "$arg" == obs ]; then
# TODO ask for the keyset
keyset=ajDevelopment
keyset=$(cat /var/lib/seagl/rtmp-keyset)
rtmp_key=$(get_config_value .rtmpKeys.$keyset.$(cat /var/lib/seagl/room-id))
sed -i "s/__YOUTUBE_STREAM_KEY__/$rtmp_key/" ~/.var/app/com.obsproject.Studio/basic/profiles/Untitled/service.json
start_and_link_app com.obsproject.Studio
Expand Down
12 changes: 10 additions & 2 deletions sbin/seagl-setup-room
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,28 @@ if ! [ $(id -u) == 0 ]; then
fi

mkdir -p /var/lib/seagl

seagl-refresh-config

zenity --list --text='Which room is this?' --column=Room Lyceum 332 334 340 > /var/lib/seagl/room-id

hostnamectl location "$(sed -E 's/([[:digit:]])/Room \1/' < /var/lib/seagl/room-id)"

if zenity --question --text='Should this laptop be provisioned for streaming? Choose no if it will only be used for presentations.'; then
echo streaming > /var/lib/seagl/laptop-type
descriptions=()
# Can't do `| while read` because bash runs this in a subshell, and vars don't set.
# https://unix.stackexchange.com/a/143959/29146
while read i; do descriptions+=("$i"); done < <(jq -r '.rtmpKeys[] | .keysetDescription' < /var/lib/seagl/config-data.json)
desc="$(zenity --list --text='Which RTMP keyset is this?' --column=Room "${descriptions[@]}")"
# This is a little hard to follow, but basically we use to_entries to work with the key and (object) value at the same object depth, then filter for a description matching what Zenity gave us. The matching description's associated key is the keyset ID.
jq -r '.rtmpKeys | to_entries[] | select (.value.keysetDescription == "'"$desc"'") | .key' </var/lib/seagl/config-data.json >/var/lib/seagl/rtmp-keyset
else
echo presentations > /var/lib/seagl/laptop-type
fi

hostnamectl hostname seagl-$(tr '[:upper:]' '[:lower:]' < /var/lib/seagl/room-id)-$(cat /var/lib/seagl/laptop-type)

seagl-refresh-config

# TODO set up OBS, then (auto)launch it

if [ $(cat /var/lib/seagl/laptop-type) == streaming ]; then
Expand Down

0 comments on commit c04d22d

Please sign in to comment.