1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2024-12-29 13:52:03 +01:00

Add watcher process

This commit is contained in:
aclist 2022-10-08 20:04:49 +09:00
parent 8c7ab958a5
commit 98f2e7e809

111
dzgui.sh
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -o pipefail set -o pipefail
version=2.8.0-rc.17 version=2.8.0-rc.18
aid=221100 aid=221100
game="dayz" game="dayz"
@ -344,21 +344,21 @@ open_mod_links(){
browser "$link_file" 2>/dev/null & browser "$link_file" 2>/dev/null &
} }
steam_deck_mods(){ #steam_deck_mods(){
until [[ -z $diff ]]; do # until [[ -z $diff ]]; do
next=$(echo -e "$diff" | head -n1) # next=$(echo -e "$diff" | head -n1)
zenity --question --ok-label="Open" --cancel-label="Cancel" --title="DZGUI" --text="Missing mods. Click [Open] to open mod $next in Steam Workshop and subscribe to it by clicking the green Subscribe button. After the mod is downloaded, return to this menu to continue validation." --width=500 2>/dev/null # zenity --question --ok-label="Open" --cancel-label="Cancel" --title="DZGUI" --text="Missing mods. Click [Open] to open mod $next in Steam Workshop and subscribe to it by clicking the green Subscribe button. After the mod is downloaded, return to this menu to continue validation." --width=500 2>/dev/null
rc=$? # rc=$?
if [[ $rc -eq 0 ]]; then # if [[ $rc -eq 0 ]]; then
echo "[DZGUI] Opening ${workshop}$next" # echo "[DZGUI] Opening ${workshop}$next"
steam steam://url/CommunityFilePage/$next 2>/dev/null & # steam steam://url/CommunityFilePage/$next 2>/dev/null &
zenity --info --title="DZGUI" --ok-label="Next" --text="Click [Next] to continue mod check." --width=500 2>/dev/null # zenity --info --title="DZGUI" --ok-label="Next" --text="Click [Next] to continue mod check." --width=500 2>/dev/null
else # else
return 1 # return 1
fi # fi
compare # compare
done # done
} #}
set_term(){ set_term(){
local term="$1" local term="$1"
local tterm="term=\"$term\"" local tterm="term=\"$term\""
@ -405,8 +405,6 @@ auto_mod_install(){
echo "[DZGUI] Kicking off auto mod script" echo "[DZGUI] Kicking off auto mod script"
calc_mod_sizes calc_mod_sizes
term_params "$cmd" term_params "$cmd"
#$term -e bash -c "/$helpers_path/scmd.sh $totalmodsize $cmd"
# $term -e "bash $helpers_path/scmd.sh $totalmodsize $cmd"
compare compare
if [[ -z $diff ]]; then if [[ -z $diff ]]; then
passed_mod_check > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null) passed_mod_check > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
@ -417,36 +415,63 @@ auto_mod_install(){
fi fi
} }
manual_mod_install(){ manual_mod_install(){
l=0 local ex="/tmp/dzc.tmp"
# for i in "$diff"; do [[ -f $ex ]] && rm $ex
# workshop_dir="$steam_path/steamapps/workshop/content/$aid" watcher(){
# steam "steam://url/CommunityFilePage/$i" readarray -t stage_mods <<< "$diff"
# until [[ -d $workshop_dir/$i ]]; do for((i=0;i<${#stage_mods[@]};i++)); do
# sleep 0.1s [[ -f $ex ]] && return 1
# done local downloads_dir="$steam_path/steamapps/workshop/downloads/$aid"
# done local workshop_dir="$steam_path/steamapps/workshop/content/$aid"
# compare steam "steam://url/CommunityFilePage/${stage_mods[$i]}"
# [[ -z $diff ]] && passed_mod_check > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null) echo "# Opening workshop page for ${stage_mods[$i]}. If you see no progress after subscribing, try unsubscribing and resubscribing again until the download commences."
sleep 1s
if [[ $is_steam_deck -eq 0 ]]; then wmctrl -a "DZG Watcher"
open_mod_links until [[ -d $downloads_dir/${stage_mods[$i]} ]]; do
until [[ -z $diff ]]; do [[ -f $ex ]] && return 1
zenity --question --title="DZGUI" --ok-label="Next" --cancel-label="Cancel" --text="Opened mod links in browser.\nClick [Next] when all mods have been subscribed to.\nThis dialog may reappear if clicking [Next] too soon\nbefore mods are synchronized in the background." --width=500 2>/dev/null sleep 0.1s
rc=$? if [[ -d $workshop_dir/${stage_mods[$i]} ]]; then
if [[ $rc -eq 0 ]]; then break
compare
open_mod_links
else
return
fi fi
done done
wmctrl -a "DZG Watcher"
echo "# Steam is downloading ${stage_mods[$i]} (mod $((i+1)) of ${#stage_mods[@]})"
until [[ -d $workshop_dir/${stage_mods[$i]} ]]; do
[[ -f $ex ]] && return 1
sleep 0.1s
done
wmctrl -a "DZG Watcher"
echo "# ${stage_mods[$i]} moved to mods dir"
done
echo "100"
}
watcher > >(zenity --pulsate --progress --auto-close --title="DZG Watcher" --width=500 2>/dev/null; rc=$?; [[ $rc -eq 1 ]] && touch $ex)
compare
if [[ -z $diff ]]; then
passed_mod_check > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
launch
else else
steam_deck_mods return 1
rc=$?
[[ $rc -eq 1 ]] && return 1
fi fi
passed_mod_check > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
} }
# if [[ $is_steam_deck -eq 0 ]]; then
# open_mod_links
# until [[ -z $diff ]]; do
# zenity --question --title="DZGUI" --ok-label="Next" --cancel-label="Cancel" --text="Opened mod links in browser.\nClick [Next] when all mods have been subscribed to.\nThis dialog may reappear if clicking [Next] too soon\nbefore mods are synchronized in the background." --width=500 2>/dev/null
# rc=$?
# if [[ $rc -eq 0 ]]; then
# compare
# open_mod_links
# else
# return
# fi
# done
# else
# steam_deck_mods
# rc=$?
# [[ $rc -eq 1 ]] && return 1
# fi
# passed_mod_check > >(zenity --pulsate --progress --auto-close --width=500 2>/dev/null)
encode(){ encode(){
echo "$1" | md5sum | cut -c -8 echo "$1" | md5sum | cut -c -8
} }