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

View file

@ -1,24 +1,29 @@
{ {
"fuzzyMatcher": { "fuzzyMatcher": {
"verbose": false, "verbose": false,
"filterProviders": true "filterProviders": true
}, },
"environmentVariables": { "environmentVariables": {
"steamDirectory": "", "steamDirectory": "",
"userAccounts": "${steamlogin}", "userAccounts": [
"romsDirectory": "", "steamlogin"
"retroarchPath": "", ],
"raCoresDirectory": "", "romsDirectory": "",
"localImagesDirectory": "" "retroarchPath": "",
"raCoresDirectory": "",
"localImagesDirectory": ""
}, },
"previewSettings": { "previewSettings": {
"retrieveCurrentSteamImages": true, "imageLoadStrategy": "loadLazy",
"deleteDisabledShortcuts": false, "retrieveCurrentSteamImages": true,
"imageZoomPercentage": 30, "disableCategories": false,
"preload": false "deleteDisabledShortcuts": false,
"imageZoomPercentage": 30,
"hideUserAccount": false
}, },
"enabledProviders": [ "enabledProviders": [
"SteamGridDB" "sgdb",
"steamCDN"
], ],
"batchDownloadSize": 50, "batchDownloadSize": 50,
"language": "en-US", "language": "en-US",
@ -26,5 +31,10 @@
"offlineMode": false, "offlineMode": false,
"navigationWidth": 0, "navigationWidth": 0,
"clearLogOnTest": false, "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 "SteamID:\t$steam_id"
log i "Username:\t$steam_username" log i "Username:\t$steam_username"
log i "Name:\t\t$steam_prettyname" log i "Name:\t\t$steam_prettyname"
if [[ $steam_sync == "true" ]]; then
populate_steamuser_srm
fi
else else
# Log warning if file not found # Log warning if file not found
log w "No Steam user found, proceeding" >&2 log w "No Steam user found, proceeding" >&2
fi 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" 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.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" 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 fi
if [[ "$component" =~ ^(retroarch|all)$ ]]; then if [[ "$component" =~ ^(retroarch|all)$ ]]; then