mirror of
https://github.com/aclist/dztui.git
synced 2026-08-30 03:37:00 +02:00
Compare commits
6 Commits
03bd92c24a
...
33c4f6e526
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33c4f6e526 | ||
|
|
6a3b4b2bfb | ||
|
|
8652259053 | ||
|
|
e92df8c062 | ||
|
|
eff31e2bd3 | ||
|
|
494311e8df |
@ -1,4 +1,3 @@
|
|||||||
import json
|
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
@ -404,7 +403,6 @@ def get_pefile_path(steam_path: Path, appid: int) -> Path:
|
|||||||
return pe_path
|
return pe_path
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_pretty_version(steam_path: Path, appid: int) -> str | None:
|
def get_pretty_version(steam_path: Path, appid: int) -> str | None:
|
||||||
try:
|
try:
|
||||||
pe_file_path = get_pefile_path(steam_path, appid)
|
pe_file_path = get_pefile_path(steam_path, appid)
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import psutil
|
import psutil
|
||||||
import requests
|
import requests
|
||||||
import subprocess
|
import subprocess
|
||||||
import vdf
|
import vdf # type: ignore
|
||||||
|
|
||||||
from shlex import shlex
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Union
|
from typing import Any, Union
|
||||||
from warnings import deprecated
|
from warnings import deprecated
|
||||||
@ -25,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)
|
||||||
|
|
||||||
@ -260,7 +264,7 @@ def enqueue_mod(client: str, mod: str, appid: int) -> None:
|
|||||||
|
|
||||||
|
|
||||||
@deprecated("Cf. https://github.com/ValveSoftware/steam-for-linux/issues/9672")
|
@deprecated("Cf. https://github.com/ValveSoftware/steam-for-linux/issues/9672")
|
||||||
def get_registry() -> dict[str, Any] | None:
|
def get_registry() -> Any | None:
|
||||||
home = os.getenv("HOME")
|
home = os.getenv("HOME")
|
||||||
try:
|
try:
|
||||||
with open(f"{home}/.steam/registry.vdf") as f:
|
with open(f"{home}/.steam/registry.vdf") as f:
|
||||||
@ -294,9 +298,9 @@ def _get_running_app() -> int | None:
|
|||||||
if registry is None:
|
if registry is None:
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
return registry["Registry"]["HKCU"]["Software"]["Valve"]["Steam"][
|
return int(
|
||||||
"RunningAppID"
|
registry["Registry"]["HKCU"]["Software"]["Valve"]["Steam"]["RunningAppID"]
|
||||||
]
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -319,7 +323,7 @@ def get_running_app() -> int | None:
|
|||||||
args = proc.cmdline()
|
args = proc.cmdline()
|
||||||
appid = (row for row in args if FLAG in row)
|
appid = (row for row in args if FLAG in row)
|
||||||
try:
|
try:
|
||||||
return str(next(appid).split("=")[1])
|
return int(next(appid).split("=")[1])
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
return None
|
return None
|
||||||
return None
|
return None
|
||||||
@ -393,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 str(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"
|
||||||
|
|||||||
@ -3,11 +3,8 @@ import subprocess
|
|||||||
import shutil
|
import shutil
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from warnings import deprecated
|
|
||||||
|
|
||||||
from dzgui.const.constants import (
|
from dzgui.const.constants import (
|
||||||
APP_NAME,
|
APP_NAME,
|
||||||
DAYZ_BINARY,
|
|
||||||
STEAM_CMD,
|
STEAM_CMD,
|
||||||
FLATPAK_APPID,
|
FLATPAK_APPID,
|
||||||
FLATPAK_CMD,
|
FLATPAK_CMD,
|
||||||
@ -15,8 +12,6 @@ from dzgui.const.constants import (
|
|||||||
FLATPAK_SANDBOX,
|
FLATPAK_SANDBOX,
|
||||||
)
|
)
|
||||||
|
|
||||||
from dzgui.util.format import format_exception
|
|
||||||
|
|
||||||
logger = logging.getLogger(APP_NAME)
|
logger = logging.getLogger(APP_NAME)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -55,8 +55,11 @@ class ConfigManager:
|
|||||||
self.update_config(Preferences.IP_LIST, ips)
|
self.update_config(Preferences.IP_LIST, ips)
|
||||||
|
|
||||||
def update_history_file(self, fqip: str) -> None:
|
def update_history_file(self, fqip: str) -> None:
|
||||||
with open(self.prefs.paths.history, "r") as f:
|
try:
|
||||||
ips = [line.rstrip() for line in f.readlines()]
|
with open(self.prefs.paths.history, "r") as f:
|
||||||
|
ips = [line.rstrip() for line in f.readlines()]
|
||||||
|
except FileNotFoundError:
|
||||||
|
ips = []
|
||||||
|
|
||||||
seen = set()
|
seen = set()
|
||||||
ips.append(fqip)
|
ips.append(fqip)
|
||||||
|
|||||||
@ -141,7 +141,7 @@ class ModManager:
|
|||||||
app_path_exp = PeFile.get_nested_app_path(steam_path, APPID_DAYZ_EXP)
|
app_path_exp = PeFile.get_nested_app_path(steam_path, APPID_DAYZ_EXP)
|
||||||
symlink = app_path_exp / md5
|
symlink = app_path_exp / md5
|
||||||
symlink.unlink()
|
symlink.unlink()
|
||||||
except PeFile.AppNotInstalledError:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
time.sleep(API_RATE_LIMIT)
|
time.sleep(API_RATE_LIMIT)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user