Commit 62f1dcf4 authored by Mikhail Tergoev's avatar Mikhail Tergoev

Merge branch 'pw_start_progress_bar_block' of github.com:Boria138/PortWINE into…

Merge branch 'pw_start_progress_bar_block' of github.com:Boria138/PortWINE into Boria138-pw_start_progress_bar_block
parents c0afbc3a cb09d698
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
msgid "" msgid ""
msgstr "Project-Id-Version: PACKAGE VERSION\n" msgstr "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-23 14:40+0300\n" "POT-Creation-Date: 2024-10-24 12:43+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -1582,8 +1582,8 @@ msgid "MIT License\n" ...@@ -1582,8 +1582,8 @@ msgid "MIT License\n"
"\n" "\n"
"Permission is hereby granted, free of charge, to any person " "Permission is hereby granted, free of charge, to any person "
"obtaining a copy\n" "obtaining a copy\n"
"of this software and associated documentation files (the \"Software" "of this software and associated documentation files (the "
"\"), to deal\n" "\"Software\"), to deal\n"
"in the Software without restriction, including without limitation " "in the Software without restriction, including without limitation "
"the rights\n" "the rights\n"
"to use, copy, modify, merge, publish, distribute, sublicense, and/or " "to use, copy, modify, merge, publish, distribute, sublicense, and/or "
...@@ -1665,3 +1665,9 @@ msgstr "" ...@@ -1665,3 +1665,9 @@ msgstr ""
msgid "THIRD PARTY LIBRARIES" msgid "THIRD PARTY LIBRARIES"
msgstr "" msgstr ""
msgid "SteamGridDB is not responding, forcing cover download to be disabled"
msgstr ""
msgid "Please wait. downloading covers for"
msgstr ""
...@@ -7,17 +7,17 @@ msgid "" ...@@ -7,17 +7,17 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-23 14:40+0300\n" "POT-Creation-Date: 2024-10-24 12:43+0500\n"
"PO-Revision-Date: 2024-10-23 14:43+0300\n" "PO-Revision-Date: 2024-10-24 12:45+0500\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: ru_RU\n" "Language: ru_RU\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" "n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
"X-Generator: Poedit 3.5\n" "X-Generator: Poedit 3.4.2\n"
msgid "" msgid ""
"A running PortProton session was detected.\\nDo you want to end the previous " "A running PortProton session was detected.\\nDo you want to end the previous "
...@@ -2151,6 +2151,12 @@ msgstr "ПРИСОЕДЕНИТЬСЯ" ...@@ -2151,6 +2151,12 @@ msgstr "ПРИСОЕДЕНИТЬСЯ"
msgid "THIRD PARTY LIBRARIES" msgid "THIRD PARTY LIBRARIES"
msgstr "БИБЛИОТЕКИ" msgstr "БИБЛИОТЕКИ"
msgid "SteamGridDB is not responding, forcing cover download to be disabled"
msgstr "SteamGridDB не отвечает, принудительно отключаем загрузку обложек"
msgid "Please wait. downloading covers for"
msgstr "Пожалуйста, подождите. Загрузка обложек для"
#~ msgid "Forced activation of vertical sync" #~ msgid "Forced activation of vertical sync"
#~ msgstr "Принудительное включение вертикальной синхронизации" #~ msgstr "Принудительное включение вертикальной синхронизации"
......
...@@ -35,6 +35,29 @@ function generateShortcutVDFAppId { ...@@ -35,6 +35,29 @@ function generateShortcutVDFAppId {
echo "-$(( 16#${seed} % 1000000000 ))" echo "-$(( 16#${seed} % 1000000000 ))"
} }
function pw_start_progress_bar_block () {
"${pw_yad}" --progress-old --text="$@" --pulsate --hide-text --borders="$PROGRESS_BAR_BORDERS_SIZE" \
--no-buttons --undecorated --skip-taskbar --no-escape --text-align="center" --height=90 --fixed \
--width="$PROGRESS_BAR_WIDTH_SIZE" --wrap-width="$PROGRESS_BAR_WIDTH_SIZE" \
--window-icon="$PW_GUI_ICON_PATH/portproton.svg" &>/dev/null &
export PW_YAD_PID_PROGRESS_BAR_BLOCK="$!"
return 0
}
function pw_stop_progress_bar () {
sleep 0.1
for PW_KILL_YAD_PID in "$PW_YAD_PID_PROGRESS_BAR_BLOCK" "$PW_YAD_PID_PROGRESS_BAR_CS" \
"$PW_YAD_PID_PFX_COVER_UI" "$PW_YAD_PID_PROGRESS_BAR_COVER"
do
kill -s SIGUSR1 "$PW_KILL_YAD_PID" &>/dev/null
done
unset PW_YAD_PID_PROGRESS_BAR_BLOCK PW_YAD_PID_PROGRESS_BAR_CS \
PW_YAD_PID_PFX_COVER_UI PW_YAD_PID_PROGRESS_BAR_COVER
return 0
}
function dec2hex { function dec2hex {
printf '%x\n' "$1" | cut -c 9- # cut removes the 'ffffffff' from the string (represents the sign) and starts from the 9th character printf '%x\n' "$1" | cut -c 9- # cut removes the 'ffffffff' from the string (represents the sign) and starts from the 9th character
} }
...@@ -150,16 +173,6 @@ function downloadArtFromSteamGridDB { ...@@ -150,16 +173,6 @@ function downloadArtFromSteamGridDB {
[[ -n "$SEARCHHUMOR" ]] && SGDB_ENDPOINT_STR+="&humor=${SEARCHHUMOR}" [[ -n "$SEARCHHUMOR" ]] && SGDB_ENDPOINT_STR+="&humor=${SEARCHHUMOR}"
[[ -n "$SEARCHEPILEPSY" ]] && SGDB_ENDPOINT_STR+="&epilepsy=${SEARCHEPILEPSY}" [[ -n "$SEARCHEPILEPSY" ]] && SGDB_ENDPOINT_STR+="&epilepsy=${SEARCHEPILEPSY}"
set -o pipefail
RESPONSE=$(curl -H "Authorization: Bearer $SGDBAPIKEY" -s "$SGDB_ENDPOINT_STR" 2> >(grep -v "SSL_INIT"))
if [[ "${PIPESTATUS[0]}" != 0 ]] && [[ "$DOWNLOAD_STEAM_GRID" != 0 ]] ; then
pw_notify_send -i info \
"$(gettext "SteamGridDB is not response, force disable cover download")"
sed -i 's/DOWNLOAD_STEAM_GRID=.*/DOWNLOAD_STEAM_GRID="0"/' "$USER_CONF"
export DOWNLOAD_STEAM_GRID="0"
return
fi
if ! jq -e '.success' <<< "$RESPONSE" > /dev/null; then if ! jq -e '.success' <<< "$RESPONSE" > /dev/null; then
echo "The server response wasn't 'success' for this batch of requested games." echo "The server response wasn't 'success' for this batch of requested games."
...@@ -204,12 +217,7 @@ function downloadArtFromSteamGridDB { ...@@ -204,12 +217,7 @@ function downloadArtFromSteamGridDB {
fi fi
if [[ "$STARTDL" -eq 1 ]] ; then if [[ "$STARTDL" -eq 1 ]] ; then
filename="$(basename "$DLDST")" curl -f -# -A 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)' -H 'Cache-Control: no-cache, no-store' -H 'Pragma: no-cache' -L "$DLSRC" -o "$DLDST"
curl -f -# -A 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)' -H 'Cache-Control: no-cache, no-store' -H 'Pragma: no-cache' -L "$DLSRC" -o "$DLDST" 2>&1 | \
tr '\r' '\n' | sed -ur 's|[# ]+||g;s|.*=.*||g;s|.*|#Downloading at &\n&|g' | \
"$pw_yad" --progress --text="$(gettext "Downloading") $filename" --auto-close --no-escape \
--auto-kill --text-align="center" --fixed --no-buttons --title "PortProton" --width=500 --height=90 \
--window-icon="$PW_GUI_ICON_PATH/portproton.svg" --borders="$PROGRESS_BAR_BORDERS_SIZE"
fi fi
else else
echo "No grid found to download for '$SEARCHID' - maybe loosen filters?" echo "No grid found to download for '$SEARCHID' - maybe loosen filters?"
...@@ -295,15 +303,29 @@ function commandlineGetSteamGridDBArtwork { ...@@ -295,15 +303,29 @@ function commandlineGetSteamGridDBArtwork {
SGDBSEARCHENDPOINT_HERO="${BASESTEAMGRIDDBAPI}/heroes/${SGDBENDPOINTTYPE}" SGDBSEARCHENDPOINT_HERO="${BASESTEAMGRIDDBAPI}/heroes/${SGDBENDPOINTTYPE}"
SGDBSEARCHENDPOINT_LOGO="${BASESTEAMGRIDDBAPI}/logos/${SGDBENDPOINTTYPE}" SGDBSEARCHENDPOINT_LOGO="${BASESTEAMGRIDDBAPI}/logos/${SGDBENDPOINTTYPE}"
SGDBSEARCHENDPOINT_BOXART="${BASESTEAMGRIDDBAPI}/grids/${SGDBENDPOINTTYPE}" # Grid endpoint is used for Boxart and Tenfoot, which SteamGridDB counts as vertical/horizontal grids respectively SGDBSEARCHENDPOINT_BOXART="${BASESTEAMGRIDDBAPI}/grids/${SGDBENDPOINTTYPE}" # Grid endpoint is used for Boxart and Tenfoot, which SteamGridDB counts as vertical/horizontal grids respectively
SGDB_ENDPOINT_STR="${SGDBSEARCHENDPOINT_HERO}/$(echo "$GSGDBA_APPID" | awk '{print $1}' | paste -s -d, -)?"
set -o pipefail
# Download Hero, Logo, Boxart, Tenfoot from SteamGridDB from given endpoint using given AppID RESPONSE=$(curl -H "Authorization: Bearer $SGDBAPIKEY" -s "$SGDB_ENDPOINT_STR" 2> >(grep -v "SSL_INIT"))
# On SteamGridDB tenfoot called horizontal Steam grid, so fetch it by passing specific dimensions matching this -- Users can override this, but default is what SteamGridDB expects for the tenfoot sizes if [[ "${PIPESTATUS[0]}" != 0 ]] && [[ "$DOWNLOAD_STEAM_GRID" != 0 ]]; then
downloadArtFromSteamGridDB "$GSGDBA_APPID" "$SGDBSEARCHENDPOINT_HERO" "${GSGDBA_FILENAME}_hero" "$SGDBHEROSTYLES" "$SGDBHERODIMS" "$SGDBHEROTYPES" "$SGDBHERONSFW" "$SGDBHEROHUMOR" "$SGDBHEROEPILEPSY" "$GSGDBA_HASFILE" "$GSGDBA_APPLYARTWORK" pw_notify_send -i info \
# Logo doesn't have dimensions, so it's left intentionally blank "${translations[SteamGridDB is not responding, forcing cover download to be disabled]}"
downloadArtFromSteamGridDB "$GSGDBA_APPID" "$SGDBSEARCHENDPOINT_LOGO" "${GSGDBA_FILENAME}_logo" "$SGDBLOGOSTYLES" "" "$SGDBLOGOTYPES" "$SGDBLOGONSFW" "$SGDBLOGOHUMOR" "$SGDBLOGOEPILEPSY" "$GSGDBA_HASFILE" "$GSGDBA_APPLYARTWORK" sed -i 's/DOWNLOAD_STEAM_GRID=.*/DOWNLOAD_STEAM_GRID="0"/' "$USER_CONF"
downloadArtFromSteamGridDB "$GSGDBA_APPID" "$SGDBSEARCHENDPOINT_BOXART" "${GSGDBA_FILENAME}p" "$SGDBBOXARTSTYLES" "$SGDBBOXARTDIMS" "$SGDBBOXARTTYPES" "$SGDBBOXARTNSFW" "$SGDBBOXARTHUMOR" "$SGDBBOXARTEPILEPSY" "$GSGDBA_HASFILE" "$GSGDBA_APPLYARTWORK" export DOWNLOAD_STEAM_GRID="0"
downloadArtFromSteamGridDB "$GSGDBA_APPID" "$SGDBSEARCHENDPOINT_BOXART" "${GSGDBA_FILENAME}" "$SGDBTENFOOTSTYLES" "$SGDBTENFOOTDIMS" "$SGDBTENFOOTTYPES" "$SGDBTENFOOTNSFW" "$SGDBTENFOOTHUMOR" "$SGDBTENFOOTEPILEPSY" "$GSGDBA_HASFILE" "$GSGDBA_APPLYARTWORK" return
fi
if [[ ! -z "$GSGDBA_FOUNDGAMEID" ]] ; then
pw_start_progress_bar_block "${translations[Please wait. downloading covers for]} $NOSTAPPNAME"
# Download Hero, Logo, Boxart, Tenfoot from SteamGridDB from given endpoint using given AppID
# On SteamGridDB tenfoot called horizontal Steam grid, so fetch it by passing specific dimensions matching this -- Users can override this, but default is what SteamGridDB expects for the tenfoot sizes
downloadArtFromSteamGridDB "$GSGDBA_APPID" "$SGDBSEARCHENDPOINT_HERO" "${GSGDBA_FILENAME}_hero" "$SGDBHEROSTYLES" "$SGDBHERODIMS" "$SGDBHEROTYPES" "$SGDBHERONSFW" "$SGDBHEROHUMOR" "$SGDBHEROEPILEPSY" "$GSGDBA_HASFILE" "$GSGDBA_APPLYARTWORK"
# Logo doesn't have dimensions, so it's left intentionally blank
downloadArtFromSteamGridDB "$GSGDBA_APPID" "$SGDBSEARCHENDPOINT_LOGO" "${GSGDBA_FILENAME}_logo" "$SGDBLOGOSTYLES" "" "$SGDBLOGOTYPES" "$SGDBLOGONSFW" "$SGDBLOGOHUMOR" "$SGDBLOGOEPILEPSY" "$GSGDBA_HASFILE" "$GSGDBA_APPLYARTWORK"
downloadArtFromSteamGridDB "$GSGDBA_APPID" "$SGDBSEARCHENDPOINT_BOXART" "${GSGDBA_FILENAME}p" "$SGDBBOXARTSTYLES" "$SGDBBOXARTDIMS" "$SGDBBOXARTTYPES" "$SGDBBOXARTNSFW" "$SGDBBOXARTHUMOR" "$SGDBBOXARTEPILEPSY" "$GSGDBA_HASFILE" "$GSGDBA_APPLYARTWORK"
downloadArtFromSteamGridDB "$GSGDBA_APPID" "$SGDBSEARCHENDPOINT_BOXART" "${GSGDBA_FILENAME}" "$SGDBTENFOOTSTYLES" "$SGDBTENFOOTDIMS" "$SGDBTENFOOTTYPES" "$SGDBTENFOOTNSFW" "$SGDBTENFOOTHUMOR" "$SGDBTENFOOTEPILEPSY" "$GSGDBA_HASFILE" "$GSGDBA_APPLYARTWORK"
pw_stop_progress_bar
fi
} }
## Fetch artwork from SteamGridDB ## Fetch artwork from SteamGridDB
......
...@@ -186,6 +186,10 @@ generate_pot () { ...@@ -186,6 +186,10 @@ generate_pot () {
sed -i 's/]}/")/g' setup.sh_tmp sed -i 's/]}/")/g' setup.sh_tmp
sed -i 's/eval_translations/gettext/g' setup.sh_tmp sed -i 's/eval_translations/gettext/g' setup.sh_tmp
sed 's/{translations\[/(gettext \"/g' add_in_steam.sh > add_in_steam.sh_tmp
sed -i 's/]}/")/g' add_in_steam.sh_tmp
sed -i 's/eval_translations/gettext/g' add_in_steam.sh_tmp
#Когда присходит предупреждение: синтаксис $"..." запрещен по соображениям безопасности; используйте eval_gettext #Когда присходит предупреждение: синтаксис $"..." запрещен по соображениям безопасности; используйте eval_gettext
#и ругается на строку в которой нет перевода, можно использовать sed -i '//d' и убрать эту строку #и ругается на строку в которой нет перевода, можно использовать sed -i '//d' и убрать эту строку
#либо отредактировать сам код, чтобы не было такой ошибки (к примеру вместо двойных ковычек использовать в таком месте одинарные) #либо отредактировать сам код, чтобы не было такой ошибки (к примеру вместо двойных ковычек использовать в таком месте одинарные)
...@@ -202,6 +206,7 @@ generate_pot () { ...@@ -202,6 +206,7 @@ generate_pot () {
"data/scripts/start.sh_tmp" \ "data/scripts/start.sh_tmp" \
"data/scripts/setup.sh_tmp" \ "data/scripts/setup.sh_tmp" \
"data/scripts/functions_helper_tmp" \ "data/scripts/functions_helper_tmp" \
"data/scripts/add_in_steam.sh_tmp" \
-o "$TEMPLATE_POT" -o "$TEMPLATE_POT"
popd 1>/dev/null || fatal popd 1>/dev/null || fatal
if [[ -f "$LANG_PO" ]] ; then if [[ -f "$LANG_PO" ]] ; then
...@@ -216,6 +221,7 @@ generate_pot () { ...@@ -216,6 +221,7 @@ generate_pot () {
try_remove_file "${PORT_SCRIPTS_PATH}/start.sh_tmp" try_remove_file "${PORT_SCRIPTS_PATH}/start.sh_tmp"
try_remove_file "${PORT_SCRIPTS_PATH}/setup.sh_tmp" try_remove_file "${PORT_SCRIPTS_PATH}/setup.sh_tmp"
try_remove_file "${PORT_SCRIPTS_PATH}/functions_helper_tmp" try_remove_file "${PORT_SCRIPTS_PATH}/functions_helper_tmp"
try_remove_file "${PORT_SCRIPTS_PATH}/add_in_steam.sh_tmp"
try_remove_dir "${PW_CACHE_LANG_PATH}" try_remove_dir "${PW_CACHE_LANG_PATH}"
} }
export -f generate_pot export -f generate_pot
...@@ -5641,7 +5647,8 @@ portwine_create_shortcut () { ...@@ -5641,7 +5647,8 @@ portwine_create_shortcut () {
create_new_dir "${STUIDPATH}/config/grid" create_new_dir "${STUIDPATH}/config/grid"
export SCPATH="${STUIDPATH}/config/$SCVDF" export SCPATH="${STUIDPATH}/config/$SCVDF"
export SGGRIDDIR="${STUIDPATH}/config/grid" export SGGRIDDIR="${STUIDPATH}/config/grid"
"${PORT_SCRIPTS_PATH}/add_in_steam.sh" # shellcheck source=/dev/null
source "${PORT_SCRIPTS_PATH}/add_in_steam.sh"
done done
if [[ "${PW_SKIP_RESTART_STEAM}" != 1 ]] && pgrep -i steam &>/dev/null ; then if [[ "${PW_SKIP_RESTART_STEAM}" != 1 ]] && pgrep -i steam &>/dev/null ; then
if yad_question "${translations[For adding shortcut to STEAM, needed restart.\\n\\nRestart STEAM now?]}" ; then if yad_question "${translations[For adding shortcut to STEAM, needed restart.\\n\\nRestart STEAM now?]}" ; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment