Add files via upload

This commit is contained in:
FatihMakes authored and GitHub committed 2026-07-05 18:01:31 +03:00
1 parent ef6fd7a5f6
commit d178f6b9ee
13 files changed
+1401 -412

No files matched your search

+13 -7
View File
@@ -1,4 +1,5 @@
import os
import platform
import re
import sys
import json
@@ -10,6 +11,11 @@ from datetime import datetime
from config import get_os, is_windows, is_mac, is_linux
_CNW: dict = (
{"creationflags": subprocess.CREATE_NO_WINDOW}
if platform.system() == "Windows" else {}
)
_KNOWN_APPIDS: dict[str, tuple[str, str]] = {
"pubg": ("578080", "PUBG: Battlegrounds"),
"pubg battlegrounds": ("578080", "PUBG: Battlegrounds"),
@@ -168,7 +174,7 @@ def _is_steam_running() -> bool:
try:
if is_windows():
out = subprocess.run(["tasklist", "/FI", "IMAGENAME eq steam.exe"],
capture_output=True, text=True).stdout
capture_output=True, text=True, **_CNW).stdout
return "steam.exe" in out.lower()
proc = "steam_osx" if is_mac() else "steam"
return bool(subprocess.run(["pgrep", "-x", proc],
@@ -621,7 +627,7 @@ def _get_download_status(steam_path: Path) -> str:
def _system_shutdown() -> None:
if is_windows():
subprocess.run(["shutdown", "/s", "/t", "10"])
subprocess.run(["shutdown", "/s", "/t", "10"], **_CNW)
elif is_mac():
subprocess.run(["osascript", "-e", 'tell app "System Events" to shut down'])
else:
@@ -737,7 +743,7 @@ def _is_epic_running() -> bool:
if is_windows():
out = subprocess.run(
["tasklist", "/FI", "IMAGENAME eq EpicGamesLauncher.exe"],
capture_output=True, text=True
capture_output=True, text=True, **_CNW
).stdout
return "epicgameslauncher.exe" in out.lower()
proc = "EpicGamesLauncher" if is_mac() else "heroic"
@@ -801,12 +807,12 @@ def _schedule_daily_update(hour: int = 3, minute: int = 0) -> str:
def _schedule_windows(hour: int, minute: int) -> str:
task_name = "JARVIS_GameUpdater"
script_path = Path(__file__).resolve()
subprocess.run(["schtasks", "/Delete", "/TN", task_name, "/F"], capture_output=True)
subprocess.run(["schtasks", "/Delete", "/TN", task_name, "/F"], capture_output=True, **_CNW)
for extra in (["/RL", "HIGHEST", "/RU", "SYSTEM"], []):
cmd = ["schtasks", "/Create", "/TN", task_name,
"/TR", f'"{sys.executable}" "{script_path}" --scheduled',
"/SC", "DAILY", "/ST", f"{hour:02d}:{minute:02d}", "/F", *extra]
result = subprocess.run(cmd, capture_output=True, text=True)
result = subprocess.run(cmd, capture_output=True, text=True, **_CNW)
if result.returncode == 0:
return f"Daily game update scheduled at {hour:02d}:{minute:02d}."
return f"Scheduling failed: {result.stderr.strip()}"
@@ -870,7 +876,7 @@ def _cancel_scheduled_update() -> str:
if is_windows():
result = subprocess.run(
["schtasks", "/Delete", "/TN", "JARVIS_GameUpdater", "/F"],
capture_output=True, text=True
capture_output=True, text=True, **_CNW
)
return ("Scheduled update cancelled."
if result.returncode == 0 else "No scheduled update found.")
@@ -897,7 +903,7 @@ def _get_schedule_status() -> str:
if is_windows():
result = subprocess.run(
["schtasks", "/Query", "/TN", "JARVIS_GameUpdater", "/FO", "LIST"],
capture_output=True, text=True
capture_output=True, text=True, **_CNW
)
if result.returncode != 0:
return "No scheduled game update found."