Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commandline: Flatten getIDFromTitle
Browse files Browse the repository at this point in the history
sonic2kk committed Jan 28, 2024

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
1 parent 0cac03c commit e3204b7
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions steamtinkerlaunch
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
PREFIX="/usr"
PROGNAME="SteamTinkerLaunch"
NICEPROGNAME="Steam Tinker Launch"
PROGVERS="v14.0.20240129-2"
PROGVERS="v14.0.20240129-3 (flatten-getidfromtitle)"
PROGCMD="${0##*/}"
PROGINTERNALPROTNAME="Proton-stl"
SHOSTL="stl"
@@ -7805,38 +7805,41 @@ function listSteamGames {
function getIDFromTitle {
SEARCHSTEAMSHORTCUTS="${2:-0}" # Default to not searching Steam shortcuts
if [ -z "$1" ]; then
writelog "ERROR" "${FUNCNAME[0]} - No game title was provided to search on -- Nothing to do!"
echo "A Game Title (part of it might be enough) is required as argument"
else
# Check installed game appmanifests for name matches
FOUNDMATCHES=()

# Steam games
while read -r APPMA; do
APPMATITLE="$( getValueFromAppManifest "name" "$APPMA" )"
if [[ ${APPMATITLE,,} == *"${1,,}"* ]]; then
APPMAAID="$( basename "${APPMA%.*}" | cut -d '_' -f2 )"
FOUNDGAMNAM="$( printf "%s\t\t(%s)" "$APPMAAID" "$APPMATITLE" )" # Doing it this way makes tabs even for some reason
return 1
fi
# Check installed game appmanifests for name matches
FOUNDMATCHES=()

# Steam games
while read -r APPMA; do
APPMATITLE="$( getValueFromAppManifest "name" "$APPMA" )"
if [[ ${APPMATITLE,,} == *"${1,,}"* ]]; then
APPMAAID="$( basename "${APPMA%.*}" | cut -d '_' -f2 )"
FOUNDGAMNAM="$( printf "%s\t\t(%s)" "$APPMAAID" "$APPMATITLE" )" # Doing it this way makes tabs even for some reason
FOUNDMATCHES+=( "$FOUNDGAMNAM" )
fi
done <<< "$( listAppManifests )"

# Steam shortcuts
if [ "$SEARCHSTEAMSHORTCUTS" -eq "1" ] && haveAnySteamShortcuts ; then
while read -r SCVDFE; do
SVDFENAME="$( parseSteamShortcutEntryAppName "$SCVDFE" )"
SVDFEAID="$( parseSteamShortcutEntryAppID "$SCVDFE" )"

if [[ ${SVDFENAME,,} == *"${1,,}"* ]]; then
FOUNDGAMNAM="$( printf "%s\t\t(%s)" "$SVDFEAID" "$SVDFENAME" )"
FOUNDMATCHES+=( "$FOUNDGAMNAM" )
fi
done <<< "$( listAppManifests )"

# Steam shortcuts
if [ "$SEARCHSTEAMSHORTCUTS" -eq "1" ] && haveAnySteamShortcuts ; then
while read -r SCVDFE; do
SVDFENAME="$( parseSteamShortcutEntryAppName "$SCVDFE" )"
SVDFEAID="$( parseSteamShortcutEntryAppID "$SCVDFE" )"
done <<< "$( getSteamShortcutHex )"
fi

if [[ ${SVDFENAME,,} == *"${1,,}"* ]]; then
FOUNDGAMNAM="$( printf "%s\t\t(%s)" "$SVDFEAID" "$SVDFENAME" )"
FOUNDMATCHES+=( "$FOUNDGAMNAM" )
fi
done <<< "$( getSteamShortcutHex )"
fi
if [ "${#FOUNDMATCHES[@]}" -gt 0 ]; then
printf "%s\n" "${FOUNDMATCHES[@]}"
else
echo "Could not find AppID for name '$1'."
fi
if [ "${#FOUNDMATCHES[@]}" -gt 0 ]; then
printf "%s\n" "${FOUNDMATCHES[@]}"
else
echo "Could not find AppID for name '$1'."
fi
}

0 comments on commit e3204b7

Please sign in to comment.