mirror of
https://github.com/aclist/dztui.git
synced 2026-08-29 11:17:12 +02:00
Compare commits
No commits in common. "6a3b4b2bfb72f2a76d55865d7cf3bfbb0b1996bc" and "a2d1f9b0e185c80b2f023b8db49f84ed7517432c" have entirely different histories.
6a3b4b2bfb
...
a2d1f9b0e1
@ -1,3 +1,4 @@
|
||||
import json
|
||||
import struct
|
||||
|
||||
from dataclasses import dataclass
|
||||
@ -403,6 +404,7 @@ def get_pefile_path(steam_path: Path, appid: int) -> Path:
|
||||
return pe_path
|
||||
|
||||
|
||||
|
||||
def get_pretty_version(steam_path: Path, appid: int) -> str | None:
|
||||
try:
|
||||
pe_file_path = get_pefile_path(steam_path, appid)
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import psutil
|
||||
import requests
|
||||
import subprocess
|
||||
import vdf # type: ignore
|
||||
import vdf
|
||||
|
||||
from shlex import shlex
|
||||
from pathlib import Path
|
||||
from typing import Any, Union
|
||||
from warnings import deprecated
|
||||
@ -23,15 +25,9 @@ from dzgui.const.constants import (
|
||||
REQUEST_TIMEOUT,
|
||||
VDF_PATH,
|
||||
)
|
||||
from dzgui.const.endpoints import (
|
||||
APP_DETAILS,
|
||||
SUB_ENDPOINT,
|
||||
STEAM_PUBLISHED_FILES,
|
||||
UNSUB_ENDPOINT,
|
||||
)
|
||||
from dzgui.const.endpoints import SUB_ENDPOINT, STEAM_PUBLISHED_FILES, UNSUB_ENDPOINT
|
||||
from dzgui.strings import wizard
|
||||
from dzgui.util.bash import concat_bash_args
|
||||
from dzgui.util.strings import unknown
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
@ -264,7 +260,7 @@ def enqueue_mod(client: str, mod: str, appid: int) -> None:
|
||||
|
||||
|
||||
@deprecated("Cf. https://github.com/ValveSoftware/steam-for-linux/issues/9672")
|
||||
def get_registry() -> Any | None:
|
||||
def get_registry() -> dict[str, Any] | None:
|
||||
home = os.getenv("HOME")
|
||||
try:
|
||||
with open(f"{home}/.steam/registry.vdf") as f:
|
||||
@ -298,9 +294,9 @@ def _get_running_app() -> int | None:
|
||||
if registry is None:
|
||||
return None
|
||||
try:
|
||||
return int(
|
||||
registry["Registry"]["HKCU"]["Software"]["Valve"]["Steam"]["RunningAppID"]
|
||||
)
|
||||
return registry["Registry"]["HKCU"]["Software"]["Valve"]["Steam"][
|
||||
"RunningAppID"
|
||||
]
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
@ -323,7 +319,7 @@ def get_running_app() -> int | None:
|
||||
args = proc.cmdline()
|
||||
appid = (row for row in args if FLAG in row)
|
||||
try:
|
||||
return int(next(appid).split("=")[1])
|
||||
return str(next(appid).split("=")[1])
|
||||
except StopIteration:
|
||||
return None
|
||||
return None
|
||||
@ -397,15 +393,3 @@ def get_app_path(folders_path: Path, appid: int) -> 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 str(res.json()[str(appid)]["data"]["name"])
|
||||
except Exception as e:
|
||||
logger.debug(e)
|
||||
return unknown
|
||||
|
||||
@ -5,7 +5,6 @@ STEAM_PUBLISHED_FILES = (
|
||||
STEAM_SERVERS = "https://api.steampowered.com/IGameServersService/GetServerList/v1"
|
||||
SUB_ENDPOINT = "https://api.steampowered.com/IPublishedFileService/Subscribe/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?"
|
||||
GITHUB = "https://github.com/aclist"
|
||||
|
||||
@ -3,8 +3,11 @@ import subprocess
|
||||
import shutil
|
||||
import logging
|
||||
|
||||
from warnings import deprecated
|
||||
|
||||
from dzgui.const.constants import (
|
||||
APP_NAME,
|
||||
DAYZ_BINARY,
|
||||
STEAM_CMD,
|
||||
FLATPAK_APPID,
|
||||
FLATPAK_CMD,
|
||||
@ -12,6 +15,8 @@ from dzgui.const.constants import (
|
||||
FLATPAK_SANDBOX,
|
||||
)
|
||||
|
||||
from dzgui.util.format import format_exception
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
|
||||
@ -141,7 +141,7 @@ class ModManager:
|
||||
app_path_exp = PeFile.get_nested_app_path(steam_path, APPID_DAYZ_EXP)
|
||||
symlink = app_path_exp / md5
|
||||
symlink.unlink()
|
||||
except Exception:
|
||||
except PeFile.AppNotInstalledError:
|
||||
pass
|
||||
time.sleep(API_RATE_LIMIT)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user