mirror of
https://github.com/aclist/dztui.git
synced 2026-10-31 07:02:50 +01:00
feat: convert appid to name
This commit is contained in:
1 parent
eff31e2bd3
commit
8652259053
2 files changed
+23
-4
No files matched your search
+22
-4
@@ -23,9 +23,15 @@ from dzgui.const.constants import (
|
|||||||
REQUEST_TIMEOUT,
|
REQUEST_TIMEOUT,
|
||||||
VDF_PATH,
|
VDF_PATH,
|
||||||
)
|
)
|
||||||
from dzgui.const.endpoints import SUB_ENDPOINT, STEAM_PUBLISHED_FILES, UNSUB_ENDPOINT
|
from dzgui.const.endpoints import (
|
||||||
|
APP_DETAILS,
|
||||||
|
SUB_ENDPOINT,
|
||||||
|
STEAM_PUBLISHED_FILES,
|
||||||
|
UNSUB_ENDPOINT,
|
||||||
|
)
|
||||||
from dzgui.strings import wizard
|
from dzgui.strings import wizard
|
||||||
from dzgui.util.bash import concat_bash_args
|
from dzgui.util.bash import concat_bash_args
|
||||||
|
from dzgui.util.strings import unknown
|
||||||
|
|
||||||
logger = logging.getLogger(APP_NAME)
|
logger = logging.getLogger(APP_NAME)
|
||||||
|
|
||||||
@@ -292,9 +298,9 @@ def _get_running_app() -> int | None:
|
|||||||
if registry is None:
|
if registry is None:
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
return int(registry["Registry"]["HKCU"]["Software"]["Valve"]["Steam"][
|
return int(
|
||||||
"RunningAppID"
|
registry["Registry"]["HKCU"]["Software"]["Valve"]["Steam"]["RunningAppID"]
|
||||||
])
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -391,3 +397,15 @@ def get_app_path(folders_path: Path, appid: int) -> Path:
|
|||||||
)
|
)
|
||||||
|
|
||||||
return Path(app_path)
|
return Path(app_path)
|
||||||
|
|
||||||
|
|
||||||
|
def get_app_name(appid: int) -> str:
|
||||||
|
payload = {"appids": [appid]}
|
||||||
|
res = requests.get(APP_DETAILS, params=payload)
|
||||||
|
if res.status_code != 200:
|
||||||
|
return unknown
|
||||||
|
try:
|
||||||
|
return res.json()[str(appid)]["data"]["name"]
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
return unknown
|
||||||
@@ -5,6 +5,7 @@ STEAM_PUBLISHED_FILES = (
|
|||||||
STEAM_SERVERS = "https://api.steampowered.com/IGameServersService/GetServerList/v1"
|
STEAM_SERVERS = "https://api.steampowered.com/IGameServersService/GetServerList/v1"
|
||||||
SUB_ENDPOINT = "https://api.steampowered.com/IPublishedFileService/Subscribe/v1"
|
SUB_ENDPOINT = "https://api.steampowered.com/IPublishedFileService/Subscribe/v1"
|
||||||
UNSUB_ENDPOINT = "https://api.steampowered.com/IPublishedFileService/Unsubscribe/v1"
|
UNSUB_ENDPOINT = "https://api.steampowered.com/IPublishedFileService/Unsubscribe/v1"
|
||||||
|
APP_DETAILS = "https://store.steampowered.com/api/appdetails?"
|
||||||
|
|
||||||
BM_SERVERS = "https://api.battlemetrics.com/servers?"
|
BM_SERVERS = "https://api.battlemetrics.com/servers?"
|
||||||
GITHUB = "https://github.com/aclist"
|
GITHUB = "https://github.com/aclist"
|
||||||
|
|||||||
Reference in new issue
Block a user