Skip to content

Commit

Permalink
Merge pull request #4143 from AllskyTeam/v2024.12.06_01
Browse files Browse the repository at this point in the history
Update branch
  • Loading branch information
Alex-developer authored Dec 29, 2024
2 parents a621a00 + 1ec2c8b commit 15e03e8
Show file tree
Hide file tree
Showing 109 changed files with 2,645 additions and 1,859 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Allsky Camera ![Release](https://img.shields.io/badge/Version-v2024.12.06-green.svg) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MEBU2KN75G2NG&source=url)
# Allsky Camera ![Release](https://img.shields.io/badge/Version-v2024.12.06_01-green.svg) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MEBU2KN75G2NG&source=url)

This is the source code for the Allsky Camera project described [on Instructables](http://www.instructables.com/id/Wireless-All-Sky-Camera/).
 
Expand Down
103 changes: 74 additions & 29 deletions allsky.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#!/bin/bash

# Make it easy to find the beginning of this run in the log file.
echo " ***** Starting AllSky *****"

[[ -z ${ALLSKY_HOME} ]] && export ALLSKY_HOME="$( realpath "$( dirname "${BASH_ARGV0}" )" )"
ME="$( basename "${BASH_ARGV0}" )"

# NOT_STARTED_MSG, STOPPED_MSG, ERROR_MSG_PREFIX, and ZWO_VENDOR are globals


#shellcheck source-path=.
source "${ALLSKY_HOME}/variables.sh" || exit "${EXIT_ERROR_STOP}"
#shellcheck source-path=scripts
Expand All @@ -28,6 +24,65 @@ if [[ ! -d ${ALLSKY_CONFIG} ]]; then
doExit "${EXIT_ERROR_STOP}" "no-image" "" ""
fi

####
usage_and_exit()
{
local RET C MSG

RET=${1}
if [[ ${RET} -eq 0 ]]; then
C="${YELLOW}"
else
C="${RED}"
fi
{
echo -en "\n${C}"
echo -n "Usage: ${ME} [--help] [--preview]"
echo -e "${NC}"
echo
echo "'--help' displays this message and the help message from the capture program, then exits."
echo
echo "'--preview' displays images on your screen as they are taken."
echo
} >&2
[[ ${RET} -ne 0 ]] && exit "${RET}"
}

CAPTURE="capture_${CAMERA_TYPE}"

##### Check arguments
OK="true"
HELP="false"
PREVIEW="false"
while [[ $# -gt 0 ]]; do
ARG="${1}"
case "${ARG,,}" in
--help)
HELP="true"
;;
--preview)
PREVIEW="true"
;;
-*)
echo -e "${RED}Unknown argument: '${ARG}'${NC}." >&2
OK="false"
;;
*)
break; # end of arguments
;;
esac
shift
done
[[ ${OK} == "false" ]] && usage_and_exit 1
if [[ ${HELP} == "true" ]]; then
usage_and_exit 0
"${ALLSKY_BIN}/${CAPTURE}" --help
exit 0
fi

# Make it easy to find the beginning of this run in the log file.
echo " ***** Starting AllSky *****"

# Make sure ${CAMERA_TYPE} is valid; if not, exit with a message.
verify_CAMERA_TYPE "${CAMERA_TYPE}"

Expand Down Expand Up @@ -74,10 +129,10 @@ if [[ -d ${PRIOR_ALLSKY_DIR} ]]; then
fi
if [[ ${DO_MSG} == "true" ]]; then
MSG="Reminder: your prior Allsky is still in '${PRIOR_ALLSKY_DIR}'."
MSG+="\nIf you are no longer using it, it can be removed to save disk space:"
MSG+="\n&nbsp; &nbsp;<code>rm -fr '${PRIOR_ALLSKY_DIR}'</code>\n"
"${ALLSKY_SCRIPTS}/addMessage.sh" "info" "${MSG}"
touch "${OLD_ALLSKY_REMINDER}" # last time we displayed the message
MSG+="\nIf you are no longer using it, it can be removed to save disk space."
"${ALLSKY_SCRIPTS}/addMessage.sh" --id AM_RM_PRIOR --type info --msg "${MSG}" \
--cmd "Click here to remove."
touch "${OLD_ALLSKY_REMINDER}" # Sets the last time we displayed the message.
fi
fi

