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
+6
View File
@@ -1,6 +1,9 @@
import os
import vdf
from cachier import cachier
import datetime
@cachier(stale_after=datetime.timedelta(days=1))
def parse_vdf(steam_vdf_path) -> dict:
"""
Reads the Steam vdf file at the given path and returns the corresponding dict.
@@ -11,6 +14,7 @@ def parse_vdf(steam_vdf_path) -> dict:
vdf_data = vdf.loads(open(steam_vdf_path, 'r').read())
return vdf_data
@cachier(stale_after=datetime.timedelta(days=1))
def fetch_ids(vdf_json: dict):
"""
Prints all Steam app IDs from the given vdf data.
@@ -76,11 +80,13 @@ def find_extra_locations(vdf_json):
return steam_library_locations
# Reads manifest of individual game vdfs
@cachier(stale_after=datetime.timedelta(days=1), cache_dir='/tmp/.cache')
def read_game_vdf(gameID: int, steam_vdf_json: dict, path, game) -> dict:
with open(os.path.join(path, game), 'r') as f:
game_vdf = vdf.loads(f.read())
return game_vdf['AppState']
@cachier(stale_after=datetime.timedelta(days=1), cache_dir='/tmp/.cache')
def fetchall_vdfs(steam_vdf_json: dict):
"""
Reads all Steam game manifests in the given Steam VDF data and returns a list of dictionaries containing information about each game.