mirror of
https://github.com/aclist/dztui.git
synced 2024-12-29 13:52:03 +01:00
fix: do not add entries to array twice (#68)
This commit is contained in:
parent
030d8efdf4
commit
673a917135
1 changed files with 8 additions and 11 deletions
19
dzgui.sh
19
dzgui.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
version=3.2.21
|
version=3.2.22
|
||||||
|
|
||||||
aid=221100
|
aid=221100
|
||||||
game="dayz"
|
game="dayz"
|
||||||
|
@ -130,6 +130,7 @@ set_api_params(){
|
||||||
first_entry=1
|
first_entry=1
|
||||||
}
|
}
|
||||||
query_api(){
|
query_api(){
|
||||||
|
echo "# Querying API"
|
||||||
#TODO: prevent drawing list if null values returned without API error
|
#TODO: prevent drawing list if null values returned without API error
|
||||||
if [[ $one_shot_launch -eq 1 ]]; then
|
if [[ $one_shot_launch -eq 1 ]]; then
|
||||||
list_of_ids="$fav"
|
list_of_ids="$fav"
|
||||||
|
@ -1190,15 +1191,12 @@ options_menu(){
|
||||||
}
|
}
|
||||||
query_and_connect(){
|
query_and_connect(){
|
||||||
[[ -z $whitelist ]] && { popup 600; return; }
|
[[ -z $whitelist ]] && { popup 600; return; }
|
||||||
query_api
|
q(){
|
||||||
parse_json
|
query_api
|
||||||
#TODO: create logger function
|
parse_json
|
||||||
if [[ ! $delete -eq 1 ]]; then
|
|
||||||
echo "[DZGUI] Checking response time of servers"
|
|
||||||
create_array | $steamsafe_zenity --width 500 --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null
|
|
||||||
else
|
|
||||||
create_array
|
create_array
|
||||||
fi
|
}
|
||||||
|
q | $steamsafe_zenity --width 500 --progress --pulsate --title="DZGUI" --auto-close 2>/dev/null
|
||||||
rc=$?
|
rc=$?
|
||||||
if [[ $rc -eq 1 ]]; then
|
if [[ $rc -eq 1 ]]; then
|
||||||
:
|
:
|
||||||
|
@ -1540,6 +1538,7 @@ page_through(){
|
||||||
parse_json
|
parse_json
|
||||||
}
|
}
|
||||||
parse_json(){
|
parse_json(){
|
||||||
|
echo "# Parsing servers"
|
||||||
page=$(echo "$list_response" | jq -r '.links.next?')
|
page=$(echo "$list_response" | jq -r '.links.next?')
|
||||||
if [[ $first_entry -eq 1 ]]; then
|
if [[ $first_entry -eq 1 ]]; then
|
||||||
local list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"')
|
local list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"')
|
||||||
|
@ -1547,8 +1546,6 @@ parse_json(){
|
||||||
first_entry=0
|
first_entry=0
|
||||||
fi
|
fi
|
||||||
if [[ "$page" != "null" ]]; then
|
if [[ "$page" != "null" ]]; then
|
||||||
local list=$(echo "$list_response" | jq -r '.data[] .attributes | "\(.name)\t\(.ip):\(.port)\t\(.players)/\(.maxPlayers)\t\(.details.time)\t\(.status)\t\(.id)"')
|
|
||||||
idarr+=("$list")
|
|
||||||
page_through
|
page_through
|
||||||
else
|
else
|
||||||
printf "%s\n" "${idarr[@]}" > $tmp
|
printf "%s\n" "${idarr[@]}" > $tmp
|
||||||
|
|
Loading…
Reference in a new issue