add caching
Package Application with PyInstaller / build (push) Failing after 45s

This commit is contained in:
LunaChocken
2025-06-09 16:07:29 +01:00
parent d8a49d04a3
commit a4f0e5eece
5 changed files with 153 additions and 14 deletions
+66 -12
View File
@@ -6,6 +6,10 @@ from rich.columns import Columns
from rich.panel import Panel
import src.vdfparser as vd
from src.prompt_helper import PromptHelper
# Commandline options support
import argparse
class TableItem:
def __init__(self, name, data='', colour='white', type='desc'):
@@ -25,11 +29,19 @@ class TableItem:
def __str__(self):
return f"\n[white]{self.name}[/white]: [{self.colour}]"+self.generate_link()+""
class SteamGamePathTool:
def __init__(self):
self.steam_path = vd.fetch_steam_path()
# arg mode means user input will be skipped and take all args from command line
def __init__(self, steamPath=vd.fetch_steam_path(), arg_mode_enabled=None, game_name=None, game_id=None, all=False):
self.steam_path = steamPath
self.steam_vdf_path = vd.fetch_steam_vdf()
# arg support
self.arg_mode_enabled = arg_mode_enabled
self.game_name = game_name
self.game_id = game_id
self.all = all
if self.steam_vdf_path is None:
print("Steam VDF file not found")
# Add user input to attempt to find
@@ -43,10 +55,13 @@ class SteamGamePathTool:
games = vd.fetchall_vdfs(self.steam_vdf)
self.games = self.sort_games(games)
self.prompter = PromptHelper(games)
for library in self.steam_library_locations:
print(f"[+] Found Steam library at: {library}")
self.prompter = PromptHelper(games)
if arg_mode_enabled:
self.arg_mode()
return
while True:
self.prompt_user()
try:
@@ -55,6 +70,26 @@ class SteamGamePathTool:
print("\nExiting...")
break
def arg_mode(self):
if self.all:
console = Console()
game_rend = [Panel(self.get_game_content(game), expand=True) for game in self.games]
console.print(Columns(game_rend))
return
if self.game_id:
game = self.prompter.find_game_num(self.game_id)
elif self.game_name:
game = self.prompter.find_game_str(self.game_name)
else:
return
console = Console()
data = self.get_game_content(game)
if data:
console.print(Panel(data, expand=True))
else:
console.print("No game found")
def prompt_user(self):
game = self.prompter.prompt_game(text="Input (game name | appid | all | q/quit): ")
if game is None:
@@ -79,15 +114,34 @@ class SteamGamePathTool:
:return: string formatted for table using rich library
"""
# Spaces must be replaced with %20 otherwise they won't link properly
string = f"""[b]{game['name']}[/b]"""
string+=str(TableItem(name="Game acf", data=f"{game['acf_path'].replace(' ', '%20')}", colour="green",type="file"))
string+=str(TableItem(name="Game Path", data=f"{game['true_path'].replace(' ', '%20')}", colour="blue",type="dir"))
if game['workshop_path']:
string+=str(TableItem(name="Game Workshop Path", data=f"{game['workshop_path'].replace(' ', '%20')}", colour="blue", type="dir"))
if game["compatdata_path"]:
string+=str(TableItem(name="Game Compatdata Path",data=f"{game['compatdata_path'].replace(' ', '%20')}",colour="blue",type="dir"))
try:
string = f"""[b]{game['name']}[/b]"""
string+=str(TableItem(name="Game ID", data=f"{game['appid']}", colour="blue",type="desc"))
string+=str(TableItem(name="Game acf", data=f"{game['acf_path'].replace(' ', '%20')}", colour="green",type="file"))
string+=str(TableItem(name="Game Path", data=f"{game['true_path'].replace(' ', '%20')}", colour="blue",type="dir"))
if game['workshop_path']:
string+=str(TableItem(name="Game Workshop Path", data=f"{game['workshop_path'].replace(' ', '%20')}", colour="blue", type="dir"))
if game["compatdata_path"]:
string+=str(TableItem(name="Game Compatdata Path",data=f"{game['compatdata_path'].replace(' ', '%20')}",colour="blue",type="dir"))
except TypeError:
return None
return string
if __name__ == "__main__":
steam_path_tool = SteamGamePathTool()
print("""Welcome to S-Path
A tool to print the locations of steam games, their respective gameID, workshop path, etc.""")
parser = argparse.ArgumentParser()
parser.add_argument('--name', help='Game name to search for')
parser.add_argument('--id', help='Game ID to search for')
# parser.add_argument('--help', help='Display help message')
parser.add_argument('--steam-path', help='Steam path to use')
parser.add_argument('--all', help='Displays all games installed', action='store_true')
args = parser.parse_args()
if args.name or args.id or args.all:
steam_path_tool = SteamGamePathTool(game_id=args.id, game_name=args.name, arg_mode_enabled=True, all=args.all)
else:
steam_path_tool = SteamGamePathTool()