attach small file to signal

This commit is contained in:
Antonio J. Delgado 2023-03-21 00:42:35 +02:00
parent 677f9a8bcd
commit 8f9273942e

View file

@ -198,6 +198,12 @@ done
if [ -n "${file}" ]; then
file_uri=$(echo "${file}" | sed 's|/srv/expendable_data|https://ficheros.koti.site|g')
data="${data}, \"file_uri\": \"${file_uri}\""
temp_file="$(mktemp /tmp/tmp.XXXXX.mkv)"
result=$(/usr/bin/ffmpeg -y -filter_complex '[0:v] fps=12,scale=480:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse' -i "${file}" "${temp_file}" 2>&1)
return_code=$?
if [ ${return_code} != 0 ]; then
message "Error ${return_code} processing video file '${file}'. ${result}"
fi
if [ -n "${move_to}" ]; then
message "Moving file '${file}' to '${move_to}'..."
scp -P "${move_to_port}" "${file}" "${move_to}/" && rm -rf "${file}"
@ -212,7 +218,7 @@ json_data="{${data}}"
if [ "${signal_alert}" == "true" ]; then
message "Sending to Signal destination '${signal_destination}'..."
/var/lib/from_repos/signal_scripts/send_msg.sh --destination "${signal_destination}" \
--message "Clip termino en camara '${camera_name}' (${motion_host}). Evento: #${event}. File: ${file_uri}"
--message "Clip termino en camara '${camera_name}' (${motion_host}). Evento: #${event}. File: ${file_uri}" "${temp_file}"
return_code=$?
if [ $return_code != 0 ]; then
message "Error ${return_code} sending to signal."
@ -233,12 +239,6 @@ if [ -n "${ntfy_server}" ]; then
ntfy_password="$(cat "${ntfy_password_file}")"
message "Sending event to ntfy server '${ntfy_server}/motion_detection' ..."
if [ -n "${file}" ]; then
temp_file="$(mktemp /tmp/tmp.XXXXX.mkv)"
result=$(/usr/bin/ffmpeg -y -filter_complex '[0:v] fps=12,scale=480:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse' -i "${file}" "${temp_file}" 2>&1)
return_code=$?
if [ ${return_code} != 0 ]; then
message "Error ${return_code} processing video file '${file}'. ${result}"
fi
ntfy_data="{ \"topic\": \"motion_detection\", \"message\": \"Event ${event_type} on host ${motion_host} camera ${camera_name}\", \"filename\": \"$(basename ${file})\" }"
curl -s "${ntfy_server}" -T "${temp_file}" -H "Filename: $(basename "${file}")"-u "${ntfy_user}:${ntfy_password}" -d "${ntfy_data}"
return_code=$?