forked from Mirrors/RGSX
- corrected: ports/RGSX/config.py
- add automatic create of api keys .txt files in saves folder
This commit is contained in:
@@ -34,7 +34,7 @@ from controls_mapper import map_controls, draw_controls_mapping, get_actions
|
||||
from controls import load_controls_config
|
||||
from utils import (
|
||||
load_sources, check_extension_before_download, extract_zip_data,
|
||||
play_random_music, load_music_config
|
||||
play_random_music, load_music_config, load_api_keys
|
||||
)
|
||||
from history import load_history, save_history
|
||||
from config import OTA_data_ZIP
|
||||
@@ -58,6 +58,13 @@ except Exception as e:
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Ensure API key files (1Fichier, AllDebrid, RealDebrid) exist at startup so user can fill them before any download
|
||||
try: # pragma: no cover
|
||||
load_api_keys(False)
|
||||
logger.debug("API key files ensured at startup")
|
||||
except Exception as _e:
|
||||
logger.warning(f"Cannot prepare API key files early: {_e}")
|
||||
|
||||
# Mise à jour de la gamelist Windows avant toute initialisation graphique (évite les conflits avec ES)
|
||||
def _run_windows_gamelist_update():
|
||||
try:
|
||||
|
||||
@@ -793,7 +793,16 @@ async def download_from_1fichier(url, platform, game_name, is_zip_non_supported=
|
||||
if "error" in file_info and file_info["error"] == "Resource not found":
|
||||
logger.error(f"Le fichier {game_name} n'existe pas sur 1fichier")
|
||||
result[0] = False
|
||||
result[1] = f"1F: {_("network_file_not_found").format(game_name)}" if _ else f"1F: File not found {game_name}"
|
||||
try:
|
||||
if _:
|
||||
# Build translated message safely without nesting quotes in f-string
|
||||
not_found_tpl = _("network_file_not_found")
|
||||
msg_nf = not_found_tpl.format(game_name) if "{" in not_found_tpl else f"{not_found_tpl} {game_name}"
|
||||
result[1] = f"1F: {msg_nf}"
|
||||
else:
|
||||
result[1] = f"1F: File not found {game_name}"
|
||||
except Exception:
|
||||
result[1] = f"1F: File not found {game_name}"
|
||||
return
|
||||
filename = file_info.get("filename", "").strip()
|
||||
if not filename:
|
||||
|
||||
@@ -15,6 +15,7 @@ import re
|
||||
|
||||
# IMPORTANT: Avoid importing display/pygame modules for headless mode
|
||||
import config # paths, settings, SAVE_FOLDER, etc.
|
||||
from utils import load_api_keys as _prime_api_keys # ensure API key files are created
|
||||
import network as network_mod # for progress_queues access
|
||||
from utils import load_sources, load_games, is_extension_supported, load_extensions_json, sanitize_filename, extract_zip_data
|
||||
from history import load_history, save_history, add_to_history
|
||||
@@ -23,6 +24,12 @@ from rgsx_settings import get_sources_zip_url
|
||||
|
||||
logger = logging.getLogger("rgsx.cli")
|
||||
|
||||
# Ensure API key files exist early so users can edit them without triggering a download first.
|
||||
try: # pragma: no cover
|
||||
_prime_api_keys(False)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
# Unified size display helper: preserve pre-formatted locale strings (MiB, GiB, Go, Mo, Ko, MB, KB, bytes).
|
||||
# If numeric (int/float or pure digit string), convert to binary units with suffix B, KiB, MiB, GiB.
|
||||
|
||||
Reference in New Issue
Block a user