mirror of
https://github.com/RetroGameSets/RGSX.git
synced 2026-03-19 16:26:00 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fbf936af6 | ||
|
|
5fa606b3de | ||
|
|
179d10facd |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -11,7 +11,6 @@ ports/gamelist.xml
|
||||
prboom/
|
||||
*.log
|
||||
*.rar
|
||||
*.zip
|
||||
.vscode/
|
||||
ports/RGSX.bat
|
||||
.venv/
|
||||
|
||||
@@ -712,7 +712,7 @@ async def main():
|
||||
config.history.append({
|
||||
"platform": platform_name,
|
||||
"game_name": game_name,
|
||||
"status": "downloading",
|
||||
"status": "Downloading",
|
||||
"progress": 0,
|
||||
"url": url,
|
||||
"timestamp": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
@@ -822,7 +822,7 @@ async def main():
|
||||
config.history.append({
|
||||
"platform": platform_name,
|
||||
"game_name": game_name,
|
||||
"status": "downloading",
|
||||
"status": "Downloading",
|
||||
"progress": 0,
|
||||
"message": _("download_in_progress") if _ else "Download in progress",
|
||||
"url": url,
|
||||
@@ -868,7 +868,7 @@ async def main():
|
||||
config.history.append({
|
||||
"platform": platform_name,
|
||||
"game_name": game_name,
|
||||
"status": "downloading",
|
||||
"status": "Downloading",
|
||||
"progress": 0,
|
||||
"message": _("download_in_progress") if _ else "Download in progress",
|
||||
"url": url,
|
||||
@@ -909,7 +909,7 @@ async def main():
|
||||
logger.debug(f"[HISTORY_SEARCH] Searching in {len(config.history)} history entries for url={url[:50]}...")
|
||||
for entry in config.history:
|
||||
#logger.debug(f"[HISTORY_ENTRY] Checking: url_match={entry['url'] == url}, status={entry['status']}, game={entry.get('game_name')}")
|
||||
if entry["url"] == url and entry["status"] in ["downloading", "Téléchargement"]:
|
||||
if entry["url"] == url and entry["status"] in ["Downloading", "Téléchargement"]:
|
||||
#logger.debug(f"[HISTORY_MATCH] Found matching entry for {game_name}, updating status")
|
||||
entry["status"] = "Download_OK" if success else "Erreur"
|
||||
entry["progress"] = 100 if success else 0
|
||||
@@ -941,7 +941,7 @@ async def main():
|
||||
if "http" in message:
|
||||
message = message.split("https://")[0].strip()
|
||||
for entry in config.history:
|
||||
if entry["url"] == url and entry["status"] in ["downloading", "Téléchargement"]:
|
||||
if entry["url"] == url and entry["status"] in ["Downloading", "Téléchargement"]:
|
||||
entry["status"] = "Erreur"
|
||||
entry["progress"] = 0
|
||||
entry["message"] = message
|
||||
@@ -972,7 +972,7 @@ async def main():
|
||||
success, message = data[1], data[2]
|
||||
logger.debug(f"[DOWNLOAD_TASK] Download task done - success={success}, message={message}, task_id={task_id}")
|
||||
for entry in config.history:
|
||||
if entry["url"] == url and entry["status"] in ["downloading", "Téléchargement"]:
|
||||
if entry["url"] == url and entry["status"] in ["Downloading", "Téléchargement"]:
|
||||
entry["status"] = "Download_OK" if success else "Erreur"
|
||||
entry["progress"] = 100 if success else 0
|
||||
entry["message"] = message
|
||||
@@ -1002,7 +1002,7 @@ async def main():
|
||||
downloaded, total_size = data[1], data[2]
|
||||
progress = (downloaded / total_size * 100) if total_size > 0 else 0
|
||||
for entry in config.history:
|
||||
if entry["url"] == url and entry["status"] in ["downloading", "Téléchargement"]:
|
||||
if entry["url"] == url and entry["status"] in ["Downloading", "Téléchargement"]:
|
||||
entry["progress"] = progress
|
||||
entry["status"] = "Téléchargement"
|
||||
config.needs_redraw = True
|
||||
|
||||
@@ -13,7 +13,7 @@ except Exception:
|
||||
pygame = None # type: ignore
|
||||
|
||||
# Version actuelle de l'application
|
||||
app_version = "2.3.0.8"
|
||||
app_version = "2.3.1.0"
|
||||
|
||||
|
||||
def get_application_root():
|
||||
|
||||
@@ -214,10 +214,10 @@ def _launch_next_queued_download():
|
||||
is_1fichier = queue_item['is_1fichier']
|
||||
task_id = queue_item['task_id']
|
||||
|
||||
# Mettre à jour le statut dans l'historique: queued -> downloading
|
||||
# Mettre à jour le statut dans l'historique: queued -> Downloading
|
||||
for entry in config.history:
|
||||
if entry.get('task_id') == task_id and entry.get('status') == 'queued':
|
||||
entry['status'] = 'downloading'
|
||||
if entry.get('task_id') == task_id and entry.get('status') == 'Queued':
|
||||
entry['status'] = 'Downloading'
|
||||
entry['message'] = _("download_in_progress")
|
||||
save_history(config.history)
|
||||
break
|
||||
@@ -665,15 +665,15 @@ def handle_controls(event, sources, joystick, screen):
|
||||
'is_zip_non_supported': pending_download[3],
|
||||
'is_1fichier': is_1fichier_url(url),
|
||||
'task_id': task_id,
|
||||
'status': 'queued'
|
||||
'status': 'Queued'
|
||||
}
|
||||
config.download_queue.append(queue_item)
|
||||
|
||||
# Ajouter une entrée à l'historique avec status "queued"
|
||||
# Ajouter une entrée à l'historique avec status "Queued"
|
||||
config.history.append({
|
||||
'platform': platform,
|
||||
'game_name': game_name,
|
||||
'status': 'queued',
|
||||
'status': 'Queued',
|
||||
'url': url,
|
||||
'progress': 0,
|
||||
'message': _("download_queued"),
|
||||
@@ -827,7 +827,7 @@ def handle_controls(event, sources, joystick, screen):
|
||||
elif is_input_matched(event, "cancel") or is_input_matched(event, "history"):
|
||||
if config.history and config.current_history_item < len(config.history):
|
||||
entry = config.history[config.current_history_item]
|
||||
if entry.get("status") in ["downloading", "Téléchargement", "Extracting"] and is_input_matched(event, "cancel"):
|
||||
if entry.get("status") in ["Downloading", "Téléchargement", "Extracting"] and is_input_matched(event, "cancel"):
|
||||
config.menu_state = "confirm_cancel_download"
|
||||
config.confirm_cancel_selection = 0
|
||||
config.needs_redraw = True
|
||||
@@ -889,7 +889,7 @@ def handle_controls(event, sources, joystick, screen):
|
||||
# 0 = Non, 1 = Oui
|
||||
if config.confirm_clear_selection == 1: # Oui
|
||||
clear_history()
|
||||
config.history = []
|
||||
config.history = load_history() # Recharger l'historique (conserve les téléchargements en cours)
|
||||
config.current_history_item = 0
|
||||
config.history_scroll_offset = 0
|
||||
config.menu_state = "history"
|
||||
@@ -1078,7 +1078,7 @@ def handle_controls(event, sources, joystick, screen):
|
||||
url = entry.get("url")
|
||||
if url:
|
||||
# Mettre à jour le statut
|
||||
entry["status"] = "downloading"
|
||||
entry["status"] = "Downloading"
|
||||
entry["progress"] = 0
|
||||
entry["message"] = "Téléchargement en cours"
|
||||
save_history(config.history)
|
||||
@@ -1283,7 +1283,7 @@ def handle_controls(event, sources, joystick, screen):
|
||||
# Mark all in-progress downloads as canceled in history
|
||||
try:
|
||||
for entry in getattr(config, 'history', []) or []:
|
||||
if entry.get("status") in ["downloading", "Téléchargement", "Extracting"]:
|
||||
if entry.get("status") in ["Downloading", "Téléchargement", "Extracting"]:
|
||||
entry["status"] = "Canceled"
|
||||
entry["progress"] = 0
|
||||
entry["message"] = _("download_canceled") if _ else "Download canceled"
|
||||
|
||||
@@ -956,7 +956,7 @@ def draw_history_list(screen):
|
||||
# Cherche une entrée en cours de téléchargement pour afficher la vitesse
|
||||
speed_str = ""
|
||||
for entry in history:
|
||||
if entry.get("status") in ["Téléchargement", "downloading"]:
|
||||
if entry.get("status") in ["Téléchargement", "Downloading"]:
|
||||
speed = entry.get("speed", 0.0)
|
||||
if speed and speed > 0:
|
||||
speed_str = f" - {speed:.2f} Mo/s"
|
||||
@@ -1001,7 +1001,7 @@ def draw_history_list(screen):
|
||||
current_history_item_inverted = 0
|
||||
|
||||
speed = 0.0
|
||||
if history and history[current_history_item_inverted].get("status") in ["Téléchargement", "downloading"]:
|
||||
if history and history[current_history_item_inverted].get("status") in ["Téléchargement", "Downloading"]:
|
||||
speed = history[current_history_item_inverted].get("speed", 0.0)
|
||||
if speed > 0:
|
||||
speed_str = f"{speed:.2f} Mo/s"
|
||||
@@ -1094,7 +1094,7 @@ def draw_history_list(screen):
|
||||
provider_prefix = entry.get("provider_prefix") or (entry.get("provider") + ":" if entry.get("provider") else "")
|
||||
|
||||
# Compute status text (optimized version without redundant prefix for errors)
|
||||
if status in ["Téléchargement", "downloading"]:
|
||||
if status in ["Téléchargement", "Downloading"]:
|
||||
# Vérifier si un message personnalisé existe (ex: mode gratuit avec attente)
|
||||
custom_message = entry.get('message', '')
|
||||
# Détecter les messages du mode gratuit (commencent par '[' dans toutes les langues)
|
||||
|
||||
@@ -50,12 +50,20 @@ def load_history():
|
||||
logger.warning(f"Format history.json invalide (pas une liste), retour liste vide")
|
||||
return []
|
||||
|
||||
# Filtrer les entrées valides au lieu de tout rejeter
|
||||
valid_entries = []
|
||||
invalid_count = 0
|
||||
for entry in history:
|
||||
if not all(key in entry for key in ['platform', 'game_name', 'status']):
|
||||
logger.warning(f"Entrée d'historique invalide : {entry}")
|
||||
return []
|
||||
#logger.debug(f"Historique chargé depuis {history_path}, {len(history)} entrées")
|
||||
return history
|
||||
if isinstance(entry, dict) and all(key in entry for key in ['platform', 'game_name', 'status']):
|
||||
valid_entries.append(entry)
|
||||
else:
|
||||
invalid_count += 1
|
||||
logger.warning(f"Entrée d'historique invalide ignorée : {entry}")
|
||||
|
||||
if invalid_count > 0:
|
||||
logger.info(f"Historique chargé : {len(valid_entries)} valides, {invalid_count} invalides ignorées")
|
||||
#logger.debug(f"Historique chargé depuis {history_path}, {len(valid_entries)} entrées")
|
||||
return valid_entries
|
||||
except (FileNotFoundError, json.JSONDecodeError) as e:
|
||||
logger.error(f"Erreur lors de la lecture de {history_path} : {e}")
|
||||
return []
|
||||
@@ -106,12 +114,26 @@ def add_to_history(platform, game_name, status, url=None, progress=0, message=No
|
||||
return entry
|
||||
|
||||
def clear_history():
|
||||
"""Vide l'historique."""
|
||||
"""Vide l'historique en conservant les téléchargements en cours."""
|
||||
history_path = getattr(config, 'HISTORY_PATH')
|
||||
try:
|
||||
# Charger l'historique actuel
|
||||
current_history = load_history()
|
||||
|
||||
# Conserver uniquement les entrées avec statut actif (téléchargement, extraction ou conversion en cours)
|
||||
# Supporter les deux variantes de statut (anglais et français)
|
||||
active_statuses = {"Downloading", "Téléchargement", "downloading", "Extracting", "Converting", "Queued"}
|
||||
preserved_entries = [
|
||||
entry for entry in current_history
|
||||
if entry.get("status") in active_statuses
|
||||
]
|
||||
|
||||
# Sauvegarder l'historique filtré
|
||||
with open(history_path, "w", encoding='utf-8') as f:
|
||||
json.dump([], f)
|
||||
logger.info(f"Historique vidé : {history_path}")
|
||||
json.dump(preserved_entries, f, indent=2, ensure_ascii=False)
|
||||
|
||||
removed_count = len(current_history) - len(preserved_entries)
|
||||
logger.info(f"Historique vidé : {history_path} ({removed_count} entrées supprimées, {len(preserved_entries)} conservées)")
|
||||
except Exception as e:
|
||||
logger.error(f"Erreur lors du vidage de {history_path} : {e}")
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ def download_1fichier_free_mode(url, dest_dir, session, log_callback=None, progr
|
||||
return (True, filepath, None)
|
||||
|
||||
except Exception as e:
|
||||
error_msg = f"Error downloading with free mode: {str(e)}"
|
||||
error_msg = f"Error Downloading with free mode: {str(e)}"
|
||||
_log(error_msg)
|
||||
logger.error(error_msg, exc_info=True)
|
||||
return (False, None, error_msg)
|
||||
@@ -679,7 +679,7 @@ async def download_rom(url, platform, game_name, is_zip_non_supported=False, tas
|
||||
|
||||
def download_thread():
|
||||
try:
|
||||
# IMPORTANT: Créer l'entrée dans config.history dès le début avec status "downloading"
|
||||
# IMPORTANT: Créer l'entrée dans config.history dès le début avec status "Downloading"
|
||||
# pour que l'interface web puisse afficher le téléchargement en cours
|
||||
|
||||
# TOUJOURS charger l'historique existant depuis le fichier pour éviter d'écraser les anciennes entrées
|
||||
@@ -690,8 +690,8 @@ async def download_rom(url, platform, game_name, is_zip_non_supported=False, tas
|
||||
for entry in config.history:
|
||||
if entry.get("url") == url:
|
||||
entry_exists = True
|
||||
# Réinitialiser le status à "downloading"
|
||||
entry["status"] = "downloading"
|
||||
# Réinitialiser le status à "Downloading"
|
||||
entry["status"] = "Downloading"
|
||||
entry["progress"] = 0
|
||||
entry["downloaded_size"] = 0
|
||||
entry["platform"] = platform
|
||||
@@ -706,7 +706,7 @@ async def download_rom(url, platform, game_name, is_zip_non_supported=False, tas
|
||||
"platform": platform,
|
||||
"game_name": game_name,
|
||||
"url": url,
|
||||
"status": "downloading",
|
||||
"status": "Downloading",
|
||||
"progress": 0,
|
||||
"downloaded_size": 0,
|
||||
"total_size": 0,
|
||||
@@ -1126,7 +1126,7 @@ async def download_rom(url, platform, game_name, is_zip_non_supported=False, tas
|
||||
try:
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["downloading", "Téléchargement"]:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["Downloading", "Téléchargement"]:
|
||||
entry["status"] = "Extracting"
|
||||
entry["progress"] = 0
|
||||
entry["message"] = "Préparation de l'extraction..."
|
||||
@@ -1212,7 +1212,7 @@ async def download_rom(url, platform, game_name, is_zip_non_supported=False, tas
|
||||
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["downloading", "Téléchargement", "Extracting"]:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["Downloading", "Téléchargement", "Extracting"]:
|
||||
entry["status"] = "Download_OK" if success else "Erreur"
|
||||
entry["progress"] = 100 if success else 0
|
||||
entry["message"] = message
|
||||
@@ -1252,7 +1252,7 @@ async def download_rom(url, platform, game_name, is_zip_non_supported=False, tas
|
||||
# NOTE: On ne touche PAS au timestamp qui doit rester celui de création
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["downloading", "Téléchargement"]:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["Downloading", "Téléchargement"]:
|
||||
entry["downloaded_size"] = downloaded
|
||||
entry["total_size"] = total_size
|
||||
entry["speed"] = speed
|
||||
@@ -1284,7 +1284,7 @@ async def download_rom(url, platform, game_name, is_zip_non_supported=False, tas
|
||||
logger.debug(f"[DRAIN_QUEUE] Processing final message: success={success}, message={message[:100] if message else 'None'}")
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["downloading", "Téléchargement", "Extracting"]:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["Downloading", "Téléchargement", "Extracting"]:
|
||||
entry["status"] = "Download_OK" if success else "Erreur"
|
||||
entry["progress"] = 100 if success else 0
|
||||
entry["message"] = message
|
||||
@@ -1406,7 +1406,7 @@ async def download_from_1fichier(url, platform, game_name, is_zip_non_supported=
|
||||
link = url.split('&af=')[0]
|
||||
logger.debug(f"URL nettoyée: {link}")
|
||||
|
||||
# IMPORTANT: Créer l'entrée dans config.history dès le début avec status "downloading"
|
||||
# IMPORTANT: Créer l'entrée dans config.history dès le début avec status "Downloading"
|
||||
# pour que l'interface web puisse afficher le téléchargement en cours
|
||||
|
||||
# Charger l'historique existant depuis le fichier
|
||||
@@ -1418,8 +1418,8 @@ async def download_from_1fichier(url, platform, game_name, is_zip_non_supported=
|
||||
for entry in config.history:
|
||||
if entry.get("url") == url:
|
||||
entry_exists = True
|
||||
# Réinitialiser le status à "downloading"
|
||||
entry["status"] = "downloading"
|
||||
# Réinitialiser le status à "Downloading"
|
||||
entry["status"] = "Downloading"
|
||||
entry["progress"] = 0
|
||||
entry["downloaded_size"] = 0
|
||||
entry["platform"] = platform
|
||||
@@ -1434,7 +1434,7 @@ async def download_from_1fichier(url, platform, game_name, is_zip_non_supported=
|
||||
"platform": platform,
|
||||
"game_name": game_name,
|
||||
"url": url,
|
||||
"status": "downloading",
|
||||
"status": "Downloading",
|
||||
"progress": 0,
|
||||
"downloaded_size": 0,
|
||||
"total_size": 0,
|
||||
@@ -1857,7 +1857,7 @@ async def download_from_1fichier(url, platform, game_name, is_zip_non_supported=
|
||||
with free_lock:
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] == "downloading":
|
||||
if "url" in entry and entry["url"] == url and entry["status"] == "Downloading":
|
||||
entry["progress"] = int(pct) if pct else 0
|
||||
entry["downloaded_size"] = downloaded
|
||||
entry["total_size"] = total
|
||||
@@ -1928,7 +1928,7 @@ async def download_from_1fichier(url, platform, game_name, is_zip_non_supported=
|
||||
else:
|
||||
logger.error(f"Échec téléchargement gratuit: {error_msg}")
|
||||
result[0] = False
|
||||
result[1] = f"Error downloading with free mode: {error_msg}"
|
||||
result[1] = f"Error Downloading with free mode: {error_msg}"
|
||||
return
|
||||
|
||||
except Exception as e:
|
||||
@@ -2061,7 +2061,7 @@ async def download_from_1fichier(url, platform, game_name, is_zip_non_supported=
|
||||
with lock:
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] == "downloading":
|
||||
if "url" in entry and entry["url"] == url and entry["status"] == "Downloading":
|
||||
entry["total_size"] = total_size
|
||||
config.needs_redraw = True
|
||||
break
|
||||
@@ -2099,7 +2099,7 @@ async def download_from_1fichier(url, platform, game_name, is_zip_non_supported=
|
||||
with lock:
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] == "downloading":
|
||||
if "url" in entry and entry["url"] == url and entry["status"] == "Downloading":
|
||||
progress_percent = int(downloaded / total_size * 100) if total_size > 0 else 0
|
||||
progress_percent = max(0, min(100, progress_percent))
|
||||
entry["progress"] = progress_percent
|
||||
@@ -2226,7 +2226,7 @@ async def download_from_1fichier(url, platform, game_name, is_zip_non_supported=
|
||||
success, message = data[1], data[2]
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["downloading", "Téléchargement", "Extracting"]:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["Downloading", "Téléchargement", "Extracting"]:
|
||||
entry["status"] = "Download_OK" if success else "Erreur"
|
||||
entry["progress"] = 100 if success else 0
|
||||
entry["message"] = message
|
||||
@@ -2251,7 +2251,7 @@ async def download_from_1fichier(url, platform, game_name, is_zip_non_supported=
|
||||
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["downloading", "Téléchargement"]:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["Downloading", "Téléchargement"]:
|
||||
entry["progress"] = progress_percent
|
||||
entry["status"] = "Téléchargement"
|
||||
entry["downloaded_size"] = downloaded
|
||||
@@ -2281,7 +2281,7 @@ async def download_from_1fichier(url, platform, game_name, is_zip_non_supported=
|
||||
logger.debug(f"[1F_DRAIN_QUEUE] Processing final message: success={success}, message={message[:100] if message else 'None'}")
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["downloading", "Téléchargement", "Extracting"]:
|
||||
if "url" in entry and entry["url"] == url and entry["status"] in ["Downloading", "Téléchargement", "Extracting"]:
|
||||
entry["status"] = "Download_OK" if success else "Erreur"
|
||||
entry["progress"] = 100 if success else 0
|
||||
entry["message"] = message
|
||||
|
||||
@@ -103,7 +103,7 @@ def ensure_data_present(verbose: bool = False):
|
||||
headers = {"User-Agent": "Mozilla/5.0"}
|
||||
# Always show progress when we're in the 'missing data' path
|
||||
show = True or verbose
|
||||
print("Source data not found, downloading...")
|
||||
print("Source data not found, Downloading...")
|
||||
print(f"Downloading data from {url}...")
|
||||
try:
|
||||
with requests.get(url, stream=True, headers=headers, timeout=60) as r:
|
||||
@@ -394,7 +394,7 @@ async def _run_download_with_progress(url: str, platform_name: str, game_name: s
|
||||
try:
|
||||
if isinstance(config.history, list):
|
||||
for e in config.history:
|
||||
if e.get('url') == url and e.get('status') in ("downloading", "Téléchargement", "Extracting"):
|
||||
if e.get('url') == url and e.get('status') in ("Downloading", "Téléchargement", "Extracting"):
|
||||
downloaded = int(e.get('downloaded_size') or 0)
|
||||
total = int(e.get('total_size') or 0)
|
||||
speed = e.get('speed')
|
||||
@@ -646,7 +646,7 @@ def cmd_download(args):
|
||||
hist.append({
|
||||
"platform": platform.get('platform_name') or platform.get('platform') or args.platform,
|
||||
"game_name": title,
|
||||
"status": "downloading",
|
||||
"status": "Downloading",
|
||||
"url": url,
|
||||
"progress": 0,
|
||||
"message": "Téléchargement en cours",
|
||||
|
||||
@@ -175,6 +175,17 @@ logger.info("Chargement initial des données...")
|
||||
try:
|
||||
load_sources() # Initialise config.games_count
|
||||
logger.info(f"{len(getattr(config, 'platforms', []))} plateformes chargées")
|
||||
|
||||
# Initialiser filter_platforms_selection depuis les settings (pour filtrer les plateformes)
|
||||
from rgsx_settings import load_rgsx_settings
|
||||
settings = load_rgsx_settings()
|
||||
hidden = set(settings.get("hidden_platforms", [])) if isinstance(settings, dict) else set()
|
||||
|
||||
if not hasattr(config, 'filter_platforms_selection') or not config.filter_platforms_selection:
|
||||
all_platform_names = sorted([p.get("platform_name", "") for p in config.platforms if p.get("platform_name")])
|
||||
config.filter_platforms_selection = [(name, name in hidden) for name in all_platform_names]
|
||||
logger.info(f"Filter platforms initialisé: {len(hidden)} plateformes cachées sur {len(all_platform_names)}")
|
||||
|
||||
# Force flush
|
||||
for handler in logging.root.handlers:
|
||||
handler.flush()
|
||||
@@ -229,14 +240,40 @@ class RGSXHandler(BaseHTTPRequestHandler):
|
||||
platforms = load_sources()
|
||||
# Ajouter le nombre de jeux depuis config.games_count
|
||||
games_count_dict = getattr(config, 'games_count', {})
|
||||
|
||||
# Filtrer les plateformes cachées selon config.filter_platforms_selection
|
||||
hidden_platforms = set()
|
||||
if hasattr(config, 'filter_platforms_selection') and config.filter_platforms_selection:
|
||||
hidden_platforms = {name for name, is_hidden in config.filter_platforms_selection if is_hidden}
|
||||
|
||||
# Ajouter aussi les plateformes sans dossier ROM (si show_unsupported_platforms = False)
|
||||
from rgsx_settings import load_rgsx_settings, get_show_unsupported_platforms
|
||||
settings = load_rgsx_settings()
|
||||
show_unsupported = get_show_unsupported_platforms(settings)
|
||||
|
||||
if not show_unsupported:
|
||||
# Masquer les plateformes dont le dossier ROM n'existe pas
|
||||
for platform in platforms:
|
||||
platform_name = platform.get('platform_name', '')
|
||||
folder = platform.get('folder', '')
|
||||
# Garder BIOS même sans dossier
|
||||
if platform_name and folder and platform_name not in ["- BIOS by TMCTV -", "- BIOS"]:
|
||||
expected_dir = os.path.join(config.ROMS_FOLDER, folder)
|
||||
if not os.path.isdir(expected_dir):
|
||||
hidden_platforms.add(platform_name)
|
||||
|
||||
filtered_platforms = []
|
||||
for platform in platforms:
|
||||
platform_name = platform.get('platform_name', '')
|
||||
platform['games_count'] = games_count_dict.get(platform_name, 0)
|
||||
# Exclure les plateformes cachées
|
||||
if platform_name not in hidden_platforms:
|
||||
platform['games_count'] = games_count_dict.get(platform_name, 0)
|
||||
filtered_platforms.append(platform)
|
||||
|
||||
self._send_json({
|
||||
'success': True,
|
||||
'count': len(platforms),
|
||||
'platforms': platforms
|
||||
'count': len(filtered_platforms),
|
||||
'platforms': filtered_platforms
|
||||
})
|
||||
|
||||
# Route: API - Recherche universelle (systèmes + jeux)
|
||||
@@ -258,12 +295,38 @@ class RGSXHandler(BaseHTTPRequestHandler):
|
||||
platforms = load_sources()
|
||||
games_count_dict = getattr(config, 'games_count', {})
|
||||
|
||||
# Filtrer les plateformes cachées selon config.filter_platforms_selection
|
||||
hidden_platforms = set()
|
||||
if hasattr(config, 'filter_platforms_selection') and config.filter_platforms_selection:
|
||||
hidden_platforms = {name for name, is_hidden in config.filter_platforms_selection if is_hidden}
|
||||
|
||||
# Ajouter aussi les plateformes sans dossier ROM (si show_unsupported_platforms = False)
|
||||
from rgsx_settings import load_rgsx_settings, get_show_unsupported_platforms
|
||||
settings = load_rgsx_settings()
|
||||
show_unsupported = get_show_unsupported_platforms(settings)
|
||||
|
||||
if not show_unsupported:
|
||||
# Masquer les plateformes dont le dossier ROM n'existe pas
|
||||
for platform in platforms:
|
||||
platform_name = platform.get('platform_name', '')
|
||||
folder = platform.get('folder', '')
|
||||
# Garder BIOS même sans dossier
|
||||
if platform_name and folder and platform_name not in ["- BIOS by TMCTV -", "- BIOS"]:
|
||||
expected_dir = os.path.join(config.ROMS_FOLDER, folder)
|
||||
if not os.path.isdir(expected_dir):
|
||||
hidden_platforms.add(platform_name)
|
||||
|
||||
matching_platforms = []
|
||||
matching_games = []
|
||||
|
||||
# Rechercher dans les plateformes et leurs jeux
|
||||
for platform in platforms:
|
||||
platform_name = platform.get('platform_name', '')
|
||||
|
||||
# Exclure les plateformes cachées
|
||||
if platform_name in hidden_platforms:
|
||||
continue
|
||||
|
||||
platform_name_lower = platform_name.lower()
|
||||
|
||||
# Vérifier si le système correspond
|
||||
@@ -347,8 +410,8 @@ class RGSXHandler(BaseHTTPRequestHandler):
|
||||
|
||||
print(f"\n[DEBUG PROGRESS] history.json chargé avec {len(history)} entrées totales")
|
||||
|
||||
# Filtrer les entrées avec status "downloading", "Téléchargement", "Connecting", "Try X/Y"
|
||||
in_progress_statuses = ["downloading", "Téléchargement", "Downloading", "Connecting", "Extracting"]
|
||||
# Filtrer les entrées avec status "Downloading", "Téléchargement", "Connecting", "Try X/Y"
|
||||
in_progress_statuses = ["Downloading", "Téléchargement", "Downloading", "Connecting", "Extracting"]
|
||||
|
||||
downloads = {}
|
||||
for entry in history:
|
||||
@@ -393,7 +456,7 @@ class RGSXHandler(BaseHTTPRequestHandler):
|
||||
# Inclure: statuts terminés + en queue + en cours
|
||||
included_statuses = [
|
||||
"Download_OK", "Erreur", "error", "Canceled", "Already_Present", # Terminés
|
||||
"queued", "downloading", "Téléchargement", "Downloading", "Connecting", "Extracting", # En cours
|
||||
"Queued", "Downloading", "Téléchargement", "Downloading", "Connecting", "Extracting", # En cours
|
||||
]
|
||||
# Inclure aussi les statuts "Try X/Y" (tentatives)
|
||||
visible_history = [
|
||||
@@ -608,15 +671,15 @@ class RGSXHandler(BaseHTTPRequestHandler):
|
||||
|
||||
config.download_active = True
|
||||
|
||||
# Mettre à jour l'historique: queued -> downloading
|
||||
# Mettre à jour l'historique: queued -> Downloading
|
||||
from history import load_history, save_history
|
||||
config.history = load_history()
|
||||
for entry in config.history:
|
||||
if entry.get('task_id') == task_id and entry.get('status') == 'queued':
|
||||
entry['status'] = 'downloading'
|
||||
if entry.get('task_id') == task_id and entry.get('status') == 'Queued':
|
||||
entry['status'] = 'Downloading'
|
||||
entry['message'] = get_translation('download_in_progress')
|
||||
save_history(config.history)
|
||||
logger.info(f"📋 Statut mis à jour de 'queued' à 'downloading' pour {game_name} (task_id={task_id})")
|
||||
logger.info(f"📋 Statut mis à jour de 'queued' à 'Downloading' pour {game_name} (task_id={task_id})")
|
||||
break
|
||||
|
||||
if is_1fichier:
|
||||
@@ -779,7 +842,7 @@ class RGSXHandler(BaseHTTPRequestHandler):
|
||||
'is_zip_non_supported': is_zip_non_supported,
|
||||
'is_1fichier': is_1fichier,
|
||||
'task_id': task_id,
|
||||
'status': 'queued'
|
||||
'status': 'Queued'
|
||||
}
|
||||
config.download_queue.append(queue_item)
|
||||
|
||||
@@ -788,7 +851,7 @@ class RGSXHandler(BaseHTTPRequestHandler):
|
||||
queue_history_entry = {
|
||||
'platform': platform,
|
||||
'game_name': game_name,
|
||||
'status': 'queued',
|
||||
'status': 'Queued',
|
||||
'url': game_url,
|
||||
'progress': 0,
|
||||
'message': get_translation('download_queued'),
|
||||
@@ -819,13 +882,13 @@ class RGSXHandler(BaseHTTPRequestHandler):
|
||||
config.download_active = True
|
||||
logger.info(f"🚀 Lancement du premier élément de la queue: {game_name}")
|
||||
|
||||
# Ajouter une entrée à l'historique avec status "downloading"
|
||||
# Ajouter une entrée à l'historique avec status "Downloading"
|
||||
# (pas "queued" car on lance immédiatement)
|
||||
import datetime
|
||||
download_history_entry = {
|
||||
'platform': platform,
|
||||
'game_name': game_name,
|
||||
'status': 'downloading',
|
||||
'status': 'Downloading',
|
||||
'url': game_url,
|
||||
'progress': 0,
|
||||
'message': get_translation('download_in_progress'),
|
||||
@@ -894,7 +957,7 @@ class RGSXHandler(BaseHTTPRequestHandler):
|
||||
task_id = None
|
||||
|
||||
for entry in history:
|
||||
if entry.get('url') == url and entry.get('status') in ['downloading', 'Téléchargement', 'Downloading', 'Connecting']:
|
||||
if entry.get('url') == url and entry.get('status') in ['Downloading', 'Téléchargement', 'Downloading', 'Connecting']:
|
||||
# Mettre à jour le statut dans l'historique
|
||||
entry['status'] = 'Canceled'
|
||||
entry['progress'] = 0
|
||||
@@ -2142,7 +2205,7 @@ DO NOT share this file publicly as it may contain sensitive information.
|
||||
platformsMatch.forEach(platform => {
|
||||
const imageUrl = '/api/platform-image/' + encodeURIComponent(platform.platform_name);
|
||||
html += `
|
||||
<div class="platform-card" onclick="loadGames('${platform.platform_name.replace(/'/g, "\\'")}')">
|
||||
<div class="platform-card" onclick='loadGames("${platform.platform_name.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}")'>
|
||||
<img src="${imageUrl}" alt="${platform.platform_name}" onerror="this.src='/favicon.ico'">
|
||||
<h3>${platform.platform_name}</h3>
|
||||
<p>${platform.games_count} ${t('web_games')}</p>
|
||||
@@ -2170,7 +2233,7 @@ DO NOT share this file publicly as it may contain sensitive information.
|
||||
for (const [platformName, games] of Object.entries(gamesByPlatform)) {
|
||||
html += `
|
||||
<div style="margin-bottom: 15px; background: white; padding: 15px; border-radius: 5px; border: 1px solid #ddd;">
|
||||
<h5 style="margin: 0 0 10px 0; color: #007bff; cursor: pointer;" onclick="loadGames('${platformName.replace(/'/g, "\\'")}')">
|
||||
<h5 style="margin: 0 0 10px 0; color: #007bff; cursor: pointer;" onclick='loadGames("${platformName.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}")'>
|
||||
📁 ${platformName} (${games.length})
|
||||
</h5>
|
||||
<div style="display: flex; flex-direction: column; gap: 8px;">
|
||||
@@ -2184,8 +2247,8 @@ DO NOT share this file publicly as it may contain sensitive information.
|
||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||
${game.size ? `<span style="background: #667eea; color: white; padding: 5px 10px; border-radius: 5px; font-size: 0.9em; white-space: nowrap;">${game.size}</span>` : '<span></span>'}
|
||||
<div class="download-btn-group" style="display: flex; gap: 4px;">
|
||||
<button class="download-btn" title="${downloadTitle} (now)" onclick="downloadGame('${platformName.replace(/'/g, "\\'")}', '${game.game_name.replace(/'/g, "\\'")}', null, 'now')" style="background: transparent; color: #28a745; border: none; padding: 8px; border-radius: 5px; cursor: pointer; font-size: 1.5em; min-width: 40px;">⬇️</button>
|
||||
<button class="download-btn" title="${downloadTitle} (queue)" onclick="downloadGame('${platformName.replace(/'/g, "\\'")}', '${game.game_name.replace(/'/g, "\\'")}', null, 'queue')" style="background: transparent; color: #28a745; border: none; padding: 8px; border-radius: 5px; cursor: pointer; font-size: 1.5em; min-width: 40px;">➕</button>
|
||||
<button class="download-btn" title="${downloadTitle} (now)" onclick='downloadGame("${platformName.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}", "${game.game_name.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}", null, "now")' style="background: transparent; color: #28a745; border: none; padding: 8px; border-radius: 5px; cursor: pointer; font-size: 1.5em; min-width: 40px;">⬇️</button>
|
||||
<button class="download-btn" title="${downloadTitle} (queue)" onclick='downloadGame("${platformName.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}", "${game.game_name.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}", null, "queue")' style="background: transparent; color: #28a745; border: none; padding: 8px; border-radius: 5px; cursor: pointer; font-size: 1.5em; min-width: 40px;">➕</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2323,7 +2386,7 @@ DO NOT share this file publicly as it may contain sensitive information.
|
||||
data.platforms.forEach(p => {
|
||||
let gameCountText = t('web_game_count', '📦', p.games_count || 0);
|
||||
html += `
|
||||
<div class="platform-card" onclick="loadGames('${p.platform_name.replace(/'/g, "\\\\'")}')">
|
||||
<div class="platform-card" onclick='loadGames("${p.platform_name.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}")'>
|
||||
<img src="/api/image/${encodeURIComponent(p.platform_name)}"
|
||||
alt="${p.platform_name}"
|
||||
onerror="this.src='/api/image/default'">
|
||||
@@ -2397,8 +2460,8 @@ DO NOT share this file publicly as it may contain sensitive information.
|
||||
<span class="game-name">${g.name}</span>
|
||||
${g.size ? `<span class="game-size">${g.size}</span>` : ''}
|
||||
<div class="download-btn-group" style="display: flex; gap: 4px;">
|
||||
<button class="download-btn" title="${downloadTitle} (now)" onclick="downloadGame('${platform.replace(/'/g, "\\'")}', '${g.name.replace(/'/g, "\\'")}', ${idx}, 'now')">⬇️</button>
|
||||
<button class="download-btn" title="${downloadTitle} (queue)" onclick="downloadGame('${platform.replace(/'/g, "\\'")}', '${g.name.replace(/'/g, "\\'")}', ${idx}, 'queue')" style="background: #e0e0e0; color: #333;">➕</button>
|
||||
<button class="download-btn" title="${downloadTitle} (now)" onclick='downloadGame("${platform.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}", "${g.name.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}", ${idx}, "now")'>⬇️</button>
|
||||
<button class="download-btn" title="${downloadTitle} (queue)" onclick='downloadGame("${platform.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}", "${g.name.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}", ${idx}, "queue")' style="background: #e0e0e0; color: #333;">➕</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -2567,7 +2630,7 @@ DO NOT share this file publicly as it may contain sensitive information.
|
||||
<div class="info-item">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<strong>📥 ${fileName}${platformInfo}</strong>
|
||||
<button class="btn-action" onclick="cancelDownload('${url.replace(/'/g, "\\\\'")}', this)" title="${t('web_cancel')}">
|
||||
<button class="btn-action" onclick='cancelDownload("${url.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}", this)' title="${t('web_cancel')}">
|
||||
❌
|
||||
</button>
|
||||
</div>
|
||||
@@ -2635,7 +2698,7 @@ DO NOT share this file publicly as it may contain sensitive information.
|
||||
<div class="info-item">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<strong>📥 ${fileName}${platformInfo}</strong>
|
||||
<button class="btn-action" onclick="cancelDownload('${url.replace(/'/g, "\\\\'")}', this)" title="${t('web_cancel')}">
|
||||
<button class="btn-action" onclick='cancelDownload("${url.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}", this)' title="${t('web_cancel')}">
|
||||
❌
|
||||
</button>
|
||||
</div>
|
||||
@@ -2704,7 +2767,7 @@ DO NOT share this file publicly as it may contain sensitive information.
|
||||
queue.forEach((item, idx) => {
|
||||
const gameName = item.game_name || 'Unknown';
|
||||
const platform = item.platform || 'N/A';
|
||||
const status = item.status || 'queued';
|
||||
const status = item.status || 'Queued';
|
||||
html += `
|
||||
<div class="info-item" style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<div style="flex: 1;">
|
||||
@@ -2713,7 +2776,7 @@ DO NOT share this file publicly as it may contain sensitive information.
|
||||
Platform: ${platform} | Status: ${status}
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn-action" onclick="removeFromQueue('${item.task_id.replace(/'/g, "\\\\'")}', this)" title="${t('web_remove')}">
|
||||
<button class="btn-action" onclick='removeFromQueue("${item.task_id.replace(/["']/g, function(m){return m==="\\"" ? """ : "'"})}", this)' title="${t('web_remove')}">
|
||||
❌
|
||||
</button>
|
||||
</div>
|
||||
@@ -2814,8 +2877,8 @@ DO NOT share this file publicly as it may contain sensitive information.
|
||||
const isError = status === 'Erreur' || status === 'error';
|
||||
const isCanceled = status === 'Canceled';
|
||||
const isAlreadyPresent = status === 'Already_Present';
|
||||
const isQueued = status === 'queued';
|
||||
const isDownloading = status === 'downloading' || status === 'Téléchargement' || status === 'Downloading' ||
|
||||
const isQueued = status === 'Queued';
|
||||
const isDownloading = status === 'Downloading' || status === 'Téléchargement' || status === 'Downloading' ||
|
||||
status === 'Connecting' || status === 'Extracting' || status.startsWith('Try ');
|
||||
const isSuccess = status === 'Download_OK' || status === 'Completed';
|
||||
|
||||
|
||||
@@ -987,7 +987,7 @@ def _update_extraction_progress(url, extracted_size, total_size, lock, last_save
|
||||
with lock:
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if "status" in entry and entry["status"] in ["Téléchargement", "Extracting", "downloading"]:
|
||||
if "status" in entry and entry["status"] in ["Téléchargement", "Extracting", "Downloading"]:
|
||||
if "url" in entry and entry["url"] == url:
|
||||
progress_percent = int(extracted_size / total_size * 100) if total_size > 0 else 0
|
||||
progress_percent = max(0, min(100, progress_percent))
|
||||
@@ -1045,8 +1045,12 @@ def _handle_special_platforms(dest_dir, archive_path, before_dirs, iso_before=No
|
||||
before_items: Set de tous les éléments (fichiers+dossiers) avant extraction (pour DOS)
|
||||
"""
|
||||
# Xbox: conversion ISO
|
||||
xbox_dir = os.path.join(config.ROMS_FOLDER, "xbox")
|
||||
if dest_dir == xbox_dir and iso_before is not None:
|
||||
# Gérer les deux cas: symlink activé (xbox/xbox) ou désactivé (xbox)
|
||||
xbox_dir_normal = os.path.join(config.ROMS_FOLDER, "xbox")
|
||||
xbox_dir_symlink = os.path.join(config.ROMS_FOLDER, "xbox", "xbox")
|
||||
is_xbox = (dest_dir == xbox_dir_normal or dest_dir == xbox_dir_symlink)
|
||||
|
||||
if is_xbox and iso_before is not None:
|
||||
iso_after = set()
|
||||
for root, dirs, files in os.walk(dest_dir):
|
||||
for file in files:
|
||||
@@ -1754,7 +1758,7 @@ def handle_xbox(dest_dir, iso_files, url=None):
|
||||
# Historique
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if entry.get("url") == url and entry.get("status") in ["Extracting", "Téléchargement", "downloading"]:
|
||||
if entry.get("url") == url and entry.get("status") in ["Extracting", "Téléchargement", "Downloading"]:
|
||||
entry["status"] = "Converting"
|
||||
entry["progress"] = 0
|
||||
entry["message"] = "Xbox conversion in progress"
|
||||
@@ -1787,14 +1791,14 @@ def handle_xbox(dest_dir, iso_files, url=None):
|
||||
if url not in config.download_progress:
|
||||
config.download_progress[url] = {}
|
||||
config.download_progress[url]["status"] = "Error"
|
||||
config.download_progress[url]["message"] = err_msg
|
||||
config.download_progress[url]["message"] = {process.stderr}
|
||||
config.download_progress[url]["progress_percent"] = 0
|
||||
config.needs_redraw = True
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if entry.get("url") == url and entry.get("status") in ("Converting", "Extracting", "Téléchargement", "downloading"):
|
||||
if entry.get("url") == url and entry.get("status") in ("Converting", "Extracting", "Téléchargement", "Downloading"):
|
||||
entry["status"] = "Error"
|
||||
entry["message"] = err_msg
|
||||
entry["message"] = {process.stderr}
|
||||
save_history(config.history)
|
||||
break
|
||||
except Exception:
|
||||
@@ -1838,7 +1842,7 @@ def handle_xbox(dest_dir, iso_files, url=None):
|
||||
config.needs_redraw = True
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if entry.get("url") == url and entry.get("status") in ("Converting", "Extracting", "Téléchargement", "downloading"):
|
||||
if entry.get("url") == url and entry.get("status") in ("Converting", "Extracting", "Téléchargement", "Downloading"):
|
||||
entry["status"] = "Error"
|
||||
entry["message"] = err_msg
|
||||
save_history(config.history)
|
||||
@@ -1847,6 +1851,25 @@ def handle_xbox(dest_dir, iso_files, url=None):
|
||||
pass
|
||||
return False, "Échec de la conversion de l'ISO"
|
||||
|
||||
# Conversion terminée avec succès - mettre à jour le statut final
|
||||
try:
|
||||
if url:
|
||||
if url not in config.download_progress:
|
||||
config.download_progress[url] = {}
|
||||
config.download_progress[url]["status"] = "Download_OK"
|
||||
config.download_progress[url]["progress_percent"] = 100
|
||||
config.needs_redraw = True
|
||||
if isinstance(config.history, list):
|
||||
for entry in config.history:
|
||||
if entry.get("url") == url and entry.get("status") == "Converting":
|
||||
entry["status"] = "Download_OK"
|
||||
entry["progress"] = 100
|
||||
entry["message"] = "Xbox conversion completed successfully"
|
||||
save_history(config.history)
|
||||
break
|
||||
except Exception as e:
|
||||
logger.debug(f"MAJ statut final conversion ignorée: {e}")
|
||||
|
||||
return True, "Conversion Xbox terminée avec succès"
|
||||
|
||||
except Exception as e:
|
||||
|
||||
@@ -55,8 +55,8 @@ echo UPDATE_GAMELIST_SCRIPT : !UPDATE_GAMELIST_SCRIPT! >> "%LOG_FILE%"
|
||||
echo Checking python.exe...
|
||||
echo [%DATE% %TIME%] Checking python.exe at !PYTHON_EXE_FULL! >> "%LOG_FILE%"
|
||||
if not exist "!PYTHON_EXE_FULL!" (
|
||||
echo python.exe not found. Preparing download...
|
||||
echo [%DATE% %TIME%] python.exe not found. Preparing download... >> "%LOG_FILE%"
|
||||
echo python.exe not found in system/tools. Preparing to extract..
|
||||
echo [%DATE% %TIME%] python.exe not found in system/tools. Preparing to extract.. >> "%LOG_FILE%"
|
||||
|
||||
:: Créer le dossier Python s'il n'existe pas
|
||||
set "TOOLS_FOLDER_FULL=!ROOT_DIR!\system\tools"
|
||||
@@ -67,29 +67,21 @@ if not exist "!PYTHON_EXE_FULL!" (
|
||||
mkdir "!TOOLS_FOLDER_FULL!\Python"
|
||||
)
|
||||
|
||||
set ZIP_URL=https://retrogamesets.fr/softs/python.zip
|
||||
set "ZIP_FILE=!TOOLS_FOLDER_FULL!\python.zip"
|
||||
echo ZIP_URL : !ZIP_URL!
|
||||
echo [%DATE% %TIME%] ZIP_URL : !ZIP_URL! >> "%LOG_FILE%"
|
||||
echo ZIP_FILE : !ZIP_FILE!
|
||||
set "ZIP_FILE=%ROOT_DIR%\roms\windows\python.zip"
|
||||
echo Extracting ZIP_FILE : !ZIP_FILE! in /system/tools/Python
|
||||
echo [%DATE% %TIME%] ZIP_FILE : !ZIP_FILE! >> "%LOG_FILE%"
|
||||
|
||||
echo Downloading python.zip...
|
||||
echo [%DATE% %TIME%] Downloading python.zip from !ZIP_URL!... >> "%LOG_FILE%"
|
||||
curl -L "!ZIP_URL!" -o "!ZIP_FILE!"
|
||||
|
||||
|
||||
if exist "!ZIP_FILE!" (
|
||||
echo Download complete. Extracting python.zip...
|
||||
echo [%DATE% %TIME%] Download complete. Extracting python.zip to !TOOLS_FOLDER_FULL!... >> "%LOG_FILE%"
|
||||
echo [%DATE% %TIME%] Extracting python.zip to !TOOLS_FOLDER_FULL!... >> "%LOG_FILE%"
|
||||
tar -xf "!ZIP_FILE!" -C "!TOOLS_FOLDER_FULL!\Python" --strip-components=0
|
||||
echo Extraction finished.
|
||||
echo [%DATE% %TIME%] Extraction finished. >> "%LOG_FILE%"
|
||||
del /q "!ZIP_FILE!"
|
||||
del /s /q "!ZIP_FILE!"
|
||||
echo python.zip file deleted.
|
||||
echo [%DATE% %TIME%] python.zip file deleted. >> "%LOG_FILE%"
|
||||
) else (
|
||||
echo Error: Failed to download python.zip.
|
||||
echo [%DATE% %TIME%] Error: Failed to download python.zip. >> "%LOG_FILE%"
|
||||
echo Error: Error python.zip not found please download it from github and put in /roms/windows folder.
|
||||
echo [%DATE% %TIME%] Error: Error python.zip not found please download it from github and put in /roms/windows folder >> "%LOG_FILE%"
|
||||
goto :error
|
||||
)
|
||||
|
||||
|
||||
BIN
windows/python.zip
Normal file
BIN
windows/python.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user