Expand All @@ -97,9 +152,8 @@ if [[ -f ${CHECK_ALLSKY_LOG} ]]; then
MSG+="Reminder to make these changes to your settings"
MSG+="</div>"
MSG+="$( < "${CHECK_ALLSKY_LOG}" )"
MSG+="<hr><span class='errorMsgBig'>If you made the changes run:</span>"
MSG+="\n&nbsp; &nbsp;<code>rm -f '${CHECK_ALLSKY_LOG}'</code>\n"
"${ALLSKY_SCRIPTS}/addMessage.sh" "warning" "${MSG}"
"${ALLSKY_SCRIPTS}/addMessage.sh" --id AM_RM_CHECK --type warning --msg "${MSG}" \
--cmd "<hr><span class='errorMsgBig'>If you made the changes click here.</span>"
touch "${REMINDER}" # last time we displayed the message
fi
fi
Expand All @@ -117,10 +171,9 @@ if [[ -f ${POST_INSTALLATION_ACTIONS} ]]; then
doExit "${EXIT_ERROR_STOP}" "no-image" "" ""
else
MSG="Reminder: Click here to see the action(s) that need to be performed."
MSG+="\nOnce you perform them run the following to remove this message:"
MSG+="\n &nbsp; &nbsp;<code>rm -f '${POST_INSTALLATION_ACTIONS}'</code>"
PIA="${POST_INSTALLATION_ACTIONS/${ALLSKY_HOME}/}"
"${ALLSKY_SCRIPTS}/addMessage.sh" "warning" "${MSG}" "${PIA}"
"${ALLSKY_SCRIPTS}/addMessage.sh" --id AM_RM_POST --type warning --msg "${MSG}" --url "${PIA}" \
--cmd "\nOnce you perform them, click here to remove this message."
fi
fi

Expand Down Expand Up @@ -225,7 +278,7 @@ fi

# Make sure the settings file is linked to the camera-specific file.
if ! MSG="$( check_settings_link "${SETTINGS_FILE}" )" ; then
"${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${MSG}"
"${ALLSKY_SCRIPTS}/addMessage.sh" --type error --cmd "${MSG}"
echo "ERROR: ${MSG}" >&2
fi

Expand All @@ -241,7 +294,7 @@ else
sudo chgrp "${WEBSERVER_GROUP}" "${ALLSKY_TMP}"
MSG="Had to create '${ALLSKY_TMP}'."
MSG="${MSG}\nIf this happens again, contact the Allsky developers."
"${ALLSKY_SCRIPTS}/addMessage.sh" warning "${ME}: ${MSG}"
"${ALLSKY_SCRIPTS}/addMessage.sh" --type warning --msg "${ME}: ${MSG}"
fi

rm -f "${ALLSKY_BAD_IMAGE_COUNT}" # Start with no bad images
Expand All @@ -260,29 +313,23 @@ if [[ ${USE_NOTIFICATION_IMAGES} == "true" ]]; then
"${ALLSKY_SCRIPTS}/copy_notification_image.sh" --expires 0 "StartingUp" 2>&1 &
fi

: > "${ARGS_FILE}"

# Only pass settings that are used by the capture program.
if ! ARGS="$( "${ALLSKY_SCRIPTS}/convertJSON.php" --capture-only )" ; then
echo "${ME}: ERROR: convertJSON.php returned: ${ARGS}"
set_allsky_status "${ALLSKY_STATUS_ERROR}"
exit "${EXIT_ERROR_STOP}"
fi

# We must pass "-config ${ARGS_FILE}" on the command line and
# other settings needed at the start of the capture program.
echo "${ARGS}" |
grep -E -i -v "^config=|^debuglevel=^cmd=|^cameramodel|^cameranumber|^locale=" >> "${ARGS_FILE}"

