Advertisement
DeaD_EyE

Steam: show state of fossilize_replay (tested on Linux)

May 4th, 2024
634
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. import time
  2.  
  3. from functools import cache
  4. from pathlib import Path
  5.  
  6. import requests
  7. from psutil import process_iter
  8.  
  9.  
  10. @cache
  11. def appids():
  12.     return {
  13.         app["appid"]: app["name"]
  14.         for app in requests.get(
  15.             "https://api.steampowered.com/ISteamApps/GetAppList/v2/"
  16.         ).json()["applist"]["apps"]
  17.     }
  18.  
  19.  
  20. def appids_shadercache():
  21.     for process in process_iter():
  22.         if process.name() != "fossilize_replay":
  23.             continue
  24.         cmd = Path(process.cmdline()[1])
  25.         idx = cmd.parts.index("shadercache")
  26.         yield int(cmd.parts[idx + 1])
  27.  
  28.  
  29. def names_shadercache():
  30.     return [appids().get(appid, "Unknown") for appid in appids_shadercache()]
  31.  
  32.  
  33. if __name__ == "__main__":
  34.     while True:
  35.         print("\033c", end="")
  36.         print("\n".join(sorted(set(names_shadercache())) or ["Idle"]))
  37.         time.sleep(5)
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement