diff --git a/data_from_portwine/scripts/add_in_steam.sh b/data_from_portwine/scripts/add_in_steam.sh index a5150bd..e10cf5e 100755 --- a/data_from_portwine/scripts/add_in_steam.sh +++ b/data_from_portwine/scripts/add_in_steam.sh @@ -1,7 +1,6 @@ #!/bin/bash # GPL-3.0 license # based on https://github.com/sonic2kk/steamtinkerlaunch/blob/master/steamtinkerlaunch - PROGNAME="PortProton" name_desktop_png="${name_desktop// /_}" NOSTAPPNAME="$name_desktop" @@ -151,7 +150,15 @@ function downloadArtFromSteamGridDB { [ -n "$SEARCHHUMOR" ] && SGDB_ENDPOINT_STR+="&humor=${SEARCHHUMOR}" [ -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 @@ -289,6 +296,7 @@ function commandlineGetSteamGridDBArtwork { 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 + # 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" @@ -325,7 +333,9 @@ if [ -n "$NOSTAPPNAME" ]; then fi # Store the ID we searched with, so getSteamGridDBNonSteamIcon doesn't have to hit the endpoint again and we save an API call -commandlineGetSteamGridDBArtwork --search-name="$NOSTSEARCHNAME" --filename-appid="$NOSTAIDGRID" "$NOSTSEARCHFLAG" --apply --replace-existing +if [[ "$DOWNLOAD_STEAM_GRID" == "1" ]] ; then + commandlineGetSteamGridDBArtwork --search-name="$NOSTSEARCHNAME" --filename-appid="$NOSTAIDGRID" "$NOSTSEARCHFLAG" --apply --replace-existing +fi { printf '\x00%s\x00' "$NEWSET" printf '\x02%s\x00%b' "appid" "$NOSTAIDVDFHEXFMT" @@ -356,4 +366,6 @@ commandlineGetSteamGridDBArtwork --search-name="$NOSTSEARCHNAME" --filename-appi printf '\x08\x08\x08\x08' } >> "$SCPATH" -setGameArt "$NOSTAIDGRID" --hero="$NOSTGHERO" --logo="$NOSTGLOGO" --boxart="$NOSTGBOXART" --tenfoot="$NOSTGTENFOOT" "$SGACOPYMETHOD" +if [[ "$DOWNLOAD_STEAM_GRID" == "1" ]] ; then + setGameArt "$NOSTAIDGRID" --hero="$NOSTGHERO" --logo="$NOSTGLOGO" --boxart="$NOSTGBOXART" --tenfoot="$NOSTGTENFOOT" "$SGACOPYMETHOD" +fi diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper index 9221ac7..db03975 100755 --- a/data_from_portwine/scripts/functions_helper +++ b/data_from_portwine/scripts/functions_helper @@ -5391,6 +5391,28 @@ change_branch () { } export -f change_branch +change_download_grid () { + if [[ "$DOWNLOAD_STEAM_GRID" == "1" ]] ; then + sed -i 's/DOWNLOAD_STEAM_GRID=.*/DOWNLOAD_STEAM_GRID="0"/' "$USER_CONF" + pw_notify_send -i info \ + "$(gettext "Cover downloads are enabled")" + else + sed -i 's/DOWNLOAD_STEAM_GRID=.*/DOWNLOAD_STEAM_GRID="1"/' "$USER_CONF" + pw_notify_send -i info \ + "$(gettext "Cover downloads are disabled")" + fi + print_info "Restarting PP for change cover download behavior..." + export SKIP_CHECK_UPDATES="1" + if [[ -z "${PW_ALL_DF}" ]] ; then + export TAB_MAIN_MENU="4" + else + export TAB_MAIN_MENU="5" + fi + /usr/bin/env bash -c ${pw_full_command_line[*]} & + exit 0 +} +export -f change_download_grid + change_gui_start () { if [[ "$PW_GUI_START" == "NOTEBOOK" ]] ; then sed -i 's/="NOTEBOOK"/="PANED"/g' "$USER_CONF" diff --git a/data_from_portwine/scripts/start.sh b/data_from_portwine/scripts/start.sh index b7e09f8..c4c6940 100755 --- a/data_from_portwine/scripts/start.sh +++ b/data_from_portwine/scripts/start.sh @@ -206,6 +206,11 @@ fi export MIRROR print_info "The first mirror in used: $MIRROR\n" +# choose downloading covers from SteamGridDB or not +if [[ -z "$DOWNLOAD_STEAM_GRID" ]] ; then + echo 'export DOWNLOAD_STEAM_GRID="1"' >> "$USER_CONF" + export DOWNLOAD_STEAM_GRID="1" +fi if [[ "${INSTALLING_PORT}" == 1 ]] ; then return 0 @@ -662,6 +667,11 @@ else else NEW_BRANCH="STABLE" fi + if [[ "$DOWNLOAD_STEAM_GRID" == "1" ]] + then NEW_STEAM_BEHAVIOR="Disable" + else NEW_STEAM_BEHAVIOR="Enable" + fi + IFS=$'\n' PW_ALL_DF="$(ls "${PORT_WINE_PATH}"/ | grep .desktop | grep -vE '(PortProton|readme)')" if [[ -z "${PW_ALL_DF}" ]] @@ -709,6 +719,7 @@ else --field=" $(gettext "Change mirror to") $NEW_MIRROR"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click change_mirror"' \ --field=" $(gettext "Change branch to") $NEW_BRANCH"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click change_branch"' \ --field=" $(gettext "Change start gui")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click change_gui_start"' \ + --field=" $NEW_STEAM_BEHAVIOR $(gettext "steam covers download")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click change_download_grid"' \ 2>/dev/null & "${pw_yad}" --plug=$KEY --tabnum="${PW_GUI_SORT_TABS[2]}" --form --columns=3 --align-buttons --separator=";" \ @@ -866,6 +877,7 @@ fi change_mirror) change_mirror ;; change_branch) change_branch ;; change_gui_start) change_gui_start ;; + change_download_grid) change_download_grid ;; 118) gui_edit_db ;; 120) gui_vkbasalt ;; 122) gui_mangohud ;;