forked from ungleich-public/cdist-contrib
35 lines
1009 B
Bash
Executable File
35 lines
1009 B
Bash
Executable File
# 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() {
|
|
recording_meeting_path="${1}"
|
|
recording_general_path="${2}"
|
|
room="${3}"
|
|
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 "${recording_meeting_path}" "${recording_general_path}" "${room}"
|
|
}
|
|
|
|
main "${@}"
|
|
|
|
exit 0
|