use thermal image for thumbnails during night hours
parent
d8fb6f1580
commit
46e3946489
|
@ -64,15 +64,21 @@ function generate_manifest_thumbnail() {
|
||||||
local relpath=${2}
|
local relpath=${2}
|
||||||
local basename=$(basename "${manifest}" "manifest.txt")
|
local basename=$(basename "${manifest}" "manifest.txt")
|
||||||
local dest=${relpath}/${basename}thumbnail.png
|
local dest=${relpath}/${basename}thumbnail.png
|
||||||
if [ -f "${WXRX_WEB_PUBDIR}/${dest}" ]; then
|
local hour_of_day=$(date -d @$(timestamp_from_filename "${manifest}") "+%d")
|
||||||
|
if [ -f "${WXRX_WEB_PUBDIR}/${dest}" ]; then
|
||||||
logdebug "thumbnail already exists: %s" "${WXRX_WEB_PUBDIR}/${dest}"
|
logdebug "thumbnail already exists: %s" "${WXRX_WEB_PUBDIR}/${dest}"
|
||||||
echo $dest
|
echo $dest
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
local file=$(grep 'MCIR' ${manifest} | head -n 1)
|
|
||||||
if [ -z "${file}" ]; then
|
# Prefer thermal images for night
|
||||||
local file=$(grep 'therm' ${manifest} | head -n 2)
|
if [ "${hour_of_day}" -lt 6 ] || [ "${hour_of_day}" -gt 18 ]; then
|
||||||
|
local file=$(grep 'therm' ${manifest} | head -n 1)
|
||||||
|
else
|
||||||
|
local file=$(grep 'MCIR' ${manifest} | head -n 1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# if file is empty, fallback to ANY png
|
||||||
if [ -z "${file}" ]; then
|
if [ -z "${file}" ]; then
|
||||||
local file=$(grep 'png' ${manifest} | head -n 2)
|
local file=$(grep 'png' ${manifest} | head -n 2)
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue