Skip to content

Commit

Permalink
darkCapture.sh: bug fix
Browse files Browse the repository at this point in the history
Move the dark file to the darks directory rather than copy it.
If the user isn't using notification images, copy the file back to tmp/image.jpg so the websites can see it.
  • Loading branch information
EricClaeys authored Feb 12, 2022
1 parent f23c04b commit 085ab2d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scripts/darkCapture.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ if [ "${DARK_MODE}" = "1" ] ; then
# If the camera doesn't support temperature, we will keep overwriting the file until
# the user creates a temperature.txt file.
if [ "${AS_TEMPERATURE}" = "n/a" ]; then
cp "${CURRENT_IMAGE}" "${DARKS_DIR}"
MOVE_TO_FILE="${DARKS_DIR}/$(basename "${CURRENT_IMAGE}")"
else
cp "${CURRENT_IMAGE}" "${DARKS_DIR}/${AS_TEMPERATURE}.${DARK_EXTENSION}"
MOVE_TO_FILE="${DARKS_DIR}/${AS_TEMPERATURE}.${DARK_EXTENSION}"
fi
mv "${CURRENT_IMAGE}" "${MOVE_TO_FILE}"

# If the user has notification images on, the current image says we're taking dark frames,
# so don't overwrite it.
Expand All @@ -48,7 +49,14 @@ if [ "${DARK_MODE}" = "1" ] ; then
USE_NOTIFICATION_IMAGES=$(jq -r '.notificationimages' "${CAMERA_SETTINGS}")
if [ "${USE_NOTIFICATION_IMAGES}" = "0" ] ; then
# Go ahead and let the web sites see the dark frame to see if it's working.
cp "${CURRENT_IMAGE}" "${FULL_FILENAME}"
# We're copying back the file we just moved, but the assumption is few people
# will want to see the dark frames on the web.

# xxxx TODO: don't use $FULL_FILENAME since that assumes $EXTENSION is the same as
# $DARK_EXTENSION. If we start saving darks as .png files the extensions will be
# different and we'll need to run "convert" to make the dark a .jpg file to
# be displayed on the web.
cp "${MOVE_TO_FILE}" "${FULL_FILENAME}"
fi

exit 0 # exit so the calling script exits and doesn't try to process the file.
Expand Down

0 comments on commit 085ab2d

Please sign in to comment.