1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2025-01-01 15:12:05 +01:00

fix: automod, wrapping

This commit is contained in:
aclist 2024-01-24 15:14:47 +09:00
parent 7d66ffe418
commit 8effa44a08
3 changed files with 24 additions and 14 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -o pipefail set -o pipefail
version=5.0.0.rc-27 version=5.0.0.rc-28
#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"]="ce3940391b9c7e80eb7af190e40fae41" ["ui.py"]="9b6c643d096c5b2e677b4eb17ec09750"
["query_v2.py"]="1822bd1769ce7d7cb0d686a60f9fa197" ["query_v2.py"]="1822bd1769ce7d7cb0d686a60f9fa197"
["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397"
["funcs"]="ded1276c0555577cc03cc36e9381a373" ["funcs"]="bd5dbe82a840a25704b899e62aab0c5b"
) )
local author="aclist" local author="aclist"
local repo="dztui" local repo="dztui"

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -o pipefail set -o pipefail
version=5.0.0.rc-27 version=5.0.0.rc-28
#CONSTANTS #CONSTANTS
aid=221100 aid=221100
@ -1071,8 +1071,8 @@ focus_beta_client(){
xdotool mousemove $dim1 $dim2 xdotool mousemove $dim1 $dim2
xdotool click 1 xdotool click 1
sleep 0.5s $steam_cmd steam://open/library 2>/dev/null 1>&2 &&
xdotool key Tab $steam_cmd steam://open/console 2>/dev/null 1>&2
} }
auto_mod_install(){ auto_mod_install(){
local ip="$1" local ip="$1"
@ -1083,10 +1083,14 @@ auto_mod_install(){
console_dl "$diff" && console_dl "$diff" &&
$steam_cmd steam://open/downloads $steam_cmd steam://open/downloads
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 $((${#modids[@]}-missing)) of ${#modids[@]} 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
exit 7
fi
local diff=$(compare "$sanitized_mods") local diff=$(compare "$sanitized_mods")
@ -1116,11 +1120,11 @@ console_dl(){
done done
} }
get_local_stamps(){ get_local_stamps(){
local modlist="$1" readarray -t modlist < <(printf "%s\n" "$@")
local max="${#modlist[@]}" local max="${#modlist[@]}"
_concat(){ _concat(){
for ((i=0;i<$max;i++)); do for ((i=0;i<$max;i++)); do
echo "publishedfileids[$i]=${modlist[$i]}&" printf "publishedfileids[$i]=${modlist[$i]}&"
done | awk '{print}' ORS='' done | awk '{print}' ORS=''
} }
_payload(){ _payload(){
@ -1135,7 +1139,7 @@ get_local_stamps(){
_post _post
} }
update_stamps(){ update_stamps(){
readarray stamps <<< "$1" readarray -t stamps <<< "$1"
for((i=0;i<${#stamps[@]};i++)); do for((i=0;i<${#stamps[@]};i++)); do
printf "%s\n" "${stamps[$i]}" >> $versions_file printf "%s\n" "${stamps[$i]}" >> $versions_file
done done
@ -1153,8 +1157,8 @@ 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 < <(< $version_file awk -F, '{print 1}') readarray -t old_ids < <(< $versions_file awk -F, '{print 1}')
readarray -t old_times < <(< $version_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"

View file

@ -8,6 +8,7 @@ import multiprocessing
import re import re
import subprocess import subprocess
import sys import sys
import textwrap
import threading import threading
import time import time
@ -15,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.27 # 5.0.0-rc.28
app_name = "DZGUI" app_name = "DZGUI"
cache = {} cache = {}
@ -307,6 +308,11 @@ def process_shell_return_code(transient_parent, msg, code, original_input):
case 6: case 6:
# return silently # return silently
pass pass
case 7:
# catch zenity dialog cancel and rewrite message
msg = "User canceled connect process. Steam may have mods pending for download."
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
@ -1198,7 +1204,7 @@ class GenericDialog(Gtk.MessageDialog):
flags=0, flags=0,
message_type=dialog_type, message_type=dialog_type,
text=header_text, text=header_text,
secondary_text=text, secondary_text=textwrap.fill(text, 50),
buttons=button_type, buttons=button_type,
title=app_name, title=app_name,
modal=True, modal=True,