From 7cb9e100fe960ca17bfbdf6874515843b1a172be Mon Sep 17 00:00:00 2001 From: Spencer Hughes <16389711+spencerhughes@users.noreply.github.com> Date: Wed, 17 Nov 2021 09:21:25 -0500 Subject: [PATCH 1/2] Adds timed map regeneration option --- Dockerfile | 1 + entrypoint.sh | 38 +++++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8789272..45a9aa9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,7 @@ ENV RENDER_POI "true" ENV RENDER_SIGNS_FILTER "-- RENDER --" ENV RENDER_SIGNS_HIDE_FILTER "false" ENV RENDER_SIGNS_JOINER "
" +ENV REFRESH_DURATION 0 # ---------------------------- # # INSTALL & CONFIGURE DEFAULTS # diff --git a/entrypoint.sh b/entrypoint.sh index 1ac800d..8f6b36e 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,22 @@ #!/bin/bash set -o errexit +render_map() { + # Render the Map + if [ "$RENDER_MAP" == "true" ]; then + # (We disable to support passing multiple arguments) + # shellcheck disable=SC2086 + overviewer.py --config "$CONFIG_LOCATION" $ADDITIONAL_ARGS + fi + + # Render the POI + if [ "$RENDER_POI" == "true" ]; then + # (We disable to support passing multiple arguments) + # shellcheck disable=SC2086 + overviewer.py --config "$CONFIG_LOCATION" --genpoi $ADDITIONAL_ARGS_POI + fi +} + # Require MINECRAFT_VERSION environment variable to be set (no default assumed) if [ -z "$MINECRAFT_VERSION" ]; then echo "Expecting environment variable MINECRAFT_VERSION to be set to non-empty string. Exiting." @@ -30,16 +46,12 @@ else echo "Download complete." fi -# Render the Map -if [ "$RENDER_MAP" == "true" ]; then - # (We disable to support passing multiple arguments) - # shellcheck disable=SC2086 - overviewer.py --config "$CONFIG_LOCATION" $ADDITIONAL_ARGS -fi - -# Render the POI -if [ "$RENDER_POI" == "true" ]; then -# (We disable to support passing multiple arguments) - # shellcheck disable=SC2086 - overviewer.py --config "$CONFIG_LOCATION" --genpoi $ADDITIONAL_ARGS_POI -fi +# Render the map, either once if REFRESH_DURATION is 0, or every REFRESH_DURATION seconds +if [ $REFRESH_DURATION -gt 0 ]; then + while true; do + render_map + sleep $REFRESH_DURATION + done +else + render_map +fi \ No newline at end of file From 9ea6d4648822d0356883859d7abea7be954019b2 Mon Sep 17 00:00:00 2001 From: Spencer Hughes <16389711+spencerhughes@users.noreply.github.com> Date: Wed, 17 Nov 2021 12:03:41 -0500 Subject: [PATCH 2/2] Adds documentation for regeneration timer option --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f263838..bec88a4 100644 --- a/README.md +++ b/README.md @@ -57,3 +57,5 @@ _Note:_ The `latest` Docker tag is rebuilt daily. If there are changes to the [u - `RENDER_SIGNS_JOINER` Default Value: `
`. Set to the string that should be used to join the lines on the sign while rendering. Value of `"
"` will make each in-game line it's own line on the render. A value of `" "` will make all the in-game lines a single line on the render. +- `REFRESH_DURATION` + Default Value: `0`. Set to a number to regenerate the map every `REFRESH_DURATION` seconds. Disabled if set to `0`. \ No newline at end of file