-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsteamcmd_check_app_update.py
More file actions
45 lines (34 loc) · 1.52 KB
/
steamcmd_check_app_update.py
File metadata and controls
45 lines (34 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from scriptlets.steam.steamcmd_get_app_details import *
from scriptlets.steam.steamcmd_parse_manifest import *
def steamcmd_check_app_update(app_manifest: str):
if not os.path.exists(app_manifest):
print(f"App manifest file {app_manifest} does not exist.", file=sys.stderr)
return False
# App manifest is a local copy of the app JSON data
with open(app_manifest, 'r') as f:
details = steamcmd_parse_manifest(f.read())
if 'AppState' not in details:
print(f"Invalid app manifest format in {app_manifest}.", file=sys.stderr)
return False
# Pull local data about the installed game from its manifest file
app_id = details['AppState']['appid']
build_id = details['AppState']['buildid']
if 'MountedConfig' in details['AppState'] and 'BetaKey' in details['AppState']['MountedConfig']:
branch = details['AppState']['MountedConfig']['BetaKey']
else:
branch = 'public'
# Pull the latest app details from SteamCMD
details = steamcmd_get_app_details(app_id)
# Ensure some basic data integrity
if 'depots' not in details:
print(f"No depot information found for app {app_id}.", file=sys.stderr)
return False
if 'branches' not in details['depots']:
print(f"No branch information found for app {app_id}.", file=sys.stderr)
return False
if branch not in details['depots']['branches']:
print(f"Branch {branch} not found for app {app_id}.", file=sys.stderr)
return False
# Just check if the build IDs differ
available_build_id = details['depots']['branches'][branch]['buildid']
return build_id != available_build_id