mirror of
https://github.com/aclist/dztui.git
synced 2026-08-29 19:27:13 +02:00
fix: invoke steam client directly (#348)
This commit is contained in:
parent
8ee3b36816
commit
a966993999
@ -73,14 +73,9 @@ def get_local_signatures(version_file: Path) -> dict[str, int]:
|
|||||||
return hashes
|
return hashes
|
||||||
|
|
||||||
|
|
||||||
def enqueue_mod(mod: str, appid: int) -> None:
|
def enqueue_mod(client: str, mod: str, appid: int) -> None:
|
||||||
args = [
|
client_args = concat_bash_args(client)
|
||||||
"steam",
|
subprocess.Popen([*client_args, "+workshop_download_item", str(appid), mod])
|
||||||
f"steam://url/CommunityFilePage/{mod}+workshop_download_item",
|
|
||||||
str(appid),
|
|
||||||
mod,
|
|
||||||
]
|
|
||||||
subprocess.Popen(["/usr/bin/env", "bash", *args])
|
|
||||||
|
|
||||||
|
|
||||||
def get_needs_update(
|
def get_needs_update(
|
||||||
@ -146,7 +141,7 @@ def connect(client: str, addr: str, appid: int, name: str, mods: list[str]) -> i
|
|||||||
return proc.returncode
|
return proc.returncode
|
||||||
|
|
||||||
|
|
||||||
def load_to_menu(client: str, addr: str, appid: int, name: str, mods: list[str]) -> int:
|
def load_to_menu(client: str, appid: int, name: str, mods: list[str]) -> int:
|
||||||
"""Loads to the menu screen with the selected mods; used for AFK/pre-joining"""
|
"""Loads to the menu screen with the selected mods; used for AFK/pre-joining"""
|
||||||
concat = concat_mods(mods)
|
concat = concat_mods(mods)
|
||||||
client_args = concat_bash_args(client)
|
client_args = concat_bash_args(client)
|
||||||
|
|||||||
@ -88,6 +88,7 @@ class ConnectionManager:
|
|||||||
self.record: Record
|
self.record: Record
|
||||||
self.workshop: Path
|
self.workshop: Path
|
||||||
|
|
||||||
|
self.client: str
|
||||||
self.remote_mod_ids: list[str] = []
|
self.remote_mod_ids: list[str] = []
|
||||||
self.missing_mods: list[tuple[str, str, int, int]] = []
|
self.missing_mods: list[tuple[str, str, int, int]] = []
|
||||||
|
|
||||||
@ -171,6 +172,7 @@ class ConnectionManager:
|
|||||||
client = self.controller.query_config(Preferences.CLIENT)
|
client = self.controller.query_config(Preferences.CLIENT)
|
||||||
running = is_steam_running(client)
|
running = is_steam_running(client)
|
||||||
steam_proc = SteamProcess(client_name, running)
|
steam_proc = SteamProcess(client_name, running)
|
||||||
|
self.client = client
|
||||||
|
|
||||||
game_mode = prefs.is_game_mode
|
game_mode = prefs.is_game_mode
|
||||||
|
|
||||||
@ -263,11 +265,10 @@ class ConnectionManager:
|
|||||||
def _connect_steam(self, menu_only: bool) -> None:
|
def _connect_steam(self, menu_only: bool) -> None:
|
||||||
addr = f"{self.record.ip}:{self.record.gameport}"
|
addr = f"{self.record.ip}:{self.record.gameport}"
|
||||||
playername = self.controller.query_config(Preferences.NAME)
|
playername = self.controller.query_config(Preferences.NAME)
|
||||||
client = self.controller.query_config(Preferences.CLIENT)
|
|
||||||
if menu_only:
|
if menu_only:
|
||||||
rc = load_to_menu(client, addr, self.appid, playername, self.remote_mod_ids)
|
rc = load_to_menu(self.client, self.appid, playername, self.remote_mod_ids)
|
||||||
else:
|
else:
|
||||||
rc = connect(client, addr, self.appid, playername, self.remote_mod_ids)
|
rc = connect(self.client, addr, self.appid, playername, self.remote_mod_ids)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
# TODO: log/pop the error
|
# TODO: log/pop the error
|
||||||
func = StoredFunc(self.controller.update_status)
|
func = StoredFunc(self.controller.update_status)
|
||||||
@ -298,7 +299,8 @@ class ConnectionManager:
|
|||||||
for title, mod, stamp, size in self.missing_mods:
|
for title, mod, stamp, size in self.missing_mods:
|
||||||
if self.controller.is_cancel_pending():
|
if self.controller.is_cancel_pending():
|
||||||
return
|
return
|
||||||
enqueue_mod(mod, self.appid)
|
enqueue_mod(self.client, mod, self.appid)
|
||||||
|
# NOTE: prevents rate limiting
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
if raise_window is True:
|
if raise_window is True:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user