News feature added.

This commit is contained in:
Storm Dragon 2021-06-30 22:38:21 -04:00
parent d0bf910f45
commit a5bb8bc021

View File

@ -46,6 +46,24 @@ EOF
# Dialog accessibility
export DIALOGOPTS='--no-lines --visit-items'
# Check for latest news
check_news() {
# url for news file
local newsFile="https://stormgames.wolfe.casa/media/agm.ogg"
local newsPath="${configFile%/*.conf}/.news"
local newsTag="$(curl --connect-timeout 3 -sI "$newsFile" | grep 'etag: "' | cut -d '"' -f2)"
local newsOldTag="$(cat "$newsPath" 2> /dev/null)"
if [[ "$newsTag" != "$newsOldTag" ]]; then
dialog --yes-label 'Play' \
--no-label 'Later' \
--backtitle 'Audiogame Manager News' \
--yesno 'Audiogame manager news is available. Please use left and right arrows to navigate and enter to confirm.' -1 -1 || return
sox -qV0 "$newsFile" -d &> /dev/null
echo -n "$newsTag" > "$newsPath"
fi
}
# Automatic update function
update() {
local filePath="$(command -v ${0})"
@ -791,6 +809,8 @@ if ! command -v sox &> /dev/null ; then
echo "Please install sox before continuing."
exit 1
fi
# Get latest news if available
check_news
# With no arguments, open the game launcher.
if [[ $# -eq 0 ]]; then
game_launcher