diff --git a/.gitea/workflows/pyinstaller_release.yml b/.gitea/workflows/pyinstaller_release.yml index cb99f34..46df5be 100644 --- a/.gitea/workflows/pyinstaller_release.yml +++ b/.gitea/workflows/pyinstaller_release.yml @@ -1,7 +1,9 @@ +# DISABLED + name: release -on: - workflow_dispatch: +# on: +# workflow_dispatch: jobs: release: @@ -16,7 +18,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.11.0' + python-version: "3.11.0" - name: Install dependencies run: > python -m pip install --upgrade pip @@ -30,4 +32,4 @@ jobs: with: files: |- dist/** - api_key: '${{secrets.RELEASE_TOKEN}}' \ No newline at end of file + api_key: "${{secrets.RELEASE_TOKEN}}" diff --git a/main.py b/main.py index 1d99984..5fc48b5 100644 --- a/main.py +++ b/main.py @@ -33,8 +33,11 @@ class SteamGamePathTool: self.prompter = PromptHelper(games) while True: self.prompt_user() - input("Press Enter to continue...") - + try: + input("Press Enter to continue...") + except KeyboardInterrupt: + print("\nExiting...") + break def prompt_user(self): game = self.prompter.prompt_game(text="Input (game name | appid | q/quit): ") @@ -60,7 +63,9 @@ class SteamGamePathTool: [white]Game ID: [yellow]{game['appid']} [white]Game Size: [red]{int(game['SizeOnDisk'])/(1024*1024)/1024:.2f} GB[/red] [white]Game acf: [green][link=file://{game['acf_path'].replace(' ', '%20')}]file[/link][/green] - [white]Game Path: [green][link=file://{game['true_path'].replace(' ', '%20')}]dir[/link][/green]""" + [white]Game Path: [blue][link=file://{game['true_path'].replace(' ', '%20')}]dir[/link][/blue]""" + if game['workshop_path']: + string += f"\n\t[white]Workshop Path: [blue][link=file://{game['workshop_path'].replace(' ', '%20')}]dir[/link][/blue]" if game['compatdata_path']: string += f"\n\t[white]Compatdata dir: [blue][link=file://{game['compatdata_path'].replace(' ', '%20')}]dir[/link][/blue]" return string diff --git a/src/prompt_helper.py b/src/prompt_helper.py index da9e869..8daf62b 100644 --- a/src/prompt_helper.py +++ b/src/prompt_helper.py @@ -25,13 +25,21 @@ class PromptHelper: return None def prompt_game(self, text, default="None"): - response = pt.prompt(text, completer=self.completer, complete_while_typing=True) - if response == "": - return None - elif response == "q" or response == "quit": - print("Goodbye!") + try: + response = pt.prompt(text, completer=self.completer, complete_while_typing=True) + except KeyboardInterrupt: + print("\nCtrl+C received. Exiting.") sys.exit(0) - elif response[0].isalpha(): - return self.find_game_str(response) - else: - return self.find_game_num(response) + try: + if response == "": + return None + elif response == "q" or response == "quit": + print("Goodbye!") + sys.exit(0) + elif response[0].isalpha(): + return self.find_game_str(response) + else: + return self.find_game_num(response) + except ValueError: + print("Invalid input") + return None diff --git a/src/vdfparser.py b/src/vdfparser.py index 7de1a2e..494658c 100644 --- a/src/vdfparser.py +++ b/src/vdfparser.py @@ -27,8 +27,8 @@ def fetch_steam_path() -> str: """ Determines the Steam installation path by checking common locations. - Returns the path to the Steam 'steamapps' directory. - Prefers the path used by the apt installation if it exists. + Returns the path to the Steam 'steamapps' directory. + Prefers the path used by the apt installation if it exists. Otherwise, returns the path used by the Flatpak installation. :return: Path to the Steam 'steamapps' directory @@ -100,6 +100,7 @@ def fetchall_vdfs(steam_vdf_json: dict): parsed_game['root_steam_folder'] = path parsed_game['true_path'] = os.path.join(steamapps, "common", parsed_game['installdir']) parsed_game['compatdata_path'] = os.path.join(steamapps, "compatdata", str(gameID)) if os.path.exists(os.path.join(steamapps, "compatdata", str(gameID))) else None + parsed_game['workshop_path'] = os.path.join(steamapps, "workshop", "content", str(gameID)) if os.path.exists(os.path.join(steamapps, "workshop", "content", str(gameID))) else "" games.append(parsed_game) # print("Game name:", parsed_game['name'], "ID:", gameID, "Path:", parsed_game['true_path']) return games