Some newline logging stuff

This commit is contained in:
2026-02-28 00:52:06 -06:00
parent ca02357b38
commit da4857234d

View File

@@ -2,7 +2,7 @@
#shellcheck shell=dash #shellcheck shell=dash
# #
event_data=$(cat /tmp/es_state.inf) event_data=$(cat /tmp/es_state.inf | tr -d '\r' )
REMOTE_BASE="saves:gamepi-tv" REMOTE_BASE="saves:gamepi-tv"
PIPE="/tmp/savesync_pipe" PIPE="/tmp/savesync_pipe"
@@ -14,11 +14,12 @@ log() {
printf "LOG:[%s] %s\n" "$1" "$2" >"$PIPE" printf "LOG:[%s] %s\n" "$1" "$2" >"$PIPE"
} }
log "INFO" "Starting based on event" log "INFO" "Starting based on event: $(echo "$event_data" | tr '\n' ',')"
## Iterate over the data ## Iterate over the data
echo "$event_data" | while IFS='=' read -r key val; do echo "$event_data" | while IFS='=' read -r k v; do
# Split each pair into key and value using '=' as the delimiter key=$(echo "$k" | tr -d '\n')
val=$(echo "$v" | tr -d '\n')
# set variables and run functions based on the pairs # set variables and run functions based on the pairs
case "$key" in case "$key" in
@@ -40,7 +41,6 @@ echo "$event_data" | while IFS='=' read -r key val; do
st="$val" st="$val"
log "DEBUG" "Setting st=$st" log "DEBUG" "Setting st=$st"
log "DEBUG" "Starting logic tree" log "DEBUG" "Starting logic tree"
if [ "$st" = "playing" ] && [ "$act" = "rungame" ]; then if [ "$st" = "playing" ] && [ "$act" = "rungame" ]; then
log "INFO" "Sync START: $(basename "$gp")" log "INFO" "Sync START: $(basename "$gp")"
remote_f="$REMOTE_BASE/$sid/$(basename "$sp")" remote_f="$REMOTE_BASE/$sid/$(basename "$sp")"