# When using a desktop environment a preview of the capture can be displayed.
# The preview mode does not work if we are started as a service or
# if the debian distribution has no desktop environment.
{
[[ $1 == "preview" ]] && echo "preview=true"
echo "${ARGS}" |
grep -E -i -v "^config=|^debuglevel=^cmd=|^cameramodel|^cameranumber|^locale="

echo "version=${ALLSKY_VERSION}"
echo "save_dir=${CAPTURE_SAVE_DIR}"

} >> "${ARGS_FILE}"
[[ ${PREVIEW} == "true" ]] && echo "preview=true"
} > "${ARGS_FILE}"

# If the user wants images uploaded only every n times, save that number to a file.
if [[ ${IMG_UPLOAD_FREQUENCY} -ne 1 ]]; then
Expand All @@ -293,8 +340,6 @@ else
rm -f "${FREQUENCY_FILE}"
fi

CAPTURE="capture_${CAMERA_TYPE}"

# Clear up any flow timings
activate_python_venv
python3 "${ALLSKY_SCRIPTS}/flow-runner.py" --cleartimings
Expand Down
4 changes: 2 additions & 2 deletions config_repo/allsky.logrotate.repo
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
delaycompress
sharedscripts
postrotate
invoke-rc.d rsyslog rotate > /dev/null
systemctl kill -s HUP rsyslog.service
endscript
}

Expand All @@ -22,6 +22,6 @@
delaycompress
sharedscripts
postrotate
invoke-rc.d rsyslog rotate > /dev/null
systemctl kill -s HUP rsyslog.service
endscript
}
2 changes: 2 additions & 0 deletions config_repo/allskyDefines.inc.repo
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ define('HOME', 'XX_HOME_XX');
define('ALLSKY_HOME', 'XX_ALLSKY_HOME_XX');
define('ALLSKY_CONFIG', 'XX_ALLSKY_CONFIG_XX');
define('ALLSKY_SCRIPTS', 'XX_ALLSKY_SCRIPTS_XX');
define('ALLSKY_UTILITIES', 'XX_ALLSKY_UTILITIES_XX');
define('ALLSKY_TMP', 'XX_ALLSKY_TMP_XX');
define('ALLSKY_IMAGES', 'XX_ALLSKY_IMAGES_XX');
define('ALLSKY_MESSAGES', 'XX_ALLSKY_MESSAGES_XX');
Expand All @@ -29,6 +30,7 @@ define('ALLSKY_VERSION', 'XX_ALLSKY_VERSION_XX');
define('ALLSKY_STATUS', 'XX_ALLSKY_STATUS_XX');
define('RASPI_CONFIG', 'XX_RASPI_CONFIG_XX');
define('RASPI_ADMIN_DETAILS', 'XX_RASPI_CONFIG_XX/raspap.auth');
define('CONFIG_UPDATE_STRING', 'XX_NEED_TO_UPDATE_XX');

