From 8809e338f760aa18b6c7985f23d7b3bcf15e5d76 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Thu, 5 Sep 2024 21:07:47 +0900 Subject: [PATCH] STEAM_SYNC_SH: code cleanup [skip ci] --- functions/post_update.sh | 1 + functions/prepare_component.sh | 2 +- functions/{steam-sync => }/steam-sync.sh | 6 +++++ functions/steam-sync/resetsync.py | 32 ------------------------ 4 files changed, 8 insertions(+), 33 deletions(-) rename functions/{steam-sync => }/steam-sync.sh (99%) delete mode 100644 functions/steam-sync/resetsync.py diff --git a/functions/post_update.sh b/functions/post_update.sh index d7176aec..edb7ba3e 100644 --- a/functions/post_update.sh +++ b/functions/post_update.sh @@ -434,6 +434,7 @@ post_update() { set_setting_value "$raconf" "libretro_info_path" "/var/config/retroarch/cores" "retroarch" prepare_component "reset" "ruffle" + prepare_component "reset" "steam-rom-manager" update_rd_conf # TODO: check this diff --git a/functions/prepare_component.sh b/functions/prepare_component.sh index ab590bd5..7ccf42c1 100644 --- a/functions/prepare_component.sh +++ b/functions/prepare_component.sh @@ -89,7 +89,7 @@ prepare_component() { local srm_path="/var/config/steam-rom-manager/userData" create_dir -d $srm_path cp -fv "$config/steam-rom-manager/"*.json $srm_path - steam-rom-manager list + #steam-rom-manager list #TODO: what is this for? log i "Updating steamDirectory and romDirectory lines in $srm_path/userConfigurations.json" jq --arg steamDir "$HOME/.steam/steam" --arg romDir "$rdhome/.sync" \ diff --git a/functions/steam-sync/steam-sync.sh b/functions/steam-sync.sh similarity index 99% rename from functions/steam-sync/steam-sync.sh rename to functions/steam-sync.sh index b8a68968..d0235349 100644 --- a/functions/steam-sync/steam-sync.sh +++ b/functions/steam-sync.sh @@ -347,9 +347,15 @@ addToSteam() { echo "$command \"$path\"" >> "$launcher" chmod +x "$launcher" + + zypak-wrapper steam-rom-manager add "$launcher" done fi done log i "Steam Sync: completed" +} + +remove_from_steam { + echo "TBD" } \ No newline at end of file diff --git a/functions/steam-sync/resetsync.py b/functions/steam-sync/resetsync.py deleted file mode 100644 index 80e01acc..00000000 --- a/functions/steam-sync/resetsync.py +++ /dev/null @@ -1,32 +0,0 @@ -import os -import shutil -import re - -def resetfun(rdhome): - os.system("/app/bin/zypak-wrapper /app/srm/steam-rom-manager list") - srm_path=os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/steam-rom-manager/userData/userConfigurations.json") - if not os.path.isfile(srm_path): - print("Steam ROM Manager configuration not initialized! Initializing now.") - shutil.copyfile("/app/libexec/steam-sync/userConfigurations.json", srm_path) - shutil.copyfile("/app/libexec/steam-sync/userExceptions.json", srm_path) - - with open(srm_path,"r") as f: - data=f.read() - data=re.sub("\"steamDirectory.*","\"steamDirectory\" : \""+os.path.expanduser("~/.steam/steam")+"\",",data) - data=re.sub("\"romDirectory.*","\"romDirectory\" : \""+rdhome+"/.sync/\",",data) - with open(srm_path,"w") as f: - f.write(data) - -if __name__=="__main__": - rdhome="" - - print("Open RetroDECK config file: {}".format(os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/retrodeck/retrodeck.cfg"))) - - fl=open(os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/retrodeck/retrodeck.cfg"),"r") - lines=fl.readlines() - for line in lines: - if "rdhome" in line: - rdhome=line[7:-1] - fl.close() - - resetfun(rdhome)