SRM: feeding it with Steam user data

This commit is contained in:
XargonWan 2024-11-28 14:38:31 +09:00
parent a9c2145230
commit 1c94be1c33
4 changed files with 78 additions and 28 deletions

View file

@ -5,31 +5,40 @@
"steamDirectory": "${steamdirglobal}",
"steamCategory": "RetroDECK",
"romDirectory": "${romsdirglobal}",
"steamCategories": [],
"executableArgs": "",
"executableModifier": "\"${exePath}\"",
"startInDirectory": "",
"titleModifier": "${fuzzyTitle}",
"fetchControllerTemplatesButton": null,
"removeControllersButton": null,
"steamInputEnabled": "1",
"imageProviders": [
"SteamGridDB"
"sgdb",
"steamCDN"
],
"onlineImageQueries": [
"${fuzzyTitle}"
],
"onlineImageQueries": "${${fuzzyTitle}}",
"imagePool": "${fuzzyTitle}",
"drmProtect": false,
"userAccounts": {
"specifiedAccounts": ""
"specifiedAccounts": [
""
]
},
"parserInputs": {
"glob": "${title}.sh"
},
"executable": {
"path": "",
"shortcutPassthrough": false,
"appendArgsToExecutable": true
},
"parserInputs": {
"glob": "${title}.sh"
},
"titleFromVariable": {
"limitToGroups": "",
"limitToGroups": [],
"caseInsensitiveVariables": false,
"skipFileIfVariableWasNotFound": false,
"tryToMatchTitle": false
"skipFileIfVariableWasNotFound": false
},
"fuzzyMatch": {
"replaceDiacritics": true,
@ -47,6 +56,7 @@
"mappingId": "RetroDECK_controller_ps5.vdf",
"profileType": "template"
},
"ps5_edge": null,
"xbox360": {
"title": "RetroDECK Controller",
"mappingId": "RetroDECK_controller_xbox360_simple.vdf",
@ -57,6 +67,7 @@
"mappingId": "RetroDECK_controller_xboxone_simple.vdf",
"profileType": "template"
},
"xboxelite": null,
"switch_joycon_left": {
"title": "Controller",
"mappingId": "controller_switch_joycon_left_gamepad_joystick.vdf",
@ -76,10 +87,11 @@
"title": "RetroDECK Controller",
"mappingId": "RetroDECK_controller_steamdeck_neptune_full.vdf",
"profileType": "template"
}
},
"steamcontroller_gordon": null
},
"imageProviderAPIs": {
"SteamGridDB": {
"sgdb": {
"nsfw": false,
"humor": false,
"styles": [],
@ -88,7 +100,11 @@
"stylesIcon": [],
"imageMotionTypes": [
"static"
]
],
"sizes": [],
"sizesHero": [],
"sizesTall": null,
"sizesIcon": []
}
},
"defaultImage": {
@ -106,6 +122,6 @@
"icon": null
},
"parserId": "1725539138664815",
"version": 15
"version": 25
}
]

View file

@ -1,24 +1,29 @@
{
"fuzzyMatcher": {
"verbose": false,
"filterProviders": true
"verbose": false,
"filterProviders": true
},
"environmentVariables": {
"steamDirectory": "",
"userAccounts": "${steamlogin}",
"romsDirectory": "",
"retroarchPath": "",
"raCoresDirectory": "",
"localImagesDirectory": ""
"steamDirectory": "",
"userAccounts": [
"steamlogin"
],
"romsDirectory": "",
"retroarchPath": "",
"raCoresDirectory": "",
"localImagesDirectory": ""
},
"previewSettings": {
"retrieveCurrentSteamImages": true,
"deleteDisabledShortcuts": false,
"imageZoomPercentage": 30,
"preload": false
"imageLoadStrategy": "loadLazy",
"retrieveCurrentSteamImages": true,
"disableCategories": false,
"deleteDisabledShortcuts": false,
"imageZoomPercentage": 30,
"hideUserAccount": false
},
"enabledProviders": [
"SteamGridDB"
"sgdb",
"steamCDN"
],
"batchDownloadSize": 50,
"language": "en-US",
@ -26,5 +31,10 @@
"offlineMode": false,
"navigationWidth": 0,
"clearLogOnTest": false,
"version": 6
}
"version": 10,
"dnsServers": [],
"autoUpdate": true,
"autoKillSteam": false,
"autoRestartSteam": false
}

View file

@ -538,8 +538,28 @@ get_steam_user() {
log i "SteamID:\t$steam_id"
log i "Username:\t$steam_username"
log i "Name:\t\t$steam_prettyname"
if [[ $steam_sync == "true" ]]; then
populate_steamuser_srm
fi
else
# Log warning if file not found
log w "No Steam user found, proceeding" >&2
fi
}
populate_steamuser_srm(){
# Populating SRM config with Steam Username
log d "Populating Steam Rom Manager config file with Steam Username"
jq --arg username "$steam_username" '
map(
if .userAccounts.specifiedAccounts then
.userAccounts.specifiedAccounts = [$username]
else
.
end
)
' "$XDG_CONFIG_HOME/steam-rom-manager/userData/userConfigurations.json" > "$XDG_CONFIG_HOME/steam-rom-manager/userData/userConfigurations.json.tmp" &&
mv "$XDG_CONFIG_HOME/steam-rom-manager/userData/userConfigurations.json.tmp" "$XDG_CONFIG_HOME/steam-rom-manager/userData/userConfigurations.json"
}

View file

@ -95,6 +95,10 @@ prepare_component() {
log i "Updating steamDirectory and romDirectory lines in $srm_userdata/userSettings.json"
jq '.environmentVariables.steamDirectory = "'$HOME'/.steam/steam"' "$srm_userdata/userSettings.json" > "$srm_userdata/tmp.json" && mv -f "$srm_userdata/tmp.json" "$srm_userdata/userSettings.json"
jq '.environmentVariables.romsDirectory = "'$rdhome'/.sync"' "$srm_userdata/userSettings.json" > "$srm_userdata/tmp.json" && mv -f "$srm_userdata/tmp.json" "$srm_userdata/userSettings.json"
get_steam_user
populate_steamuser_srm
fi
if [[ "$component" =~ ^(retroarch|all)$ ]]; then