mirror of
https://github.com/aclist/dztui.git
synced 2024-12-29 13:52:03 +01:00
fix: automod WIP
This commit is contained in:
parent
8effa44a08
commit
04cb132219
3 changed files with 25 additions and 26 deletions
6
dzgui.sh
6
dzgui.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
version=5.0.0.rc-28
|
version=5.0.0.rc-29
|
||||||
|
|
||||||
#CONSTANTS
|
#CONSTANTS
|
||||||
aid=221100
|
aid=221100
|
||||||
|
@ -536,10 +536,10 @@ fetch_dzq(){
|
||||||
fetch_helpers_by_sum(){
|
fetch_helpers_by_sum(){
|
||||||
declare -A sums
|
declare -A sums
|
||||||
sums=(
|
sums=(
|
||||||
["ui.py"]="9b6c643d096c5b2e677b4eb17ec09750"
|
["ui.py"]="12fac5997612367c0716f8575046ac6d"
|
||||||
["query_v2.py"]="1822bd1769ce7d7cb0d686a60f9fa197"
|
["query_v2.py"]="1822bd1769ce7d7cb0d686a60f9fa197"
|
||||||
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
|
||||||
["funcs"]="bd5dbe82a840a25704b899e62aab0c5b"
|
["funcs"]="d2afc23090f4f1e670ac8eb1a5412579"
|
||||||
)
|
)
|
||||||
local author="aclist"
|
local author="aclist"
|
||||||
local repo="dztui"
|
local repo="dztui"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
version=5.0.0.rc-28
|
version=5.0.0.rc-29
|
||||||
|
|
||||||
#CONSTANTS
|
#CONSTANTS
|
||||||
aid=221100
|
aid=221100
|
||||||
|
@ -161,15 +161,6 @@ validate_and_connect(){
|
||||||
esac
|
esac
|
||||||
try_connect "$record"
|
try_connect "$record"
|
||||||
}
|
}
|
||||||
force_update(){
|
|
||||||
if [[ ! $auto_install -eq 1 ]]; then
|
|
||||||
printf "Only available when mod auto-install is ON"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
#TODO: force update
|
|
||||||
printf "Currently does nothing"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
map_id_to_ip(){
|
map_id_to_ip(){
|
||||||
local id="$1"
|
local id="$1"
|
||||||
local res=$(curl -s "$bm_api" -H "Authorization: Bearer "$api_key"" \
|
local res=$(curl -s "$bm_api" -H "Authorization: Bearer "$api_key"" \
|
||||||
|
@ -1084,12 +1075,13 @@ auto_mod_install(){
|
||||||
$steam_cmd steam://open/downloads
|
$steam_cmd steam://open/downloads
|
||||||
|
|
||||||
local total=$(<<< "$diff" wc -l)
|
local total=$(<<< "$diff" wc -l)
|
||||||
until [[ -z $(compare $diff) ]]; do
|
until [[ -z $(compare "$diff") ]]; do
|
||||||
local missing=$(compare $diff | wc -l)
|
local missing=$(compare "$diff" | wc -l)
|
||||||
echo "# Downloaded $(($total-missing)) of $total mods. ESC cancels"
|
echo "# Downloaded $(($total-missing)) of $total mods. ESC cancels"
|
||||||
done | $steamsafe_zenity --pulsate --progress --title="DZG Watcher" --auto-close --no-cancel --width=500 2>/dev/null
|
done | $steamsafe_zenity --pulsate --progress --title="DZG Watcher" --auto-close --no-cancel --width=500 2>/dev/null
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
exit 7
|
echo "User canceled connect process. Steam may have mods pending for download."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local diff=$(compare "$sanitized_mods")
|
local diff=$(compare "$sanitized_mods")
|
||||||
|
@ -1103,10 +1095,15 @@ auto_mod_install(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
force_update(){
|
force_update(){
|
||||||
|
if [[ ! $auto_install -eq 1 ]]; then
|
||||||
|
printf "Only available when mod auto-install is ON"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
rm "$versions_file"
|
rm "$versions_file"
|
||||||
local update=$(check_timestamps)
|
local update=$(check_timestamps)
|
||||||
console_dl "$update" &&
|
console_dl "$update" &&
|
||||||
$steam_cmd steam://open/downloads
|
$steam_cmd steam://open/downloads
|
||||||
|
return 8
|
||||||
}
|
}
|
||||||
console_dl(){
|
console_dl(){
|
||||||
readarray -t modids <<< "$@"
|
readarray -t modids <<< "$@"
|
||||||
|
@ -1157,21 +1154,21 @@ check_timestamps(){
|
||||||
local aligned=$(<<< "$local_stamps" jq -r '.response.publishedfiledetails[]|"\(.publishedfileid),\(.time_updated)"')
|
local aligned=$(<<< "$local_stamps" jq -r '.response.publishedfiledetails[]|"\(.publishedfileid),\(.time_updated)"')
|
||||||
readarray -t remote_ids < <(<<< "$aligned" awk -F, '{print $1}')
|
readarray -t remote_ids < <(<<< "$aligned" awk -F, '{print $1}')
|
||||||
readarray -t remote_times < <(<<< "$aligned" awk -F, '{print $2}')
|
readarray -t remote_times < <(<<< "$aligned" awk -F, '{print $2}')
|
||||||
readarray -t old_ids < <(< $versions_file awk -F, '{print 1}')
|
readarray -t old_ids < <(< $versions_file awk -F, '{print $1}')
|
||||||
readarray -t old_times < <(< $versions_file awk -F, '{print 2}')
|
readarray -t old_times < <(< $versions_file awk -F, '{print $2}')
|
||||||
|
|
||||||
if [[ ! -f $versions_file ]]; then
|
if [[ ! -f $versions_file ]]; then
|
||||||
logger INFO "No prior versions file found, creating"
|
logger INFO "No prior versions file found, creating"
|
||||||
update_stamps "$aligned"
|
update_stamps "$aligned"
|
||||||
#force refresh all mods if versions file was missing
|
#force refresh all mods if versions file was missing
|
||||||
printf "%s\n" "${old_ids[$@]}"
|
printf "%s\n" "${remote_ids[$@]}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -A remote_version
|
declare -A remote_version
|
||||||
declare -A local_version
|
declare -A local_version
|
||||||
|
|
||||||
for((i = 0; i < ${remote_ids[@]}; ++i)); do
|
for((i = 0; i < ${#remote_ids[@]}; ++i)); do
|
||||||
remote_version[${remote_ids[$i]}]=${remote_times[$i]}
|
remote_version[${remote_ids[$i]}]=${remote_times[$i]}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -1184,7 +1181,7 @@ check_timestamps(){
|
||||||
needs_update+=($id)
|
needs_update+=($id)
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "${needs_update[@]}"
|
printf "%s\n" "${needs_update[@]}"
|
||||||
}
|
}
|
||||||
merge_modlists(){
|
merge_modlists(){
|
||||||
local diff="$1"
|
local diff="$1"
|
||||||
|
@ -1196,7 +1193,8 @@ merge_modlists(){
|
||||||
if [[ -z "$diff" ]] && [[ ${#needs_update[@]} -gt 0 ]]; then
|
if [[ -z "$diff" ]] && [[ ${#needs_update[@]} -gt 0 ]]; then
|
||||||
printf "%s\n" "${needs_update[@]}"
|
printf "%s\n" "${needs_update[@]}"
|
||||||
else
|
else
|
||||||
printf "%s\n%s\n" "$diff" "${needs_update[@]}"
|
printf "%s\n" "$diff"
|
||||||
|
printf "%s\n" "${needs_update[@]}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
concat_mods(){
|
concat_mods(){
|
||||||
|
|
|
@ -16,7 +16,7 @@ locale.setlocale(locale.LC_ALL, '')
|
||||||
gi.require_version("Gtk", "3.0")
|
gi.require_version("Gtk", "3.0")
|
||||||
from gi.repository import Gtk, GLib, Gdk, GObject, Pango
|
from gi.repository import Gtk, GLib, Gdk, GObject, Pango
|
||||||
|
|
||||||
# 5.0.0-rc.28
|
# 5.0.0-rc.29
|
||||||
app_name = "DZGUI"
|
app_name = "DZGUI"
|
||||||
|
|
||||||
cache = {}
|
cache = {}
|
||||||
|
@ -309,10 +309,11 @@ def process_shell_return_code(transient_parent, msg, code, original_input):
|
||||||
# return silently
|
# return silently
|
||||||
pass
|
pass
|
||||||
case 7:
|
case 7:
|
||||||
# catch zenity dialog cancel and rewrite message
|
msg = "Some mods may have failed to download. Try connecting again to resync."
|
||||||
msg = "User canceled connect process. Steam may have mods pending for download."
|
spawn_dialog(transient_parent, msg, "NOTIFY")
|
||||||
|
case 8:
|
||||||
|
msg = "Finished requesting mod updates. Steam may have mods pending for download."
|
||||||
spawn_dialog(transient_parent, msg, "NOTIFY")
|
spawn_dialog(transient_parent, msg, "NOTIFY")
|
||||||
|
|
||||||
case 90:
|
case 90:
|
||||||
# used to update configs and metadata in-place
|
# used to update configs and metadata in-place
|
||||||
treeview = transient_parent.grid.scrollable_treelist.treeview
|
treeview = transient_parent.grid.scrollable_treelist.treeview
|
||||||
|
|
Loading…
Reference in a new issue