diff --git a/type/__jitsi_jibri/files/finalize_recording.sh b/type/__jitsi_jibri/files/finalize_recording.sh new file mode 100755 index 0000000..36a1f90 --- /dev/null +++ b/type/__jitsi_jibri/files/finalize_recording.sh @@ -0,0 +1,32 @@ +# Managed remotely, changes will be lost +#!/bin/sh +set -e +set -u + +guess_room_name() { + recording_meeting_path="${1}" + # the approach is to delete the 25 fixed character postfix string on each + # file (example: room_name_2022-06-08-15-28-25.mp4) another approach would be + # to take the url + # from the metadata.json file, but that would imply json parsing or jq dependency + basename "$(ls "${recording_meeting_path}"/*.mp4)" | rev | cut -c25- | rev +} + +move_meeting() { + mkdir -p "${recording_general_path}/${room}/" + mv "${recording_meeting_path}"/*.mp4 "${recording_general_path}/${room}/" + rm "${recording_meeting_path}/metadata.json" + rmdir "${recording_meeting_path}" +} + +main() { + recording_meeting_path="${1}" + recording_general_path="$(dirname "${1}")" + room="$(guess_room_name "${recording_meeting_path}")" + move_meeting + echo "$0 ${@} ${room}" >> /tmp/thisisatest.log +} + +main "${@}" + +exit 0 diff --git a/type/__jitsi_jibri/manifest b/type/__jitsi_jibri/manifest index 39a2e11..28ae9d3 100755 --- a/type/__jitsi_jibri/manifest +++ b/type/__jitsi_jibri/manifest @@ -30,13 +30,7 @@ __line '/etc/modules' --line 'snd_aloop' --onchange 'modprobe snd_aloop' # thanks https://github.com/emrahcom/emrah-buster-templates/blob/master/machines/eb-jibri-template/usr/local/bin/finalize_recording.sh __file '/opt/finalize_recording.sh' \ --mode '755' \ - --source '-' << EOF -# Managed remotely, changes will be lost -#!/bin/sh -set -e - -exit 0 -EOF + --source "${__type}/files/finalize_recordding.sh" __apt_key 'jitsi_meet' \ --source "${__type}/files/apt-jitsi-keyring.gpg"