Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PortWINE
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mikhail Tergoev
PortWINE
Commits
aea3d99a
Commit
aea3d99a
authored
Nov 21, 2024
by
Alex Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new func listSteamGames
parent
614cdcb8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
8 deletions
+32
-8
add_in_steam.sh
data_from_portwine/scripts/add_in_steam.sh
+32
-8
No files found.
data_from_portwine/scripts/add_in_steam.sh
View file @
aea3d99a
...
...
@@ -91,25 +91,32 @@ getAppId() {
}
getSteamId() {
if [[ -n "
${
1
:-}
" ]]; then
getSteamGridDBId "
$1
"
unset SteamAppId
NOSTAPPNAME="
$1
"
if [[ -n "
${
NOSTAPPNAME
}
" ]]; then
getSteamGridDBId "
${
NOSTAPPNAME
}
" > /dev/null
fi
if [[
$SteamGridDBTypeSteam
== true ]]; then
SRES=
$(
curl
-Ls
-e
"https://www.steamgriddb.com/game/
${
SteamGridDBId
}
"
"https://www.steamgriddb.com/api/public/game/
${
SteamGridDBId
}
"
)
if jq -e ".success == true" <<< "
${
SRES
}
" > /dev/null 2>&1; then
SteamAppId="
$(
jq
-r
'.data.platforms.steam.id'
<<<
"
${
SRES
}
"
)
"
echo
${
SteamAppId
}
fi
fi
}
getSteamGridDBId() {
unset SteamGridDBId
NOSTAPPNAME="
$1
"
SGDBRES=
$(
curl
-Ls
-H
"Authorization: Bearer
${
SGDBAPIKEY
}
"
"
${
BASESTEAMGRIDDBAPI
}
/search/autocomplete/
${
NOSTAPPNAME
// /_
}
"
)
if jq -e ".success == true and (.data | length > 0)" <<< "
${
SGDBRES
}
" > /dev/null 2>&1; then
if jq -e '.data[0].types | contains(["steam"])' <<< "
${
SGDBRES
}
" > /dev/null; then
SteamGridDBTypeSteam=true
else
SteamGridDBTypeSteam=false
fi
SteamGridDBId="
$(
jq
'.data[0].id'
<<<
"
${
SGDBRES
}
"
)
"
echo
${
SteamGridDBId
}
fi
}
...
...
@@ -147,10 +154,13 @@ listInstalledSteamGames() {
jq -n '[]'
else
for manifest_file in "
${
manifests
[@]
}
"; do
jq -n \
--arg id "
$(
grep
-Po
'"appid"\s+"\K\d+'
"
$manifest_file
"
)
" \
--arg name "
$(
grep
-Po
'"name"\s+"\K[^"]+'
"
$manifest_file
"
)
" \
'{id:
$id
, name:
$name
}'
name="
$(
grep
-Po
'"name"\s+"\K[^"]+'
"
$manifest_file
"
)
";
if [[ ! "
${
name
}
" =~ ^(Proton |Steam Linux Runtime|Steamworks Common) ]]; then
jq -n \
--arg id "
$(
grep
-Po
'"appid"\s+"\K\d+'
"
$manifest_file
"
)
" \
--arg name "
${
name
}
" \
'{id:
$id
, name:
$name
}'
fi
done | jq -s '.'
fi
}
...
...
@@ -165,6 +175,20 @@ listNonSteamGames() {
done | jq -s '.'
}
listSteamGames() {
(
jq -r 'map({AppId: .id, SteamAppId: .id, SteamGameId: .id, Name: .name}) | .[] | tostring' <<< "
$(
listInstalledSteamGames
)
"
jq -r '.[] | tostring' <<< "
$(
listNonSteamGames
)
" | while read game; do
id=
$(
jq
-r
'.id'
<<<
"
${
game
}
"
)
name=
$(
jq
-r
'.name'
<<<
"
${
game
}
"
)
jq -r \
--arg SteamAppId "
$(
getSteamId
"
${
name
}
"
)
" \
--arg SteamGameId "
$(
getSteamGameId
$id
)
" \
'{AppId: .id, SteamAppId: (
$SteamAppId
| if . == "" then "0" else . end), SteamGameId:
$SteamGameId
, Name: .name} | tostring' <<< "
${
game
}
"
done
) | jq -s '.'
}
convertSteamShortcutAppID() {
SHORTCUTAPPIDHEX="
$1
"
SHORTCUTAPPIDLITTLEENDIAN="
$(
echo
"
${
SHORTCUTAPPIDHEX
}
"
|
tac
-rs
.. |
tr
-d
'\n'
)
"
...
...
@@ -226,7 +250,7 @@ downloadImage() {
downloadImageSteam
()
{
if
[[
-
z
"
${
SteamAppId
}
"
]]
;
then
getSteamId
getSteamId
>
/
dev/null
fi
if
[[
-
n
"
${
SteamAppId
}
"
]]
;
then
downloadImage
"https://cdn.cloudflare.steamstatic.com/steam/apps/
${
SteamAppId
}
/
$1
"
"
$2
"
...
...
@@ -252,7 +276,7 @@ downloadImageSteamGridDB() {
addGrids
()
{
if
[[
-
n
"
${
SGDBAPIKEY
}
"
]]
;
then
getSteamGridDBId
"
${
name_desktop
}
"
getSteamGridDBId
"
${
name_desktop
}
"
>
/
dev/null
fi
if
[[
-
n
"
${
SteamGridDBId
}
"
]]
;
then
create_new_dir
"
${
STCFGPATH
}
/grid"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment