From a184b4d07c3a366855dbc29d7b9ae11e4d13ce3c Mon Sep 17 00:00:00 2001 From: sysmoon14 <61550824+sysmoon14@users.noreply.github.com> Date: Wed, 14 Feb 2024 09:28:15 +0000 Subject: [PATCH 01/18] Ignore env_vars check for decky --- NonSteamLaunchers.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index df6dbf4..5b1061d 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -145,8 +145,10 @@ if [ "$decky_plugin" = true ]; then echo "Python script ran. Continuing with the script..." else # If the env_vars file does not exist, exit the script - echo "Decky Plugin argument set but env_vars file not found. Exiting the script." - exit 0 + # echo "Decky Plugin argument set but env_vars file not found. Exiting the script." + python3 $python_script_path + echo "Python script ran. Continuing with the script..." + # exit 0 fi else # If the Decky Plugin argument is not set, continue with the script From 350d243e28c5ba2e119651535f0034862834999a Mon Sep 17 00:00:00 2001 From: sysmoon14 <61550824+sysmoon14@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:43:09 +0000 Subject: [PATCH 02/18] Removed "/path=" from GoG Launch Options --- NSLGameScanner.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 0612a58..a5630dc 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -667,7 +667,6 @@ def getGogGameInfo(filePath): with open(filePath, 'r') as file: game_id = None game_name = None - exe_path = None for line in file: split_line = line.split("=") if len(split_line) > 1: @@ -679,15 +678,10 @@ def getGogGameInfo(filePath): game_name = re.findall(r'\"(.+?)\"', split_line[1]) if game_name: game_name = game_name[0] - if "exe" in line and "GOG Galaxy" in line and not "unins000.exe" in line: - exe_path = re.findall(r'\"(.+?)\"', split_line[1]) - if exe_path: - exe_path = exe_path[0].replace('\\\\', '\\') - if game_id and game_name and exe_path: - game_dict[game_name] = {'id': game_id, 'exe': exe_path} + if game_id and game_name: + game_dict[game_name] = {'id': game_id} game_id = None game_name = None - exe_path = None return game_dict @@ -704,7 +698,7 @@ else: for game, game_info in game_dict.items(): if game_info['id']: - launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/\" %command% /command=runGame /gameId={game_info['id']} /path=\"{game_info['exe']}\"" + launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/\" %command% /command=runGame /gameId={game_info['id']}\"" exe_path = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/drive_c/Program Files (x86)/GOG Galaxy/GalaxyClient.exe\"" start_dir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/drive_c/Program Files (x86)/GOG Galaxy/\"" create_new_entry(exe_path, game, launch_options, start_dir) From a7140842554aa1bfc869a243e841e799db008b25 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Wed, 14 Feb 2024 23:54:24 -0800 Subject: [PATCH 03/18] rechecked env_vars for now --- NonSteamLaunchers.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 5b1061d..df6dbf4 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -145,10 +145,8 @@ if [ "$decky_plugin" = true ]; then echo "Python script ran. Continuing with the script..." else # If the env_vars file does not exist, exit the script - # echo "Decky Plugin argument set but env_vars file not found. Exiting the script." - python3 $python_script_path - echo "Python script ran. Continuing with the script..." - # exit 0 + echo "Decky Plugin argument set but env_vars file not found. Exiting the script." + exit 0 fi else # If the Decky Plugin argument is not set, continue with the script From 1063ec594658a155726c208b4542e098854c10a4 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Thu, 15 Feb 2024 00:00:20 -0800 Subject: [PATCH 04/18] added small check for now to test plugin --- NonSteamLaunchers.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index df6dbf4..97e1277 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -2720,18 +2720,24 @@ fi - - # Detach script from Steam process nohup sh -c 'sleep 10; /usr/bin/steam' & -# Close all instances of Steam -steam_pid() { pgrep -x steam ; } -steam_running=$(steam_pid) -[[ -n "$steam_running" ]] && killall steam +# Define the directory +dir="${logged_in_home}/homebrew/NonSteamLaunchersDecky/" -# Wait for the steam process to exit -while steam_pid > /dev/null; do sleep 5; done +# Check if the directory does not exist +if [ ! -d "$dir" ]; then + # Close all instances of Steam + steam_pid() { pgrep -x steam ; } + steam_running=$(steam_pid) + [[ -n "$steam_running" ]] && killall steam + + # Wait for the steam process to exit + while steam_pid > /dev/null; do sleep 5; done +else + echo "Directory $dir exists. Not restarting Steam." +fi From d8b392efe2c8a7ba4ee84606eec40462d5c3049e Mon Sep 17 00:00:00 2001 From: sysmoon14 <61550824+sysmoon14@users.noreply.github.com> Date: Fri, 16 Feb 2024 06:54:58 +0000 Subject: [PATCH 05/18] Reverted previous two commits Added env vars check back for decky and reverted GoG change. --- NSLGameScanner.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index a5630dc..0612a58 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -667,6 +667,7 @@ def getGogGameInfo(filePath): with open(filePath, 'r') as file: game_id = None game_name = None + exe_path = None for line in file: split_line = line.split("=") if len(split_line) > 1: @@ -678,10 +679,15 @@ def getGogGameInfo(filePath): game_name = re.findall(r'\"(.+?)\"', split_line[1]) if game_name: game_name = game_name[0] - if game_id and game_name: - game_dict[game_name] = {'id': game_id} + if "exe" in line and "GOG Galaxy" in line and not "unins000.exe" in line: + exe_path = re.findall(r'\"(.+?)\"', split_line[1]) + if exe_path: + exe_path = exe_path[0].replace('\\\\', '\\') + if game_id and game_name and exe_path: + game_dict[game_name] = {'id': game_id, 'exe': exe_path} game_id = None game_name = None + exe_path = None return game_dict @@ -698,7 +704,7 @@ else: for game, game_info in game_dict.items(): if game_info['id']: - launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/\" %command% /command=runGame /gameId={game_info['id']}\"" + launch_options = f"STEAM_COMPAT_DATA_PATH=\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/\" %command% /command=runGame /gameId={game_info['id']} /path=\"{game_info['exe']}\"" exe_path = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/drive_c/Program Files (x86)/GOG Galaxy/GalaxyClient.exe\"" start_dir = f"\"{logged_in_home}/.local/share/Steam/steamapps/compatdata/{gog_galaxy_launcher}/pfx/drive_c/Program Files (x86)/GOG Galaxy/\"" create_new_entry(exe_path, game, launch_options, start_dir) From 3686a6323a4b97a8d0724dfcc4a6614abf9d78a8 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Fri, 16 Feb 2024 04:30:02 -0800 Subject: [PATCH 06/18] added back stdoubt --- NSLGameScanner.py | 1 + 1 file changed, 1 insertion(+) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 0612a58..1e914b9 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -1039,6 +1039,7 @@ if new_shortcuts_added or shortcuts_updated: # Print the shortcut information in JSON format message = json.dumps(shortcut_info) + print(message, flush=True) # Print to stdout pipe.write(message + '\n') # Write to the pipe print("All finished!") From bdc2ed7b12123f7c2b67a89862dd566153d1df23 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Fri, 16 Feb 2024 19:05:02 -0800 Subject: [PATCH 07/18] Removed Pipe --- NSLGameScanner.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 1e914b9..f8a0b9f 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -905,15 +905,6 @@ if amazon_games: -# Push down when more scanners are added -#PipingInfoToDeckyPlugin -PIPE_PATH = "/tmp/NSLGameScanner_pipe" - -# Check if the pipe does not exist -if not os.path.exists(PIPE_PATH): - # Create the named pipe - os.mkfifo(PIPE_PATH) - # Only write back to the shortcuts.vdf and config.vdf files if new shortcuts were added or compattools changed if new_shortcuts_added or shortcuts_updated: print(f"Saving new config and shortcuts files") @@ -1040,7 +1031,6 @@ if new_shortcuts_added or shortcuts_updated: # Print the shortcut information in JSON format message = json.dumps(shortcut_info) print(message, flush=True) # Print to stdout - pipe.write(message + '\n') # Write to the pipe print("All finished!") From aa290fee949497dcaad650d68d0c4251d2f5596b Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Fri, 16 Feb 2024 19:26:30 -0800 Subject: [PATCH 08/18] lessened api calls --- NSLGameScanner.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index f8a0b9f..4321634 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -155,8 +155,8 @@ def get_unsigned_shortcut_id(signed_shortcut_id): api_cache = {} #API KEYS FOR NONSTEAMLAUNCHER USE ONLY -sgdb = SteamGridDB('8d4131fd8213502c20276b738f7acb1a') -api_key = '8d4131fd8213502c20276b738f7acb1a' +sgdb = SteamGridDB('36e4bedbfdda27f42f9ef4a44f80955c') +api_key = '36e4bedbfdda27f42f9ef4a44f80955c' #GLOBAL VARS created_shortcuts = [] @@ -180,6 +180,8 @@ def get_sgdb_art(game_id, app_id): print("Downloading grids artwork of size 920x430...") download_artwork(game_id, api_key, "grids", app_id, "920x430") + + def download_artwork(game_id, api_key, art_type, shortcut_id, dimensions=None): # Create a cache key based on the function's arguments cache_key = (game_id, art_type, dimensions) @@ -190,11 +192,11 @@ def download_artwork(game_id, api_key, art_type, shortcut_id, dimensions=None): else: filename = get_file_name(art_type, shortcut_id) file_path = f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{filename}" - + directory = os.path.dirname(file_path) if not os.path.exists(directory): os.makedirs(directory) - + if os.path.exists(file_path): print(f"Artwork for {game_id} already exists. Skipping download.") return @@ -215,6 +217,11 @@ def download_artwork(game_id, api_key, art_type, shortcut_id, dimensions=None): data = response.json() # Store the result in the cache api_cache[cache_key] = data + else: + print(f"Error making API call: {response.status_code}") + # Store the failed status in the cache + api_cache[cache_key] = None + return # Continue with the rest of your function using `data` for artwork in data['data']: @@ -232,6 +239,7 @@ def download_artwork(game_id, api_key, art_type, shortcut_id, dimensions=None): if art_type == 'icons': download_artwork(game_id, api_key, 'icons_ico', shortcut_id) + def get_game_id(game_name): print(f"Searching for game ID for: {game_name}") games = sgdb.search_game(game_name) From e0ecc12aa9e8046833eee41714d35e89841651a6 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Fri, 16 Feb 2024 19:40:51 -0800 Subject: [PATCH 09/18] Add files via upload --- NSLGameScanner.py | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 4321634..8ae70bf 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -1018,28 +1018,27 @@ if new_shortcuts_added or shortcuts_updated: # Assuming 'games' is a list of game dictionaries games = [shortcut for shortcut in shortcuts['shortcuts'].values()] - # Open the pipe for writing - with open(PIPE_PATH, 'w') as pipe: - for game in games: - # Skip if 'appname' or 'exe' is None - if game.get('appname') is None or game.get('exe') is None: - continue + for game in games: + # Skip if 'appname' or 'exe' is None + if game.get('appname') is None or game.get('exe') is None: + continue - # Create a dictionary to hold the shortcut information - shortcut_info = { - 'appid': str(game.get('appid')), - 'appname': game.get('appname'), - 'exe': game.get('exe'), - 'StartDir': game.get('StartDir'), - 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', game.get('appid'))}", - 'LaunchOptions': game.get('LaunchOptions'), - 'GameID': game.get('GameID', "default_game_id") # Use a default value if game_id is not defined - } + # Create a dictionary to hold the shortcut information + shortcut_info = { + 'appid': str(game.get('appid')), + 'appname': game.get('appname'), + 'exe': game.get('exe'), + 'StartDir': game.get('StartDir'), + 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', game.get('appid'))}", + 'LaunchOptions': game.get('LaunchOptions'), + 'GameID': game.get('GameID', "default_game_id") # Use a default value if game_id is not defined + } - # Print the shortcut information in JSON format - message = json.dumps(shortcut_info) - print(message, flush=True) # Print to stdout + # Print the shortcut information in JSON format + message = json.dumps(shortcut_info) + print(message, flush=True) # Print to stdout print("All finished!") + From ecf741bc5ff22dff0925fa5e71dc43daca9a8743 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Fri, 16 Feb 2024 23:57:55 -0800 Subject: [PATCH 10/18] Re added pipe temporarily --- NonSteamLaunchers.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 97e1277..8b92a5a 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -141,7 +141,13 @@ if [ "$decky_plugin" = true ]; then if [ -f "$env_vars" ]; then # If the env_vars file exists, run the .py file and continue with the script echo "Decky Plugin argument set and env_vars file found. Running the .py file..." - python3 $python_script_path + PIPE_PATH="/tmp/NSLGameScanner_pipe" + + if [[ ! -p $PIPE_PATH ]]; then + mkfifo $PIPE_PATH + fi + + python3 $python_script_path > $PIPE_PATH echo "Python script ran. Continuing with the script..." else # If the env_vars file does not exist, exit the script From ff56c3a04df3a02a47ecd0645cb9bcc2909901be Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Sat, 17 Feb 2024 00:31:09 -0800 Subject: [PATCH 11/18] removed pipe --- NonSteamLaunchers.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 8b92a5a..97e1277 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -141,13 +141,7 @@ if [ "$decky_plugin" = true ]; then if [ -f "$env_vars" ]; then # If the env_vars file exists, run the .py file and continue with the script echo "Decky Plugin argument set and env_vars file found. Running the .py file..." - PIPE_PATH="/tmp/NSLGameScanner_pipe" - - if [[ ! -p $PIPE_PATH ]]; then - mkfifo $PIPE_PATH - fi - - python3 $python_script_path > $PIPE_PATH + python3 $python_script_path echo "Python script ran. Continuing with the script..." else # If the env_vars file does not exist, exit the script From cdff413f4ca7c082908beec0580299d92abd500b Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Sun, 18 Feb 2024 00:10:09 -0800 Subject: [PATCH 12/18] testing of writin json to file --- NSLGameScanner.py | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 8ae70bf..0c41505 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -1018,27 +1018,31 @@ if new_shortcuts_added or shortcuts_updated: # Assuming 'games' is a list of game dictionaries games = [shortcut for shortcut in shortcuts['shortcuts'].values()] - for game in games: - # Skip if 'appname' or 'exe' is None - if game.get('appname') is None or game.get('exe') is None: - continue + # Open the output file in write mode ('w') + with open('output.json', 'w') as outfile: + for game in games: + # Skip if 'appname' or 'exe' is None + if game.get('appname') is None or game.get('exe') is None: + continue - # Create a dictionary to hold the shortcut information - shortcut_info = { - 'appid': str(game.get('appid')), - 'appname': game.get('appname'), - 'exe': game.get('exe'), - 'StartDir': game.get('StartDir'), - 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', game.get('appid'))}", - 'LaunchOptions': game.get('LaunchOptions'), - 'GameID': game.get('GameID', "default_game_id") # Use a default value if game_id is not defined - } + # Create a dictionary to hold the shortcut information + shortcut_info = { + 'appid': str(game.get('appid')), + 'appname': game.get('appname'), + 'exe': game.get('exe'), + 'StartDir': game.get('StartDir'), + 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', game.get('appid'))}", + 'LaunchOptions': game.get('LaunchOptions'), + 'GameID': game.get('GameID', "default_game_id") # Use a default value if game_id is not defined + } - # Print the shortcut information in JSON format - message = json.dumps(shortcut_info) - print(message, flush=True) # Print to stdout + # Convert the shortcut information to JSON format + message = json.dumps(shortcut_info) -print("All finished!") + # Write the JSON output to the file + outfile.write(message + '\n') # Add a newline character after each game + + print("All finished!") From e5153c06e076041400d13d4fca1d9e2cfbafc876 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Sun, 18 Feb 2024 00:17:20 -0800 Subject: [PATCH 13/18] Reverted --- NSLGameScanner.py | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 0c41505..894533f 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -1018,31 +1018,26 @@ if new_shortcuts_added or shortcuts_updated: # Assuming 'games' is a list of game dictionaries games = [shortcut for shortcut in shortcuts['shortcuts'].values()] - # Open the output file in write mode ('w') - with open('output.json', 'w') as outfile: - for game in games: - # Skip if 'appname' or 'exe' is None - if game.get('appname') is None or game.get('exe') is None: - continue + for game in games: + # Skip if 'appname' or 'exe' is None + if game.get('appname') is None or game.get('exe') is None: + continue - # Create a dictionary to hold the shortcut information - shortcut_info = { - 'appid': str(game.get('appid')), - 'appname': game.get('appname'), - 'exe': game.get('exe'), - 'StartDir': game.get('StartDir'), - 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', game.get('appid'))}", - 'LaunchOptions': game.get('LaunchOptions'), - 'GameID': game.get('GameID', "default_game_id") # Use a default value if game_id is not defined - } + # Create a dictionary to hold the shortcut information + shortcut_info = { + 'appid': str(game.get('appid')), + 'appname': game.get('appname'), + 'exe': game.get('exe'), + 'StartDir': game.get('StartDir'), + 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', game.get('appid'))}", + 'LaunchOptions': game.get('LaunchOptions'), + 'GameID': game.get('GameID', "default_game_id") # Use a default value if game_id is not defined + } - # Convert the shortcut information to JSON format - message = json.dumps(shortcut_info) - - # Write the JSON output to the file - outfile.write(message + '\n') # Add a newline character after each game - - print("All finished!") + # Print the shortcut information in JSON format + message = json.dumps(shortcut_info) + print(message, flush=True) # Print to stdout +print("All finished!") From f62bc75edaad8bdc7a814c561e18aca7ae1c5de3 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Sun, 18 Feb 2024 06:13:39 -0800 Subject: [PATCH 14/18] added log for the json info --- NSLGameScanner.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 894533f..78c50cd 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -1040,4 +1040,10 @@ if new_shortcuts_added or shortcuts_updated: print("All finished!") +# Create the path to the output file +output_file_path = f"{logged_in_home}/.config/systemd/user/NSLGameScanner_output.log" +# Open the output file in append mode +with open(output_file_path, 'a') as output_file: + # Print the shortcut information to the output file + print(message, file=output_file, flush=True) From b604b45b11f48e96f17c8b765b5a4a1151ad0040 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Sun, 18 Feb 2024 06:23:09 -0800 Subject: [PATCH 15/18] Update NSLGameScanner.py --- NSLGameScanner.py | 50 +++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 78c50cd..48b6ef6 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -1018,32 +1018,32 @@ if new_shortcuts_added or shortcuts_updated: # Assuming 'games' is a list of game dictionaries games = [shortcut for shortcut in shortcuts['shortcuts'].values()] - for game in games: - # Skip if 'appname' or 'exe' is None - if game.get('appname') is None or game.get('exe') is None: - continue + # Create the path to the output file + output_file_path = f"{logged_in_home}/.config/systemd/user/NSLGameScanner_output.log" - # Create a dictionary to hold the shortcut information - shortcut_info = { - 'appid': str(game.get('appid')), - 'appname': game.get('appname'), - 'exe': game.get('exe'), - 'StartDir': game.get('StartDir'), - 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', game.get('appid'))}", - 'LaunchOptions': game.get('LaunchOptions'), - 'GameID': game.get('GameID', "default_game_id") # Use a default value if game_id is not defined - } + # Open the output file in append mode + with open(output_file_path, 'a') as output_file: + for game in games: + # Skip if 'appname' or 'exe' is None + if game.get('appname') is None or game.get('exe') is None: + continue - # Print the shortcut information in JSON format - message = json.dumps(shortcut_info) - print(message, flush=True) # Print to stdout + # Create a dictionary to hold the shortcut information + shortcut_info = { + 'appid': str(game.get('appid')), + 'appname': game.get('appname'), + 'exe': game.get('exe'), + 'StartDir': game.get('StartDir'), + 'icon': f"{logged_in_home}/.steam/root/userdata/{steamid3}/config/grid/{get_file_name('icons', game.get('appid'))}", + 'LaunchOptions': game.get('LaunchOptions'), + 'GameID': game.get('GameID', "default_game_id") # Use a default value if game_id is not defined + } + + # Print the shortcut information in JSON format + message = json.dumps(shortcut_info) + print(message, flush=True) # Print to stdout + + # Print the shortcut information to the output file + print(message, file=output_file, flush=True) print("All finished!") - -# Create the path to the output file -output_file_path = f"{logged_in_home}/.config/systemd/user/NSLGameScanner_output.log" - -# Open the output file in append mode -with open(output_file_path, 'a') as output_file: - # Print the shortcut information to the output file - print(message, file=output_file, flush=True) From c041991ce5e97d577eef377ccbe4e86620672cd7 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Sun, 18 Feb 2024 06:25:23 -0800 Subject: [PATCH 16/18] Update NSLGameScanner.py --- NSLGameScanner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 48b6ef6..163af71 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -1021,8 +1021,8 @@ if new_shortcuts_added or shortcuts_updated: # Create the path to the output file output_file_path = f"{logged_in_home}/.config/systemd/user/NSLGameScanner_output.log" - # Open the output file in append mode - with open(output_file_path, 'a') as output_file: + # Open the output file in write mode + with open(output_file_path, 'w') as output_file: for game in games: # Skip if 'appname' or 'exe' is None if game.get('appname') is None or game.get('exe') is None: From bf5a8a1548cbb55a0afe3f932a44dcc76d2508c6 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Sun, 18 Feb 2024 22:47:04 -0800 Subject: [PATCH 17/18] disbaled steam restart if Decky Plugin test --- NonSteamLaunchers.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/NonSteamLaunchers.sh b/NonSteamLaunchers.sh index 97e1277..68d8db1 100755 --- a/NonSteamLaunchers.sh +++ b/NonSteamLaunchers.sh @@ -2720,14 +2720,14 @@ fi -# Detach script from Steam process -nohup sh -c 'sleep 10; /usr/bin/steam' & +# Directory to be checked +dir="${logged_in_home}/homebrew/plugins/NonSteamLaunchersDecky" -# Define the directory -dir="${logged_in_home}/homebrew/NonSteamLaunchersDecky/" - -# Check if the directory does not exist +# Check if directory does not exist if [ ! -d "$dir" ]; then + # Detach script from Steam process + nohup sh -c 'sleep 10; /usr/bin/steam' & + # Close all instances of Steam steam_pid() { pgrep -x steam ; } steam_running=$(steam_pid) @@ -2735,8 +2735,6 @@ if [ ! -d "$dir" ]; then # Wait for the steam process to exit while steam_pid > /dev/null; do sleep 5; done -else - echo "Directory $dir exists. Not restarting Steam." fi @@ -2749,6 +2747,8 @@ fi + + #Setup NSLGameScanner.service python_script_path="${logged_in_home}/.config/systemd/user/NSLGameScanner.py" From 4cc95df69cd864f8584de64b1c1f8165125b24f8 Mon Sep 17 00:00:00 2001 From: Roy <88516395+moraroy@users.noreply.github.com> Date: Mon, 19 Feb 2024 22:19:57 -0800 Subject: [PATCH 18/18] fixed controller config path --- NSLGameScanner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NSLGameScanner.py b/NSLGameScanner.py index 163af71..618d2fb 100644 --- a/NSLGameScanner.py +++ b/NSLGameScanner.py @@ -923,7 +923,7 @@ if new_shortcuts_added or shortcuts_updated: file.write(vdf.binary_dumps(shortcuts)) # Load the configset_controller_neptune.vdf file - with open(controller_config_path, 'r') as f: + with open(f"{controller_config_path}", 'r') as f: config = vdf.load(f) # Add new entries for the games @@ -1006,7 +1006,7 @@ if new_shortcuts_added or shortcuts_updated: } # Save the updated config - with open(controller_config_path, 'w') as f: + with open(f"{controller_config_path}", 'w') as f: vdf.dump(config, f) # Print the created shortcuts