feat(egs-api): add Steam ID
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
@ -14,7 +14,7 @@ from portprotonqt.logger import get_logger
|
||||
from portprotonqt.image_utils import load_pixmap_async
|
||||
from portprotonqt.time_utils import parse_playtime_file, format_playtime, get_last_launch, get_last_launch_timestamp
|
||||
from portprotonqt.config_utils import get_portproton_location
|
||||
from portprotonqt.steam_api import get_weanticheatyet_status_async
|
||||
from portprotonqt.steam_api import get_weanticheatyet_status_async, get_steam_apps_and_index_async, get_protondb_tier_async, search_app
|
||||
|
||||
from PySide6.QtGui import QPixmap
|
||||
|
||||
@ -354,6 +354,7 @@ def load_egs_games_async(legendary_path: str, callback: Callable[[list[tuple]],
|
||||
"""
|
||||
Асинхронно загружает Epic Games Store игры с использованием legendary CLI.
|
||||
Читает статистику времени игры и последнего запуска из файла statistics.
|
||||
Проверяет наличие игры в Steam для получения ProtonDB статуса.
|
||||
"""
|
||||
logger.debug("Starting to load Epic Games Store games")
|
||||
games: list[tuple] = []
|
||||
@ -489,6 +490,12 @@ def _continue_loading_egs_games(legendary_path: str, callback: Callable[[list[tu
|
||||
image_folder = os.path.join(os.getenv("XDG_CACHE_HOME", os.path.join(os.path.expanduser("~"), ".cache")), "PortProtonQt", "images")
|
||||
local_path = os.path.join(image_folder, f"{app_name}.jpg") if cover_url else ""
|
||||
|
||||
def on_steam_apps(steam_data: tuple[list, dict]):
|
||||
steam_apps, steam_apps_index = steam_data
|
||||
matching_app = search_app(title, steam_apps_index)
|
||||
steam_appid = matching_app.get("appid") if matching_app else None
|
||||
|
||||
def on_protondb_tier(protondb_tier: str):
|
||||
def on_description_fetched(api_description: str):
|
||||
final_description = api_description or _("No description available")
|
||||
|
||||
@ -505,7 +512,7 @@ def _continue_loading_egs_games(legendary_path: str, callback: Callable[[list[tu
|
||||
"",
|
||||
last_launch, # Время последнего запуска
|
||||
formatted_playtime, # Форматированное время игры
|
||||
"",
|
||||
protondb_tier, # ProtonDB tier
|
||||
status or "",
|
||||
last_launch_timestamp, # Временная метка последнего запуска
|
||||
playtime_seconds, # Время игры в секундах
|
||||
@ -523,6 +530,15 @@ def _continue_loading_egs_games(legendary_path: str, callback: Callable[[list[tu
|
||||
|
||||
get_egs_game_description_async(title, on_description_fetched)
|
||||
|
||||
if steam_appid:
|
||||
logger.info(f"Found Steam appid {steam_appid} for EGS game {title}")
|
||||
get_protondb_tier_async(steam_appid, on_protondb_tier)
|
||||
else:
|
||||
logger.debug(f"No Steam app found for EGS game {title}")
|
||||
on_protondb_tier("") # Proceed with empty ProtonDB tier
|
||||
|
||||
get_steam_apps_and_index_async(on_steam_apps)
|
||||
|
||||
max_workers = min(4, len(valid_games))
|
||||
with ThreadPoolExecutor(max_workers=max_workers) as executor:
|
||||
for i, game in enumerate(valid_games):
|
||||
|
Reference in New Issue
Block a user