// Split the placeholder so it doesn't get replaced.
if (ALLSKY_HOME == "XX_ALLSKY_HOME" . "_XX") {
Expand Down
45 changes: 6 additions & 39 deletions config_repo/options.json.repo
Original file line number Diff line number Diff line change
Expand Up @@ -2012,50 +2012,17 @@
{
"name" : "remotewebsiteimageuploadoriginalname",
"default" : false,
"description" : "Enable to upload images using YYYYMMDDHHMMSS naming.",
"description" : "Enable to upload images using YYYYMMDDHHMMSS naming. <strong>Rarely used.</strong>",
"label" : "Upload With Original Name",
"label_prefix" : "Remote Website",
"type" : "boolean",
"carryforward" : true,
"valuedependson" : "imageuploadfrequency=[1-9]*"
},
{
"name" : "remotewebsitevideodestinationname",
"default" : "",
"description" : "Optional name of the remote video file.",
"label" : "Remote Video File Name",
"label_prefix" : "Remote Website",
"type" : "text",
"carryforward" : true,
"booldependson" : "useremotewebsite",
"optional" : true
},
{
"name" : "remotewebsitekeogramdestinationname",
"default" : "",
"description" : "Optional name of the remote keogram file.",
"label" : "Remote Keogram File Name",
"label_prefix" : "Remote Website",
"type" : "text",
"carryforward" : true,
"booldependson" : "useremotewebsite",
"optional" : true
},
{
"name" : "remotewebsitestartrailsdestinationname",
"default" : "",
"description" : "Optional name of the remote startrails file.",
"label" : "Remote Startrails File Name",
"label_prefix" : "Remote Website",
"type" : "text",
"carryforward" : true,
"booldependson" : "useremotewebsite",
"optional" : true
},
{
"name" : "remotewebsiteurl",
"default" : "",
"description" : "The URL of your Allsky Website, for example: https://mywebsite.com/allsky/.<br>Must begin with <span class='WebUIValue'>http</span> or <span class='WebUIValue'>https</span>.",
"description" : "The URL of your Allsky Website, for example: <span class='WebUIValue'>https://mywebsite.com/allsky/</span>.<br>Must begin with <span class='WebUIValue'>http</span> or <span class='WebUIValue'>https</span>.",
"label" : "Website URL",
"label_prefix" : "Remote Website",
"type" : "widetext",
Expand All @@ -2067,7 +2034,7 @@
{
"name" : "remotewebsiteimageurl",
"default" : "",
"description" : "The URL of the image on your Allsky Website, for example: https://mywebsite.com/allsky/image.jpg.<br>Must begin with <span class='WebUIValue'>http</span> or <span class='WebUIValue'>https</span>.",
"description" : "The URL of the image on your Allsky Website, for example: <span class='WebUIValue'>https://mywebsite.com/allsky/image.jpg</span>.<br>Must begin with <span class='WebUIValue'>http</span> or <span class='WebUIValue'>https</span>.",
"label" : "Image URL",
"label_prefix" : "Remote Website",
"type" : "widetext",
Expand Down Expand Up @@ -2275,7 +2242,7 @@
},
{
"name" : "remoteservervideodestinationname",
"default" : "",
"default" : "allsky.mp4",
"description" : "Optional name of the remote video file.",
"label" : "Remote Video File Name",
"label_prefix" : "Remote Server",
Expand All @@ -2286,7 +2253,7 @@
},
{
"name" : "remoteserverkeogramdestinationname",
"default" : "",
"default" : "keogram.jpg",
"description" : "Optional name of the remote keogram file.",
"label" : "Remote Keogram File Name",
"label_prefix" : "Remote Server",
Expand All @@ -2297,7 +2264,7 @@
},
{
"name" : "remoteserverstartrailsdestinationname",
"default" : "",
"default" : "startrails.jpg",
"description" : "Optional name of the remote startrails file.",
"label" : "Remote Startrails File Name",
"label_prefix" : "Remote Server",
Expand Down
Binary file added config_repo/overlay/system_fonts/Andale_Mono.ttf
Binary file not shown.
Binary file added config_repo/overlay/system_fonts/Arial.ttf
Binary file not shown.
Binary file added config_repo/overlay/system_fonts/Arial_Black.ttf
Binary file not shown.
Binary file added config_repo/overlay/system_fonts/Arial_Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added config_repo/overlay/system_fonts/Courier_New.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added config_repo/overlay/system_fonts/Georgia.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added config_repo/overlay/system_fonts/Impact.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added config_repo/overlay/system_fonts/Verdana.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added config_repo/overlay/system_fonts/Webdings.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/andalemo.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/arial.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/arialbd.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/arialbi.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/ariali.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/ariblk.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/comic.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/comicbd.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/cour.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/courbd.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/courbi.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/couri.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/georgia.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/georgiab.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/georgiai.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/georgiaz.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/impact.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/times.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/timesbd.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/timesbi.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/timesi.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/trebuc.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/trebucbd.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/trebucbi.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/trebucit.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/verdana.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/verdanab.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/verdanai.ttf
1 change: 1 addition & 0 deletions config_repo/overlay/system_fonts/verdanaz.ttf
Loading

0 comments on commit 15e03e8

Please sign in to comment.